Panel1
How do I use Panel1
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
193 | funct.clearTxt(Panel1); | 1 |
46 | funct.clearTxt(Panel1); | 2 |
50 | private void groupPanel1_Click(object sender, EventArgs e) | 3 |
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
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
156 {
157 if(int.Parse( dtCus_addedlist.Rows[i].Cells[4].Value.ToString()) > row.Field
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 }
File name: frmUsers.cs
Copy
24 private void btn_New_Click(object sender, EventArgs e)
25 {
26 lbl_id.Text = "id";
27
28 cbo_type.Text = "Administrator";
29
30 config.Load_DTG("Select user_id as 'ID' ,name as 'Name',user_name as 'Username',type as 'Type' From user", dtg_listUser);
31 dtg_listUser.Columns[0].Visible = false;
32
33 if(lbl_id.Text == "id")
34 {
35 btn_update.Enabled = false;
36 btn_delete.Enabled = false;
37 btn_saveuser.Enabled = true;
38 }
39 else
40 {
41 btn_saveuser.Enabled = false;
42 btn_update.Enabled = true;
43 btn_delete.Enabled = true;
44 }
45
46 funct.clearTxt(Panel1);
47 }
File name: frmThongTin.cs
Copy
50 private void groupPanel1_Click(object sender, EventArgs e)
51 {
52
53 }
Panel1 109 lượt xem
Gõ tìm kiếm nhanh...