Esempio n. 1
0
        private void grdList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            try
            {
                string colName = grdList.Columns[e.ColumnIndex].Name;
                if (colName == "Edit")
                {
                    clearDocumentData();
                    btnDocument.Visible = false;
                    txtJVName.ReadOnly  = true;
                    prevdoc             = new jvaccmapping();
                    int rowID = e.RowIndex;
                    btnSave.Text              = "Update";
                    pnlDocumentInner.Visible  = true;
                    pnlDocumentOuter.Visible  = true;
                    pnlDocumentList.Visible   = false;
                    prevdoc.RowID             = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["RowID"].Value.ToString());
                    prevdoc.DocumentID        = grdList.Rows[e.RowIndex].Cells["DocumentID"].Value.ToString();
                    prevdoc.JVName            = grdList.Rows[e.RowIndex].Cells["JVName"].Value.ToString();
                    prevdoc.DocumentName      = grdList.Rows[e.RowIndex].Cells["DocumentName"].Value.ToString();
                    prevdoc.AccountCodeDebit  = grdList.Rows[e.RowIndex].Cells["AccountCodeDebit"].Value.ToString();
                    prevdoc.AccountNameDebit  = grdList.Rows[e.RowIndex].Cells["AccountNameDebit"].Value.ToString();
                    prevdoc.AccountCodeCredit = grdList.Rows[e.RowIndex].Cells["AccountCodeCredit"].Value.ToString();
                    prevdoc.AccountNameCredit = grdList.Rows[e.RowIndex].Cells["AccountNameCredit"].Value.ToString();

                    prevdoc.Status            = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["Status"].Value.ToString());
                    txtJVName.Text            = grdList.Rows[e.RowIndex].Cells["JVName"].Value.ToString();
                    txtDocumentID.Text        = grdList.Rows[e.RowIndex].Cells["DocumentID"].Value.ToString();
                    txtDocName.Text           = grdList.Rows[e.RowIndex].Cells["DocumentName"].Value.ToString();
                    txtAccountCodeDebit.Text  = grdList.Rows[e.RowIndex].Cells["AccountCodeDebit"].Value.ToString();
                    txtAccountNameDebit.Text  = grdList.Rows[e.RowIndex].Cells["AccountNameDebit"].Value.ToString();
                    txtAccountCodeCredit.Text = grdList.Rows[e.RowIndex].Cells["AccountCodeCredit"].Value.ToString();
                    txtAccountNameCredit.Text = grdList.Rows[e.RowIndex].Cells["AccountNameCredit"].Value.ToString();
                    cmbStatus.SelectedIndex   = Structures.ComboFUnctions.getComboIndex(cmbStatus, prevdoc.Status.ToString());
                    disableBottomButtons();
                }
            }
            catch (Exception)
            {
            }
        }
Esempio n. 2
0
 public void clearDocumentData()
 {
     try
     {
         cmbStatus.SelectedIndex   = 0;
         txtJVName.Text            = "";
         txtDocumentID.Text        = "";
         txtAccountNameCredit.Text = "";
         txtAccountNameDebit.Text  = "";
         txtDocName.Text           = "";
         txtAccountCodeDebit.Text  = "";
         txtAccountCodeCredit.Text = "";
         prevdoc = new jvaccmapping();
     }
     catch (Exception)
     {
     }
 }
Esempio n. 3
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");
            }
        }