public void BtnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbCompany.SelectedIndex <= 0)
                {
                    cmnService.J_UserMessage("Please select Comapany");
                    cmbCompany.Select();
                    return;
                }

                cmbCompany.Enabled = false;

                chkCancelled.Visible = false;

                //---------------------------------------------
                lblMode.Text = J_Mode.Add;
                cmnService.J_StatusButton(this, lblMode.Text); //Status[i.e. Enable/Visible] of Button, Frame, Grid
                lblSearchMode.Text = J_Mode.General;

                ControlVisible(true);
                ClearControls();                                        //Clear all the Controls


                mskInvoiceDate.Text = dmlService.J_ReturnServerDate();

                //---------------------------------------------
                strCheckFields = "";

                mskInvoiceDate.Select();
                //---------------------------------------------
            }
            catch (Exception err_handler)
            {
                cmnService.J_UserMessage(err_handler.Message);
            }
        }
예제 #2
0
        private void tmrWait_Tick(object sender, EventArgs e)
        {
            if (stbMessage.Items[(int)J_PanelIndex.e00_DisplayText].Text != "")
            {
                tmrWait.Interval = 10000;
                cmnService.J_PanelMessage(J_PanelIndex.e00_DisplayText, "");
            }
            cmnService.J_PanelMessage(J_PanelIndex.e07_DateTime, dmlService.J_ReturnServerDate() + " " + dmlService.J_ReturnServerTime());

            if (dmlService.J_IsDatabaseObjectExist("MST_SETUP") == true)
            {
                cmnService.J_PanelMessage(J_PanelIndex.e00_DisplayText, " Connected", Color.Honeydew);
            }
            else
            {
                cmnService.J_PanelMessage(J_PanelIndex.e00_DisplayText, " Disconnected ......", Color.Red);
            }
        }
예제 #3
0
        private void Insert_Update_Delete_Data()
        {
            try
            {
                switch (lblMode.Text)
                {
                case J_Mode.Add:

                    // all validation
                    if (ValidateFields() == false)
                    {
                        return;
                    }

                    // Save Confirmation Message
                    if (cmnService.J_SaveConfirmationMessage(ref txtPartyName) == true)
                    {
                        return;
                    }

                    // set the transaction as begin
                    dmlService.J_BeginTransaction();

                    // insert query & execution
                    strSQL = "INSERT INTO MST_PARTY (" +
                             "            BRANCH_ID," +
                             "            PARTY_CATEGORY_ID," +
                             "            PARTY_NAME," +
                             "            ADDRESS1," +
                             "            ADDRESS2," +
                             "            ADDRESS3," +
                             "            CITY," +
                             "            PIN," +
                             "            CONTACT_PERSON," +
                             "            MOBILE_NO," +
                             "            PHONE_NO," +
                             "            FAX," +
                             "            EMAIL_ID," +
                             "            VAT_NO," +
                             "            USER_ID," +
                             "            CREATE_DATE) " +
                             "    VALUES( " + J_Var.J_pBranchId + "," +
                             "            " + Support.GetItemData(cmbPartyCategory, cmbPartyCategory.SelectedIndex) + "," +
                             "           '" + cmnService.J_ReplaceQuote(txtPartyName.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtAddress1.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtAddress2.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtAddress3.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtCity.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtPin.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtContactPersonName.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtMobileNo.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtPhone.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtFaxNo.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtEmailID.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtVatNo.Text.Trim()) + "'," +
                             "            " + J_Var.J_pUserId + "," +
                             "            " + cmnService.J_DateOperator() + dtService.J_ConvertMMddyyyy(dmlService.J_ReturnServerDate()) + cmnService.J_DateOperator() + ")";
                    if (dmlService.J_ExecSql(strSQL) == false)
                    {
                        txtPartyName.Select();
                        return;
                    }

                    // get last inserted area id as per branch & user
                    lngSearchId = dmlService.J_ReturnMaxValue("MST_PARTY", "PARTY_ID",
                                                              "    BRANCH_ID         = " + J_Var.J_pBranchId + " " +
                                                              "AND USER_ID           = " + J_Var.J_pUserId + "");
                    if (lngSearchId == 0)
                    {
                        return;
                    }

                    // Transaction is commited
                    dmlService.J_Commit();

                    // after insert data, the message is displayed
                    cmnService.J_PanelMessage(J_PanelIndex.e00_DisplayText, J_Msg.AddModeSave);

                    // all controls are cleared
                    ClearControls();
                    txtPartyName.Select();

                    break;

                case J_Mode.Edit:

                    // all validation
                    if (ValidateFields() == false)
                    {
                        return;
                    }

                    // Save Confirmation Message
                    if (cmnService.J_SaveConfirmationMessage(ref txtPartyName) == true)
                    {
                        return;
                    }

                    // set the transaction as begin
                    dmlService.J_BeginTransaction();

                    // update query & execution
                    strSQL = "UPDATE MST_PARTY " +
                             "SET    PARTY_CATEGORY_ID =  " + Support.GetItemData(cmbPartyCategory, cmbPartyCategory.SelectedIndex) + ", " +
                             "       PARTY_NAME        = '" + cmnService.J_ReplaceQuote(txtPartyName.Text.Trim()) + "'," +
                             "       ADDRESS1          = '" + cmnService.J_ReplaceQuote(txtAddress1.Text.Trim()) + "'," +
                             "       ADDRESS2          = '" + cmnService.J_ReplaceQuote(txtAddress2.Text.Trim()) + "'," +
                             "       ADDRESS3          = '" + cmnService.J_ReplaceQuote(txtAddress3.Text.Trim()) + "'," +
                             "       CITY              = '" + cmnService.J_ReplaceQuote(txtCity.Text.Trim()) + "'," +
                             "       PIN               = '" + cmnService.J_ReplaceQuote(txtPin.Text.Trim()) + "'," +
                             "       CONTACT_PERSON    = '" + cmnService.J_ReplaceQuote(txtContactPersonName.Text.Trim()) + "'," +
                             "       MOBILE_NO         = '" + cmnService.J_ReplaceQuote(txtMobileNo.Text.Trim()) + "'," +
                             "       PHONE_NO          = '" + cmnService.J_ReplaceQuote(txtPhone.Text.Trim()) + "'," +
                             "       FAX               = '" + cmnService.J_ReplaceQuote(txtFaxNo.Text.Trim()) + "'," +
                             "       EMAIL_ID          = '" + cmnService.J_ReplaceQuote(txtEmailID.Text.Trim()) + "'," +
                             "       VAT_NO            = '" + cmnService.J_ReplaceQuote(txtVatNo.Text.Trim()) + "'" +
                             "WHERE  PARTY_ID          =  " + lngSearchId + "";
                    if (dmlService.J_ExecSql(strSQL) == false)
                    {
                        txtPartyName.Select();
                        return;
                    }

                    // Transaction is commited
                    dmlService.J_Commit();

                    // after insert data, the message is displayed
                    cmnService.J_PanelMessage(J_PanelIndex.e00_DisplayText, J_Msg.EditModeSave);

                    // all controls are cleared
                    ClearControls();

                    // Refresh the view grid
                    strSQL = strQuery + "ORDER BY " + strOrderBy;
                    if (dsetGridClone != null)
                    {
                        dsetGridClone.Clear();
                    }
                    dsetGridClone = dmlService.J_ShowDataInGrid(ref ViewGrid, strSQL, strMatrix);           //Show Data into the Grid
                    if (dsetGridClone == null)
                    {
                        return;
                    }

                    // change the buttons status
                    lblMode.Text = J_Mode.View;
                    cmnService.J_StatusButton(this, lblMode.Text);

                    BtnDelete.BackColor = Color.LightGray;
                    BtnDelete.Enabled   = false;

                    ControlVisible(false);

                    dmlService.J_setGridPosition(ref this.ViewGrid, dsetGridClone, "PARTY_ID", lngSearchId);
                    break;

                case J_Mode.Delete:
                    break;
                }
            }
            catch (Exception err_handler)
            {
                dmlService.J_Rollback();
                cmnService.J_UserMessage(err_handler.Message);
            }
        }
예제 #4
0
        private void Insert_Update_Delete_Data()
        {
            try
            {
                string strLastDate = string.Empty;
                //-----------------------------------------------------------
                if (mskLastDate.Text == "  /  /")
                {
                    strLastDate = "null";
                }
                else
                {
                    strLastDate = cmnService.J_DateOperator() + dtService.J_ConvertMMddyyyy(mskLastDate.Text) + cmnService.J_DateOperator();
                }

                switch (lblMode.Text)
                {
                case J_Mode.Add:

                    // all validation
                    if (ValidateFields() == false)
                    {
                        return;
                    }

                    // Save Confirmation Message
                    if (cmnService.J_SaveConfirmationMessage(ref txtPrefix) == true)
                    {
                        return;
                    }

                    // set the transaction as begin
                    dmlService.J_BeginTransaction();


                    // Area Code Logic
                    //mf.MF_GetAreaCode(dmlService.J_pCommand, J_Var.J_pBranchCode)

                    // insert query & execution
                    strSQL = "INSERT INTO MST_INVOICE_SERIES (" +
                             "            BRANCH_ID," +
                             "            COMPANY_ID," +
                             "            PREFIX," +
                             "            START_NO," +
                             "            LAST_NO," +
                             "            LAST_DATE," +
                             "            HEADER_DISPLAY_TEXT," +
                             "            USER_ID," +
                             "            CREATE_DATE) " +
                             "    VALUES( " + J_Var.J_pBranchId + "," +
                             "            " + Convert.ToInt32(Support.GetItemData(cmbCompanyName, cmbCompanyName.SelectedIndex)) + "," +
                             "           '" + cmnService.J_ReplaceQuote(txtPrefix.Text.Trim()) + "'," +
                             "            " + Convert.ToInt32(cmnService.J_NumericData(txtStartNo)) + "," +
                             "            " + Convert.ToInt32(cmnService.J_NumericData(txtStartNo)) + "," +
                             "            " + strLastDate + "," +
                             "           '" + cmnService.J_ReplaceQuote(txtDisplayText.Text.Trim()) + "'," +
                             "            " + J_Var.J_pUserId + "," +
                             "            " + cmnService.J_DateOperator() + dtService.J_ConvertMMddyyyy(dmlService.J_ReturnServerDate()) + cmnService.J_DateOperator() + ")";
                    if (dmlService.J_ExecSql(strSQL) == false)
                    {
                        cmbCompanyName.Select();
                        return;
                    }

                    // get last inserted area id as per branch & user
                    lngSearchId = dmlService.J_ReturnMaxValue("MST_INVOICE_SERIES", "INVOICE_SERIES_ID",
                                                              "    BRANCH_ID         = " + J_Var.J_pBranchId + " " +
                                                              "AND USER_ID           = " + J_Var.J_pUserId + "");
                    if (lngSearchId == 0)
                    {
                        return;
                    }

                    // Transaction is commited
                    dmlService.J_Commit();

                    // after insert data, the message is displayed
                    cmnService.J_PanelMessage(J_PanelIndex.e00_DisplayText, J_Msg.AddModeSave);

                    // all controls are cleared
                    ClearControls();
                    cmbCompanyName.Select();

                    break;

                case J_Mode.Edit:

                    // all validation
                    if (ValidateFields() == false)
                    {
                        return;
                    }

                    // Save Confirmation Message
                    if (cmnService.J_SaveConfirmationMessage(ref txtPrefix) == true)
                    {
                        return;
                    }

                    // set the transaction as begin
                    dmlService.J_BeginTransaction();

                    // update query & execution
                    strSQL = "UPDATE MST_INVOICE_SERIES " +
                             "SET    COMPANY_ID          =  " + Convert.ToInt32(Support.GetItemData(cmbCompanyName, cmbCompanyName.SelectedIndex)) + "," +
                             "       PREFIX              = '" + cmnService.J_ReplaceQuote(txtPrefix.Text.Trim()) + "'," +
                             "       START_NO            =  " + Convert.ToInt32(cmnService.J_NumericData(txtStartNo)) + "," +
                             "       LAST_NO             =  " + Convert.ToInt32(cmnService.J_NumericData(txtStartNo)) + "," +
                             "       LAST_DATE           = " + strLastDate + "," +
                             "       HEADER_DISPLAY_TEXT = '" + cmnService.J_ReplaceQuote(txtDisplayText.Text.Trim()) + "' " +
                             "WHERE  INVOICE_SERIES_ID   =  " + lngSearchId + "";
                    if (dmlService.J_ExecSql(strSQL) == false)
                    {
                        cmbCompanyName.Select();
                        return;
                    }

                    // Transaction is commited
                    dmlService.J_Commit();

                    // after insert data, the message is displayed
                    cmnService.J_PanelMessage(J_PanelIndex.e00_DisplayText, J_Msg.EditModeSave);

                    // all controls are cleared
                    ClearControls();

                    // Refresh the view grid
                    strSQL = strQuery + "ORDER BY " + strOrderBy;
                    if (dsetGridClone != null)
                    {
                        dsetGridClone.Clear();
                    }
                    dsetGridClone = dmlService.J_ShowDataInGrid(ref ViewGrid, strSQL, strMatrix);           //Show Data into the Grid
                    if (dsetGridClone == null)
                    {
                        return;
                    }

                    // change the buttons status
                    lblMode.Text = J_Mode.View;
                    cmnService.J_StatusButton(this, lblMode.Text);

                    BtnDelete.BackColor = Color.LightGray;
                    BtnDelete.Enabled   = false;

                    ControlVisible(false);

                    dmlService.J_setGridPosition(ref this.ViewGrid, dsetGridClone, "INVOICE_SERIES_ID", lngSearchId);
                    break;

                case J_Mode.Delete:
                    break;
                }
            }
            catch (Exception err_handler)
            {
                dmlService.J_Rollback();
                cmnService.J_UserMessage(err_handler.Message);
            }
        }
예제 #5
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            // Added by Ripan Paul on 23-07-2011
            if (dmlService.J_IsRecordExist("MST_PARTY",
                                           "    BRANCH_ID  =  " + J_Var.J_pBranchId + " " +
                                           "AND PARTY_NAME = '" + cmnService.J_ReplaceQuote(txtPartyName.Text.Trim().ToUpper()) + "'") == true)
            {
                cmnService.J_UserMessage("Duplicate Party found ...");
                txtPartyName.Select();
                return;
            }

            // Save Confirmation Message
            if (cmnService.J_SaveConfirmationMessage(ref txtAddress1) == true)
            {
                return;
            }

            // Transaction is started
            dmlService.J_BeginTransaction();

            // insert query & execution
            strSQL = "INSERT INTO MST_PARTY (" +
                     "            BRANCH_ID," +
                     "            PARTY_CATEGORY_ID," +
                     "            PARTY_NAME," +
                     "            ADDRESS1," +
                     "            ADDRESS2," +
                     "            ADDRESS3," +
                     "            CITY," +
                     "            PIN," +
                     "            CONTACT_PERSON," +
                     "            MOBILE_NO," +
                     "            PHONE_NO," +
                     "            FAX," +
                     "            EMAIL_ID," +
                     "            USER_ID," +
                     "            CREATE_DATE) " +
                     "    VALUES( " + J_Var.J_pBranchId + "," +
                     "            " + Support.GetItemData(cmbPartyCategory, cmbPartyCategory.SelectedIndex) + ", " +
                     "           '" + cmnService.J_ReplaceQuote(txtPartyName.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtAddress1.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtAddress2.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtAddress3.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtCity.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtPin.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtContactPersonName.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtMobileNo.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtPhone.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtFaxNo.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtEmailID.Text.Trim()) + "'," +
                     "            " + J_Var.J_pUserId + "," +
                     "            " + cmnService.J_DateOperator() + dtService.J_ConvertMMddyyyy(dmlService.J_ReturnServerDate()) + cmnService.J_DateOperator() + ")";
            if (dmlService.J_ExecSql(strSQL) == false)
            {
                txtPartyName.Select();
                return;
            }

            // Transaction is commited
            dmlService.J_Commit();

            // Added by Ripan Paul on 23-07-2011
            BS.BS_PartyName = txtPartyName.Text.Trim();

            // after data is inserted, the message is displayed
            cmnService.J_PanelMessage(J_PanelIndex.e00_DisplayText, J_Msg.AddModeSave);

            // exit from this form
            BtnExit_Click(sender, e);
        }
예제 #6
0
        private void Insert_Update_Delete_Data()
        {
            try
            {
                switch (lblMode.Text)
                {
                case J_Mode.Add:

                    // all validation
                    if (ValidateFields() == false)
                    {
                        return;
                    }

                    // Save Confirmation Message
                    if (cmnService.J_SaveConfirmationMessage(ref txtTaxDesc) == true)
                    {
                        return;
                    }

                    // set the transaction as begin
                    dmlService.J_BeginTransaction();

                    // Area Code Logic
                    //mf.MF_GetAreaCode(dmlService.J_pCommand, J_Var.J_pBranchCode)

                    // insert query & execution
                    strSQL = "INSERT INTO MST_TAX (" +
                             "            BRANCH_ID," +
                             "            TAX_DESC," +
                             "            TAX_RATE," +
                             "            USER_ID," +
                             "            CREATE_DATE) " +
                             "    VALUES( " + J_Var.J_pBranchId + "," +
                             "           '" + cmnService.J_ReplaceQuote(txtTaxDesc.Text.Trim().ToUpper()) + "'," +
                             "            " + Convert.ToDouble(cmnService.J_ReplaceQuote(txtTaxPercentage.Text.Trim())) + "," +
                             "            " + J_Var.J_pUserId + "," +
                             "            " + cmnService.J_DateOperator() + dtService.J_ConvertMMddyyyy(dmlService.J_ReturnServerDate()) + cmnService.J_DateOperator() + ")";
                    if (dmlService.J_ExecSql(strSQL) == false)
                    {
                        txtTaxDesc.Select();
                        return;
                    }

                    // get last inserted tax id as per branch & user
                    lngSearchId = dmlService.J_ReturnMaxValue("MST_TAX", "TAX_ID",
                                                              "    BRANCH_ID         = " + J_Var.J_pBranchId + " " +
                                                              "AND USER_ID           = " + J_Var.J_pUserId + "");
                    if (lngSearchId == 0)
                    {
                        return;
                    }

                    // Transaction is commited
                    dmlService.J_Commit();

                    // after insert data, the message is displayed
                    cmnService.J_PanelMessage(J_PanelIndex.e00_DisplayText, J_Msg.AddModeSave);

                    // all controls are cleared
                    ClearControls();
                    txtTaxDesc.Select();

                    break;

                case J_Mode.Edit:

                    // all validation
                    if (ValidateFields() == false)
                    {
                        return;
                    }

                    // Save Confirmation Message
                    if (cmnService.J_SaveConfirmationMessage(ref txtTaxDesc) == true)
                    {
                        return;
                    }

                    // set the transaction as begin
                    dmlService.J_BeginTransaction();

                    // update query & execution
                    strSQL = "UPDATE MST_TAX " +
                             "SET    TAX_DESC     = '" + cmnService.J_ReplaceQuote(txtTaxDesc.Text.Trim().ToUpper()) + "'," +
                             "       TAX_RATE     =  " + Convert.ToDouble(cmnService.J_ReplaceQuote(txtTaxPercentage.Text.Trim())) + " " +
                             "WHERE  TAX_ID       =  " + lngSearchId + "";
                    if (dmlService.J_ExecSql(strSQL) == false)
                    {
                        txtTaxDesc.Select();
                        return;
                    }

                    // Transaction is commited
                    dmlService.J_Commit();

                    // after insert data, the message is displayed
                    cmnService.J_PanelMessage(J_PanelIndex.e00_DisplayText, J_Msg.EditModeSave);

                    // all controls are cleared
                    ClearControls();

                    // Refresh the view grid
                    strSQL = strQuery + "ORDER BY " + strOrderBy;
                    if (dsetGridClone != null)
                    {
                        dsetGridClone.Clear();
                    }
                    dsetGridClone = dmlService.J_ShowDataInGrid(ref ViewGrid, strSQL, strMatrix);           //Show Data into the Grid
                    if (dsetGridClone == null)
                    {
                        return;
                    }

                    // change the buttons status
                    lblMode.Text = J_Mode.View;
                    cmnService.J_StatusButton(this, lblMode.Text);

                    BtnDelete.BackColor = Color.LightGray;
                    BtnDelete.Enabled   = false;

                    ControlVisible(false);

                    dmlService.J_setGridPosition(ref this.ViewGrid, dsetGridClone, "TAX_ID", lngSearchId);
                    break;

                case J_Mode.Delete:
                    break;
                }
            }
            catch (Exception err_handler)
            {
                dmlService.J_Rollback();
                cmnService.J_UserMessage(err_handler.Message);
            }
        }
예제 #7
0
        private void Insert_Update_Delete_Data()
        {
            try
            {
                switch (lblMode.Text)
                {
                case J_Mode.Add:

                    // all validation
                    if (ValidateFields() == false)
                    {
                        return;
                    }

                    // Save Confirmation Message
                    if (cmnService.J_SaveConfirmationMessage(ref txtCompanyName) == true)
                    {
                        return;
                    }

                    // set the transaction as begin
                    dmlService.J_BeginTransaction();

                    // insert query & execution
                    strSQL = "INSERT INTO MST_COMPANY (" +
                             "            BRANCH_ID," +
                             "            COMPANY_NAME," +
                             "            ADDRESS1," +
                             "            ADDRESS2," +
                             "            ADDRESS3," +
                             "            CITY," +
                             "            PIN," +
                             "            CONTACT_NO," +
                             "            FAX," +
                             "            EMAIL_ID," +
                             "            WEB_SITE," +
                             "            CONTACT_PERSON," +
                             "            SIGNATORY," +
                             "            VAT_NO," +
                             "            CST_NO," +
                             "            SERVICE_TAX_NO," +
                             "            PAN," +
                             "            USER_ID," +
                             "            CREATE_DATE, " +
                             "            CIN_NO, " +
                             "            MAX_DAYS_PERMIT, " +
                             "            BANK_DETAIL1, " +     //-- 2016/02/18 ANIK
                             "            BANK_DETAIL2, " +
                             "            BANK_DETAIL3, " +
                             "            BANK_DETAIL4, " +
                             "            BANK_DETAIL5)" +
                             "    VALUES( " + J_Var.J_pBranchId + "," +
                             "           '" + cmnService.J_ReplaceQuote(txtCompanyName.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtAddress1.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtAddress2.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtAddress3.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtCity.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtPin.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtContactNo.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtFax.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtEmailID.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtWebsite.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtContactPersonName.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtSignatory.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtVATNo.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtCSTNo.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtServiceTaxNo.Text.Trim()) + "'," +
                             "           '" + cmnService.J_ReplaceQuote(txtPAN.Text.Trim()) + "'," +
                             "            " + J_Var.J_pUserId + "," +
                             "            " + cmnService.J_DateOperator() + dtService.J_ConvertMMddyyyy(dmlService.J_ReturnServerDate()) + cmnService.J_DateOperator() + ", " +
                             "           '" + cmnService.J_ReplaceQuote(txtCINNo.Text.Trim()) + "'," +
                             "            " + cmnService.J_ReplaceQuote(txtMaxPermitedDays.Text.Trim()) + ", " +
                             "           '" + cmnService.J_ReplaceQuote(txtBankDetails1.Text.Trim()) + "', " +     //-- 2016/02/18 ANIK
                             "           '" + cmnService.J_ReplaceQuote(txtBankDetails2.Text.Trim()) + "', " +
                             "           '" + cmnService.J_ReplaceQuote(txtBankDetails3.Text.Trim()) + "', " +
                             "           '" + cmnService.J_ReplaceQuote(txtBankDetails4.Text.Trim()) + "', " +
                             "           '" + cmnService.J_ReplaceQuote(txtBankDetails5.Text.Trim()) + "')";

                    if (dmlService.J_ExecSql(strSQL) == false)
                    {
                        txtCompanyName.Select();
                        return;
                    }

                    // get last inserted area id as per branch & user
                    lngSearchId = dmlService.J_ReturnMaxValue("MST_COMPANY", "COMPANY_ID",
                                                              "    BRANCH_ID         = " + J_Var.J_pBranchId + " " +
                                                              "AND USER_ID           = " + J_Var.J_pUserId + "");
                    if (lngSearchId == 0)
                    {
                        return;
                    }

                    // Transaction is commited
                    dmlService.J_Commit();

                    // after insert data, the message is displayed
                    cmnService.J_PanelMessage(J_PanelIndex.e00_DisplayText, J_Msg.AddModeSave);

                    // all controls are cleared
                    ClearControls();
                    txtCompanyName.Select();

                    break;

                case J_Mode.Edit:

                    // all validation
                    if (ValidateFields() == false)
                    {
                        return;
                    }

                    // Save Confirmation Message
                    if (cmnService.J_SaveConfirmationMessage(ref txtCompanyName) == true)
                    {
                        return;
                    }

                    // set the transaction as begin
                    dmlService.J_BeginTransaction();

                    // update query & execution
                    strSQL = "UPDATE MST_COMPANY " +
                             "SET    COMPANY_NAME   = '" + cmnService.J_ReplaceQuote(txtCompanyName.Text.Trim()) + "'," +
                             "       ADDRESS1       = '" + cmnService.J_ReplaceQuote(txtAddress1.Text.Trim()) + "'," +
                             "       ADDRESS2       = '" + cmnService.J_ReplaceQuote(txtAddress2.Text.Trim()) + "'," +
                             "       ADDRESS3       = '" + cmnService.J_ReplaceQuote(txtAddress3.Text.Trim()) + "'," +
                             "       CITY           = '" + cmnService.J_ReplaceQuote(txtCity.Text.Trim()) + "'," +
                             "       PIN            = '" + cmnService.J_ReplaceQuote(txtPin.Text.Trim()) + "'," +
                             "       CONTACT_NO     = '" + cmnService.J_ReplaceQuote(txtContactNo.Text.Trim()) + "'," +
                             "       FAX            = '" + cmnService.J_ReplaceQuote(txtFax.Text.Trim()) + "'," +
                             "       EMAIL_ID       = '" + cmnService.J_ReplaceQuote(txtEmailID.Text.Trim()) + "'," +
                             "       WEB_SITE       = '" + cmnService.J_ReplaceQuote(txtWebsite.Text.Trim()) + "'," +
                             "       CONTACT_PERSON = '" + cmnService.J_ReplaceQuote(txtContactPersonName.Text.Trim()) + "'," +
                             "       SIGNATORY      = '" + cmnService.J_ReplaceQuote(txtSignatory.Text.Trim()) + "'," +
                             "       VAT_NO         = '" + cmnService.J_ReplaceQuote(txtVATNo.Text.Trim()) + "'," +
                             "       CST_NO         = '" + cmnService.J_ReplaceQuote(txtCSTNo.Text.Trim()) + "'," +
                             "       SERVICE_TAX_NO = '" + cmnService.J_ReplaceQuote(txtServiceTaxNo.Text.Trim()) + "'," +
                             "       PAN            = '" + cmnService.J_ReplaceQuote(txtPAN.Text.Trim()) + "', " +
                             "       CIN_NO         = '" + cmnService.J_ReplaceQuote(txtCINNo.Text.Trim()) + "', " +
                             "       MAX_DAYS_PERMIT = " + cmnService.J_ReplaceQuote(txtMaxPermitedDays.Text.Trim()) + ", " +
                             "       BANK_DETAIL1    = '" + cmnService.J_ReplaceQuote(txtBankDetails1.Text.Trim()) + "', " +     //-- 2016/02/18 ANIK
                             "       BANK_DETAIL2    = '" + cmnService.J_ReplaceQuote(txtBankDetails2.Text.Trim()) + "', " +
                             "       BANK_DETAIL3    = '" + cmnService.J_ReplaceQuote(txtBankDetails3.Text.Trim()) + "', " +
                             "       BANK_DETAIL4    = '" + cmnService.J_ReplaceQuote(txtBankDetails4.Text.Trim()) + "', " +
                             "       BANK_DETAIL5    = '" + cmnService.J_ReplaceQuote(txtBankDetails5.Text.Trim()) + "' " +
                             "WHERE  COMPANY_ID     =  " + lngSearchId + "";
                    if (dmlService.J_ExecSql(strSQL) == false)
                    {
                        txtCompanyName.Select();
                        return;
                    }

                    // Transaction is commited
                    dmlService.J_Commit();

                    // after insert data, the message is displayed
                    cmnService.J_PanelMessage(J_PanelIndex.e00_DisplayText, J_Msg.EditModeSave);

                    // all controls are cleared
                    ClearControls();

                    // Refresh the view grid
                    strSQL = strQuery + "ORDER BY " + strOrderBy;
                    if (dsetGridClone != null)
                    {
                        dsetGridClone.Clear();
                    }
                    dsetGridClone = dmlService.J_ShowDataInGrid(ref ViewGrid, strSQL, strMatrix);           //Show Data into the Grid
                    if (dsetGridClone == null)
                    {
                        return;
                    }

                    // change the buttons status
                    lblMode.Text = J_Mode.View;
                    cmnService.J_StatusButton(this, lblMode.Text);

                    BtnDelete.BackColor = Color.LightGray;
                    BtnDelete.Enabled   = false;

                    ControlVisible(false);

                    dmlService.J_setGridPosition(ref this.ViewGrid, dsetGridClone, "COMPANY_ID", lngSearchId);
                    break;

                case J_Mode.Delete:
                    break;
                }
            }
            catch (Exception err_handler)
            {
                dmlService.J_Rollback();
                cmnService.J_UserMessage(err_handler.Message);
            }
        }