예제 #1
0
        ////private void Form1_Load(object sender, EventArgs e)
        ////{
        ////    try
        ////    {
        ////        Listjvaccmapping();
        ////    }
        ////    catch (Exception)
        ////    {

        ////    }

        ////}
        private void Listjvaccmapping()
        {
            try
            {
                grdList.Rows.Clear();
                AutoJVAccMappingDB  dbrecord      = new AutoJVAccMappingDB();
                List <jvaccmapping> jvaccmappings = dbrecord.getjvaccmappingList();
                foreach (jvaccmapping doc in jvaccmappings)
                {
                    grdList.Rows.Add();
                    grdList.Rows[grdList.RowCount - 1].Cells["RowID"].Value             = doc.RowID;
                    grdList.Rows[grdList.RowCount - 1].Cells["JVName"].Value            = doc.JVName;
                    grdList.Rows[grdList.RowCount - 1].Cells["DocumentID"].Value        = doc.DocumentID;
                    grdList.Rows[grdList.RowCount - 1].Cells["DocumentName"].Value      = doc.DocumentName;
                    grdList.Rows[grdList.RowCount - 1].Cells["AccountCodeDebit"].Value  = doc.AccountCodeDebit;
                    grdList.Rows[grdList.RowCount - 1].Cells["AccountNameDebit"].Value  = doc.AccountNameDebit;
                    grdList.Rows[grdList.RowCount - 1].Cells["AccountCodeCredit"].Value = doc.AccountCodeCredit;
                    grdList.Rows[grdList.RowCount - 1].Cells["AccountNameCredit"].Value = doc.AccountNameCredit;
                    grdList.Rows[grdList.RowCount - 1].Cells["Status"].Value            = doc.Status;
                    if (doc.Status == 0)
                    {
                        grdList.Rows[grdList.RowCount - 1].Cells["StatusString"].Value = "Deactive";
                    }
                    else
                    {
                        grdList.Rows[grdList.RowCount - 1].Cells["StatusString"].Value = "Active";
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            enableBottomButtons();
            pnlDocumentList.Visible = true;
        }
예제 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                jvaccmapping       doc   = new jvaccmapping();
                AutoJVAccMappingDB docDB = new AutoJVAccMappingDB();
                try
                {
                    doc.JVName            = txtJVName.Text.Trim();
                    doc.DocumentID        = txtDocumentID.Text;
                    doc.DocumentName      = txtDocName.Text;
                    doc.AccountCodeDebit  = txtAccountCodeDebit.Text;
                    doc.AccountCodeCredit = txtAccountCodeCredit.Text;
                    doc.AccountNameDebit  = txtAccountNameDebit.Text;
                    doc.AccountNameCredit = txtAccountNameCredit.Text;
                }
                catch (Exception)
                {
                    doc.JVName            = "";
                    doc.DocumentID        = "";
                    doc.DocumentName      = "";
                    doc.AccountCodeDebit  = "";
                    doc.AccountCodeCredit = "";
                    doc.AccountNameDebit  = "";
                    doc.AccountNameCredit = "";
                }

                doc.Status = Convert.ToInt32(((Structures.ComboBoxItem)cmbStatus.SelectedItem).HiddenValue);
                System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button;
                string btnText = btn.Text;
                {
                    if (btnText.Equals("Update"))
                    {
                        if (docDB.updatejvaccmapping(doc, prevdoc))
                        {
                            MessageBox.Show("JV Account mapping updated");
                            closeAllPanels();
                            Listjvaccmapping();
                        }
                        else
                        {
                            MessageBox.Show("Failed to update JV Account mapping ");
                        }
                    }
                    else if (btnText.Equals("Save"))
                    {
                        if (docDB.validateDocument(doc))
                        {
                            if (docDB.insertAutoJVAccountCodes(doc))
                            {
                                MessageBox.Show("JV Account mapping Added");
                                closeAllPanels();
                                Listjvaccmapping();
                            }
                            else
                            {
                                MessageBox.Show("Failed to Insert JV Account mapping ");
                            }
                        }
                        else
                        {
                            MessageBox.Show("JV Account mapping  Data Validation failed");
                        }
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Failed Adding / Editing User Data");
            }
        }