PURPOSE









How do I use P U R P O S E
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: PurposeLabel.cs Copy
16         void Start()
17         {
18             BitmapFont purposeFont1 = new BitmapFont("Fonts/shop_font", "Fonts/shop_font_xml", purposeLabel1);
19             BitmapFont purposeFont2 = new BitmapFont(purposeFont1, purposeLabel2);
20             BitmapFont purposeFont3 = new BitmapFont(purposeFont1, purposeLabel3);
21
22             purposeFont1.setText("5th place or better : 50 #", 0, 12, "GUI", "GUI");
23             purposeFont2.setText("3rd place or better : 100 #", 0, 12, "GUI", "GUI");
24             purposeFont3.setText("1st place : 200 #", 0, 12, "GUI", "GUI");
25
26             purposeLabel1.transform.localScale = new Vector3(0.8f, 0.8f, purposeLabel1.transform.localScale.z);
27             purposeLabel2.transform.localScale = new Vector3(0.8f, 0.8f, purposeLabel2.transform.localScale.z);
28             purposeLabel3.transform.localScale = new Vector3(0.8f, 0.8f, purposeLabel3.transform.localScale.z);
29
30             int star = Data.getData(Data.KEY_STAR + (Attr.currentWorld * 15 + Attr.currentLevel));
31             for (int i = 0; i < 3; i++)
32             {
33                 if (i < star)
34                 {
35                     stars[i].GetComponent().sprite = starSprite;
36                 }
37             }
38
39         }
File name: frmReturn.cs Copy
96         private void btnreturn_save_Click(object sender, EventArgs e)
97         {
98             string tranid;
99
100             config.singleResult("SELECT concat(STRT,END) FROM tblautonumber WHERE ID = 6");
101             tranid = config.dt.Rows[0].Field(0);
102
103             if (txttransactionid.Text == "")
104             {
105                 MessageBox.Show("There are empty fields left that must be fill up!", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
106                 return;
107             }
108             if (dtCus_addedlist.RowCount == 0)
109             {
110                 MessageBox.Show("Cart is empty!", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
111                 return;
112             }
113
114             sql = "SELECT `ITEMID`, `QTY` FROM `tblstock_in_out` WHERE `TRANSACTIONNUMBER` ='" + txttransactionid.Text + "'";
115             config.singleResult(sql);
116
117             foreach (DataRow row in config.dt.Rows)
118             {
119                 for (int i = 0; i < dtCus_addedlist.Rows.Count; i++)
120                 {
121                     if (dtCus_addedlist.Rows[i].Cells[0].Value.ToString() == row.Field(0))
122                     {
123                         if (int.Parse(dtCus_addedlist.Rows[i].Cells[4].Value.ToString()) > row.Field(1))
124                         {
125                             MessageBox.Show("The returned quantity of the item ( " + dtCus_addedlist.Rows[i].Cells[1].Value.ToString() + " ) is greater than the available quantity of it.", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
126                             return;
127                         }
128                     }
129                     if (dtCus_addedlist.Rows[i].Cells[4].Value.ToString() == "")
130                     {
131                         MessageBox.Show("Set your purpose.", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
132                         return;
133                     }
134                 }
135             }
136
137             foreach (DataGridViewRow r in dtCus_addedlist.Rows)
138             {
139                 sql = "INSERT INTO `tblstock_return` ( `STOCKRETURNNUMBER`, `ITEMID`, `RETURNDATE`, `QTY`, `TOTALPRICE`, `OWNER_CUS_ID`)" +
140                         " VALUES ('" + tranid + "','" + r.Cells[0].Value + "','" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + r.Cells[4].Value +
141                         "','" + r.Cells[5].Value + "','" + custormerid + "')";
142                 config.Execute_Query(sql);
143
144                 // '-----------------------------------------------update item
145                 sql = "UPDATE `tblitems` SET `QTY`=`QTY` + '" + r.Cells[4].Value + "' WHERE ITEMID='" + r.Cells[0].Value + "'";
146                 config.Execute_Query(sql);
147
148                 sql = "UPDATE `tblstock_in_out` SET `QTY`=`QTY`-'" + r.Cells[4].Value + "', `TOTALPRICE`=`TOTALPRICE`-'" + r.Cells[5].Value + "' WHERE `STOCKOUTID` ='" + r.Cells[6].Value + "'";
149                 config.Execute_Query(sql);
150             }
151
152
153             sql = "INSERT INTO `tbltransaction` (`TRANSACTIONNUMBER`, `TRANSACTIONDATE`, `TYPE`, `SUPLIERCUSTOMERID`)" +
154                   " VALUES ('" + txttransactionid.Text + "','" + DateTime.Now.ToString("yyyy-MM-dd") + "','Returned','" + custormerid + "')";
155             config.Execute_Query(sql);
156
157             // '-----------------------------------------------update autonumber
158             config.Execute_Query("UPDATE tblautonumber SET END= END + INCREMENT WHERE ID = 6");
159
160             // '------------------------------------------------------------
161             MessageBox.Show("Item(s) has been returned in the database.");
162             // '------------------------------------------------------------clearing
163             funct.clearTxt(GroupBox3);
164             dtCus_addedlist.Rows.Clear();
165
166             frmReturn_Load(sender, e);
167         }
File name: frmStockOut.cs Copy
130         private void btnCus_save_Click(object sender, EventArgs e)
131         {
132             string stockoutID;
133
134             config.singleResult("SELECT concat(STRT,END) FROM tblautonumber WHERE ID = 5");
135             stockoutID = config.dt.Rows[0].Field(0);
136
137             if (txt_cusid.Text == "")
138             {
139                 MessageBox.Show("There are empty fields left that must be fill up!", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
140                 return;
141             }
142             if(dtCus_addedlist.RowCount == 0)
143             {
144                 MessageBox.Show("Cart is empty!", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
145                 return;
146             }
147
148             sql = "SELECT ITEMID,`QTY` FROM `tblitems`";
149             config.singleResult(sql);
150
151             foreach(DataRow row in config.dt.Rows)
152             {
153                 for(int i = 0;i < dtCus_addedlist.Rows.Count; i++)
154                 {
155                     if (dtCus_addedlist.Rows[i].Cells[0].Value.ToString() == row.Field(0))
156                     {
157                         if(int.Parse( dtCus_addedlist.Rows[i].Cells[4].Value.ToString()) > row.Field(1))
158                         {
159                             MessageBox.Show("The Quantity of the item ( " + dtCus_addedlist.Rows[i].Cells[1].Value.ToString() + " ) is greater than the available quantity of it.", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
160                             return;
161                         }
162                     }
163                     if (dtCus_addedlist.Rows[i].Cells[4].Value.ToString() == "")
164                     {
165                         MessageBox.Show("Set your purpose.", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
166                         return;
167                     }
168                 }
169             }
170
171             foreach(DataGridViewRow r in dtCus_addedlist.Rows)
172             {
173                 sql = "INSERT INTO `tblstock_in_out` ( `TRANSACTIONNUMBER`, `ITEMID`, `TRANSACTIONDATE`, `QTY`, `TOTALPRICE`, `SUPLIERCUSTOMERID`,REMARKS)" +
174                 " VALUES ('" + stockoutID + "','" + r.Cells[0].Value + "','" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + r.Cells[4].Value +
175                 "','" + r.Cells[5].Value + "','" + txt_cusid.Text + "','StockOut')";
176                 config.Execute_Query(sql);
177
178                 sql = "UPDATE `tblitems` SET `QTY`= QTY - '" + r.Cells[4].Value + "' WHERE ITEMID='" + r.Cells[0].Value + "'";
179                 config.Execute_Query(sql);
180             }
181
182
183             sql = "INSERT INTO `tbltransaction` (`TRANSACTIONNUMBER`, `TRANSACTIONDATE`, `TYPE`, `SUPLIERCUSTOMERID`)" +
184                    " VALUES ('" + stockoutID + "','" + DateTime.Now.ToString("yyyy-MM-dd") + "','StockOut','" + txt_cusid.Text + "')";
185             config.Execute_Query(sql);
186
187             // '-----------------------------------------------update autonumber
188             config.Execute_Query("UPDATE tblautonumber SET END= END + INCREMENT WHERE ID = 5");
189
190             // '------------------------------------------------------------
191             MessageBox.Show("Item(s) has been save in the database.");
192             // '------------------------------------------------------------clearing
193             funct.clearTxt(Panel1);
194             dtCus_addedlist.Rows.Clear();
195
196             frmStockOut_Load(sender, e);
197         }

Download file with original file name:PURPOSE

PURPOSE 126 lượt xem

Gõ tìm kiếm nhanh...