コード例 #1
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Process, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
            {
                try
                {
                    T_CreditNoteHead alloc = new T_CreditNoteHead();
                    alloc.Dono = txt_DocNo.Text.Trim();
                    alloc      = new T_CreditNoteHeadDL().Selectt_CreditNoteHead(alloc);
                    decimal cumilative = decimal.Zero;

                    foreach (DataGridViewRow drowx in dgsave.Rows)
                    {
                        T_CNParts part = new T_CNParts();
                        part.CNno      = drowx.Cells[0].Value.ToString().Trim();
                        part.ItemCode  = drowx.Cells[2].Value.ToString().Trim();
                        part.PartCode  = drowx.Cells[4].Value.ToString().Trim();
                        part.TagNumber = drowx.Cells[1].Value.ToString().Trim();

                        part           = new T_CNPartDL().Selectt_CNPart(part);
                        part.Processed = true;
                        new T_CNPartDL().Savet_CNPartSP(part, 3);
                    }
                }
                catch (Exception ex) { }
            }
        }
コード例 #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Del, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
            {
                if (drowSaved != null)
                {
                    if (drowSaved.Cells[0] != null)
                    {
                        T_CNParts ss = new T_CNParts();
                        ss.CNno      = drowSaved.Cells[0].Value.ToString();
                        ss.ItemCode  = drowSaved.Cells[2].Value.ToString();
                        ss.PartCode  = drowSaved.Cells[4].Value.ToString();
                        ss.TagNumber = drowSaved.Cells[1].Value.ToString();
                        ss           = new T_CNPartDL().Selectt_CNPart(ss);

                        if (!ss.Processed.Value)
                        {
                            //MessageBox.Show(drowSaved.Cells[2].Value.ToString());
                            T_CNPartDL.Delete_CNPart(drowSaved.Cells[0].Value.ToString(), drowSaved.Cells[2].Value.ToString(), drowSaved.Cells[4].Value.ToString(), drowSaved.Cells[1].Value.ToString());
                            LoadPartSaved(txt_DocNo.Text.Trim());
                        }
                        else
                        {
                            commonFunctions.SetMDIStatusMessage("Item already processed. cannot delete now", 1);
                        }
                    }
                }
            }
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Add, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
            {
                try
                {
                    T_CreditNoteHead alloc = new T_CreditNoteHead();
                    alloc.Dono = txt_DocNo.Text.Trim();
                    alloc      = new T_CreditNoteHeadDL().Selectt_CreditNoteHead(alloc);
                    decimal cumilative = decimal.Zero;

                    foreach (DataGridViewRow drowx in dataGridView1.Rows)
                    {
                        if (commonFunctions.ToDecimal(drowx.Cells[2].Value.ToString().Trim()) != decimal.Zero)
                        {
                            if (!T_CNPartDL.ExistingT_CNPart(txt_DocNo.Text.Trim(), drow.Cells[1].Value.ToString().Trim(), drow.Cells[2].Value.ToString().Trim(), drowx.Cells[0].Value.ToString().Trim()))
                            {
                                T_CNParts part = new T_CNParts();
                                part.CNno          = txt_DocNo.Text.Trim();
                                part.ItemCode      = drow.Cells[2].Value.ToString().Trim();
                                part.PartCode      = drowx.Cells[0].Value.ToString().Trim();
                                part.Processed     = false;
                                part.ProcessedDate = DateTime.Now;
                                part.ProcessedUser = commonFunctions.Loginuser;
                                part.QTY           = commonFunctions.ToDecimal(drowx.Cells[2].Value.ToString().Trim());
                                part.Saved         = false;
                                part.TagNumber     = drow.Cells[1].Value.ToString().Trim();
                                new T_CNPartDL().Savet_CNPartSP(part, 1);
                            }
                        }
                    }

                    LoadPartSaved(txt_DocNo.Text.Trim());
                }
                catch (System.Data.SqlClient.SqlException ex) {
                    commonFunctions.SetMDIStatusMessage("Data Already exists for selected record", 1);
                }
                catch (Exception ex)
                {
                    commonFunctions.SetMDIStatusMessage("Error when adding", 1);
                }
            }
        }