コード例 #1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (grd.Rows.Count == 0)
            {
                MessageBox.Show("please Add order!!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                MaterialUpdate mtup  = new MaterialUpdate(empID);
                int[]          mtArr = mtup.retrieveMaterial();

                if (mtArr[3] >= dozenQty && mtArr[4] > singleQty)
                {
                    //conn = new MySqlConnection("server = localhost; user id = root; database = dbcore; pwd = 1234; allowuservariables = True");
                    int  rows = grd.Rows.Count;
                    bool succ = true;;

                    for (int x = 0; x < rows; x++)
                    {
                        if (grd.Rows[x].Cells[0].Value.ToString().Trim() == "Single")
                        {
                            matType = "folded single";
                        }
                        else if (grd.Rows[x].Cells[0].Value.ToString().Trim() == "12 sheets")
                        {
                            matType = "folded 12";
                        }

                        mtup.updateMaterial(matType, int.Parse(grd.Rows[x].Cells[1].Value.ToString()), empID, true);

                        conn.Open();
                        string StrQuery;
                        StrQuery = "insert into dtsales values('" + tbxCustName.Text.Trim() + "', '" + tbxNic.Text.Trim() + "', '" + tbxTel.Text.Trim() + "', '" + grd.Rows[x].Cells[0].Value.ToString() + "', '" + grd.Rows[x].Cells[1].Value.ToString() + "', '" + grd.Rows[x].Cells[2].Value.ToString() + "', '" + grd.Rows[x].Cells[3].Value.ToString() + "')";
                        cmd      = new MySqlCommand(StrQuery, conn);
                        if (cmd.ExecuteNonQuery() < 0)
                        {
                            succ = false;
                        }

                        conn.Close();
                    }
                    tbxCustName.Clear();
                    tbxNic.Clear();
                    tbxTel.Clear();
                    cmbType.Text = null;
                    singleQty    = 0;
                    dozenQty     = 0;
                    grd.Rows.Clear();
                    if (succ)
                    {
                        MessageBox.Show("Success!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("Sorry. Not Enough Items in the Stock", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
コード例 #2
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            MaterialUpdate mtup = new MaterialUpdate("a001");

            int[] mtarr = mtup.retrieveMaterial();

            lblSheets.Text       = "Sheets : " + mtarr[0].ToString();
            lblCutstrip.Text     = "Cut Strips : " + mtarr[1].ToString();
            lblClipcut.Text      = "Clip cuts : " + mtarr[2].ToString();
            lblFolded12.Text     = "Folded 12 : " + mtarr[3].ToString();
            lblFoldedsingle.Text = "Folded single : " + mtarr[4].ToString();
        }
コード例 #3
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (validateValue(spnQty.Value))
     {
         MaterialUpdate mtup = new MaterialUpdate(empID);
         mtup.updateMaterial("sheet", (int)spnQty.Value, empID, false);
         MessageBox.Show("Success!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         MessageBox.Show("Please input valid Number for number of sheets", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
コード例 #4
0
        private void btnCreateSalesOrder_Click(object sender, EventArgs e)
        {
            MaterialUpdate mtup = new MaterialUpdate(empID);

            int[] matArr = mtup.retrieveMaterial();

            if (matArr[3] > 0 || matArr[4] > 0)
            {
                frmNewSalesRecord obj = frmNewSalesRecord.getInstance(empID);
                obj.Show();
                obj.BringToFront();
            }
            else
            {
                MessageBox.Show("There is no any material in store.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }