/// <summary>
        /// Function for Edit
        /// </summary>
        public void EditFunction()
        {
            try
            {
                MonthlySalaryVoucherBll  BllMonthlySalary         = new MonthlySalaryVoucherBll();
                MonthlySalaryInfo        infoMonthlySalary        = new MonthlySalaryInfo();
                MonthlySalaryVoucherBll  BllMonthlySalaryDetails  = new MonthlySalaryVoucherBll();
                MonthlySalaryDetailsInfo infoMonthlySalaryDetails = new MonthlySalaryDetailsInfo();
                EmployeeCreationBll      BllEmployeeCreation      = new EmployeeCreationBll();
                infoMonthlySalary.SalaryMonth = Convert.ToDateTime(dtpSalaryMonth.Text);
                infoMonthlySalary.Narration   = txtNarration.Text.Trim();
                infoMonthlySalary.Extra1      = string.Empty;
                infoMonthlySalary.Extra2      = string.Empty;
                int RowCount = dgvMonthySalarySettings.RowCount;
                for (int i = 0; i <= RowCount - 1; i++)
                {
                    if (dgvMonthySalarySettings.Rows[i].Cells["dgvtxtMonthlySalaryId"].Value.ToString() != string.Empty)
                    {
                        decMasterIdForEdit = Convert.ToDecimal(dgvMonthySalarySettings.Rows[i].Cells["dgvtxtMonthlySalaryId"].Value.ToString());
                    }
                }
                infoMonthlySalary.MonthlySalaryId = decMasterIdForEdit;
                BllMonthlySalary.MonthlySalarySettingsEdit(infoMonthlySalary);
                infoMonthlySalaryDetails.MonthlySalaryId = decMasterIdForEdit;
                for (int i = 0; i <= RowCount - 1; i++)
                {
                    if (dgvMonthySalarySettings.Rows[i].Cells["dgvtxtMonthlySalaryDetailsId"].Value.ToString() != string.Empty)
                    {
                        string st = dgvMonthySalarySettings.Rows[i].Cells["dgvcmbPackage"].FormattedValue.ToString();
                        if (dgvMonthySalarySettings.Rows[i].Cells["dgvcmbPackage"].FormattedValue.ToString() != "--Select--")
                        {
                            if (dgvMonthySalarySettings.Rows[i].Cells["dgvtxtEmployeeId"].Value != null && dgvMonthySalarySettings.Rows[i].Cells["dgvtxtEmployeeId"].Value.ToString() != string.Empty)
                            {
                                infoMonthlySalaryDetails.EmployeeId = Convert.ToDecimal(dgvMonthySalarySettings.Rows[i].Cells["dgvtxtEmployeeId"].Value.ToString());
                            }
                            if (dgvMonthySalarySettings.Rows[i].Cells["dgvtxtMonthlySalaryDetailsId"].Value != null && dgvMonthySalarySettings.Rows[i].Cells["dgvtxtMonthlySalaryDetailsId"].Value.ToString() != string.Empty)
                            {
                                infoMonthlySalaryDetails.MonthlySalaryDetailsId = Convert.ToDecimal(dgvMonthySalarySettings.Rows[i].Cells["dgvtxtMonthlySalaryDetailsId"].Value.ToString());
                            }
                            if (dgvMonthySalarySettings.Rows[i].Cells["dgvtxtMonthlySalaryId"].Value != null && dgvMonthySalarySettings.Rows[i].Cells["dgvtxtMonthlySalaryId"].Value.ToString() != "0")
                            {
                                infoMonthlySalaryDetails.MonthlySalaryId = Convert.ToDecimal(dgvMonthySalarySettings.Rows[i].Cells["dgvtxtMonthlySalaryId"].Value.ToString());
                            }
                            if (dgvMonthySalarySettings.Rows[i].Cells["dgvcmbPackage"].Value != null && dgvMonthySalarySettings.Rows[i].Cells["dgvcmbPackage"].Value.ToString() != "0")
                            {
                                infoMonthlySalaryDetails.SalaryPackageId = Convert.ToDecimal(dgvMonthySalarySettings.Rows[i].Cells["dgvcmbPackage"].Value.ToString());
                                infoMonthlySalaryDetails.Extra1          = string.Empty;
                                infoMonthlySalaryDetails.Extra2          = string.Empty;
                                BllEmployeeCreation.EmployeePackageEdit(infoMonthlySalaryDetails.EmployeeId, infoMonthlySalaryDetails.SalaryPackageId);
                                BllMonthlySalaryDetails.MonthlySalaryDetailsEditUsingMasterIdAndDetailsId(infoMonthlySalaryDetails);
                            }
                        }
                        else
                        {
                            decimal decMonthlySalaryDetailsId = 0;
                            for (int j = 0; j < RowCount; j++)
                            {
                                if (dgvMonthySalarySettings.Rows[j].Cells["dgvtxtMonthlySalaryDetailsId"].Value != null && dgvMonthySalarySettings.Rows[j].Cells["dgvtxtMonthlySalaryDetailsId"].Value.ToString() != string.Empty)
                                {
                                    if (dgvMonthySalarySettings.Rows[j].Cells["dgvcmbPackage"].FormattedValue.ToString() == "--Select--")
                                    {
                                        decMonthlySalaryDetailsId = Convert.ToDecimal(dgvMonthySalarySettings.Rows[j].Cells["dgvtxtMonthlySalaryDetailsId"].Value.ToString());
                                        BllMonthlySalaryDetails.MonthlySalarySettingsDetailsIdDelete(decMonthlySalaryDetailsId);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        if (dgvMonthySalarySettings.Rows[i].Cells["dgvtxtEmployeeId"].Value != null && dgvMonthySalarySettings.Rows[i].Cells["dgvtxtEmployeeId"].Value.ToString() != string.Empty)
                        {
                            infoMonthlySalaryDetails.EmployeeId = Convert.ToDecimal(dgvMonthySalarySettings.Rows[i].Cells["dgvtxtEmployeeId"].Value.ToString());

                            if (dgvMonthySalarySettings.Rows[i].Cells["dgvcmbPackage"].Value != null && dgvMonthySalarySettings.Rows[i].Cells["dgvcmbPackage"].Value.ToString() != "0")
                            {
                                infoMonthlySalaryDetails.SalaryPackageId = Convert.ToDecimal(dgvMonthySalarySettings.Rows[i].Cells["dgvcmbPackage"].Value.ToString());
                                infoMonthlySalaryDetails.Extra1          = string.Empty;
                                infoMonthlySalaryDetails.Extra2          = string.Empty;
                                infoMonthlySalaryDetails.MonthlySalaryId = decMasterIdForEdit;
                                BllMonthlySalaryDetails.MonthlySalaryDetailsAddWithMonthlySalaryId(infoMonthlySalaryDetails);
                            }
                        }
                    }
                }
                Messages.UpdatedMessage();
                GridFill();
                dtpSalaryMonth.Focus();
                btnDelete.Enabled = true;
                DeleteButtonEnableDisableChoose();
            }
            catch (Exception ex)
            {
                MessageBox.Show("MSS8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Function to call Save or Edit function after user confirmation and also checks the invalid entries
        /// </summary>
        public void SaveOrEdit()
        {
            try
            {
                if (txtRouteName.Text.Trim() == String.Empty)
                {
                    Messages.InformationMessage("Enter route name");
                    txtRouteName.Focus();
                }
                else if (cmbArea.Text.Trim() == string.Empty)
                {
                    Messages.InformationMessage(" Select area");
                    cmbArea.Focus();
                }
                else
                {
                    if (btnSave.Text == "Save")
                    {
                        if (PublicVariables.isMessageAdd)
                        {
                            if (Messages.SaveMessage())
                            {
                                SaveFunction();


                                if (frmSupplierobj != null)
                                {
                                    this.Close();
                                }
                            }
                        }
                        else
                        {
                            SaveFunction();

                            if (frmSupplierobj != null)
                            {
                                this.Close();
                            }
                        }
                    }
                    else
                    {
                        if (PublicVariables.isMessageEdit)
                        {
                            if (Messages.UpdateMessage())
                            {
                                EditFunction();
                            }
                        }
                        else
                        {
                            EditFunction();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "RT6" + ex.Message;
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Sending Updated datatable to frmProduct
 /// </summary>
 public void SendTableForUpdate()
 {
     try
     {
         DataTable dtblsend = new DataTable();
         DataColumn dc = new DataColumn("dgvcmbRawMaterial", typeof(decimal));
         dtblsend.Columns.Add(dc);
         dc = new DataColumn("dgvtxtQty", typeof(decimal));
         dtblsend.Columns.Add(dc);
         dc = new DataColumn("dgvtxtUnitId", typeof(decimal));
         dtblsend.Columns.Add(dc);
         dc = new DataColumn("extra1", typeof(string));
         dtblsend.Columns.Add(dc);
         dc = new DataColumn("extra2", typeof(string));
         dtblsend.Columns.Add(dc);
         dc = new DataColumn("extraDate", typeof(DateTime));
         dtblsend.Columns.Add(dc);
         dc = new DataColumn("bomId", typeof(decimal));
         dtblsend.Columns.Add(dc);
         for (int inI = 0; inI < dgvProductBOM.RowCount - 1; inI++)
         {
             DataRow dr = dtblsend.NewRow();
             dr[0] = dgvProductBOM.Rows[inI].Cells["dgvcmbRawMaterial"].Value.ToString();
             dr[1] = dgvProductBOM.Rows[inI].Cells["dgvtxtQty"].Value.ToString();
             dr[2] = dgvProductBOM.Rows[inI].Cells["dgvcmbUnit"].Value;
             dr[3] = string.Empty;
             dr[4] = string.Empty;
             dr[5] = DateTime.Now;
             if (Convert.ToDecimal(dgvProductBOM.Rows[inI].Cells["dgvtxtBomId"].Value) == 0)
             {
                 dr[6] = 0;
             }
             else
             {
                 dr[6] = dgvProductBOM.Rows[inI].Cells["dgvtxtBomId"].Value.ToString();
             }
             int inPosition = inI;
             dtblsend.Rows.InsertAt(dr, inPosition);
         }
         bool isOk = true;
         if (dtblsend.Rows.Count > 0)
         {
             if (isRemoved)
             {
                 frmProductCreationObj.RomovedIndexFromBom(strArRemove);
             }
             frmProductCreationObj.DataTableForBomUpdate(dtblsend, isOk);
             Messages.UpdatedMessage();
             this.Close();
         }
         else
         {
             MessageBox.Show("Cant save atleast one row", "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
             dgvProductBOM.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PB:8" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 4
0
 /// <summary>
 /// checking the invalid entries and call asve function or edit function
 /// </summary>
 public void SaveOrEdit()
 {
     try
     {
         if (txtUnitname.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage(" Enter unit name ");
             txtUnitname.Focus();
         }
         else if (txtFormalName.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage(" Enter formal name");
             txtFormalName.Focus();
         }
         else if (txtDecimalPlaces.Text == string.Empty)
         {
             Messages.InformationMessage(" Enter no of decimal places");
             txtDecimalPlaces.Focus();
         }
         else
         {
             if (btnSave.Text == "Save")
             {
                 if (PublicVariables.isMessageAdd)
                 {
                     if (Messages.SaveMessage())
                     {
                         SaveFunction();
                         decIdforOtherForm = decUnit;
                         if (frmMultipleProductCreationObj != null)
                         {
                             this.Close();
                         }
                         if (frmProductCreationObj != null)
                         {
                             this.Close();
                         }
                     }
                 }
                 else
                 {
                     SaveFunction();
                     decIdforOtherForm = decUnit;
                     if (frmMultipleProductCreationObj != null)
                     {
                         this.Close();
                     }
                     if (frmProductCreationObj != null)
                     {
                         this.Close();
                     }
                 }
             }
             else
             {
                 if (PublicVariables.isMessageEdit)
                 {
                     if (Messages.UpdateMessage())
                     {
                         EditFunction();
                     }
                 }
                 else
                 {
                     EditFunction();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "U5:" + ex.Message;
     }
 }