示例#1
0
 public void MonthlySalarySettingsEdit(MonthlySalaryInfo monthlysalaryinfo)
 {
     try
     {
         SpMonthlySalary.MonthlySalarySettingsEdit(monthlysalaryinfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("MSV:11" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
示例#2
0
        /// <summary>
        /// Function for Edit
        /// </summary>
        public void EditFunction()
        {
            try
            {
                MonthlySalarySP          spMonthlySalary          = new MonthlySalarySP();
                MonthlySalaryInfo        infoMonthlySalary        = new MonthlySalaryInfo();
                MonthlySalaryDetailsSP   spMonthlySalaryDetails   = new MonthlySalaryDetailsSP();
                MonthlySalaryDetailsInfo infoMonthlySalaryDetails = new MonthlySalaryDetailsInfo();
                EmployeeSP spEmployee = new EmployeeSP();
                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;
                spMonthlySalary.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;
                                spEmployee.EmployeePackageEdit(infoMonthlySalaryDetails.EmployeeId, infoMonthlySalaryDetails.SalaryPackageId);
                                spMonthlySalaryDetails.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());
                                        spMonthlySalaryDetails.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;
                                spMonthlySalaryDetails.MonthlySalaryDetailsAddWithMonthlySalaryId(infoMonthlySalaryDetails);
                            }
                        }
                    }
                }
                Messages.UpdatedMessage();
                GridFill();
                dtpSalaryMonth.Focus();
                btnDelete.Enabled = true;
                DeleteButtonEnableDisableChoose();
            }
            catch (Exception ex)
            {
                MessageBox.Show("MSS8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#3
0
        public string EditMonthlySalarySettings(string month, string tableData)
        {
            try
            {
                List <Dictionary <string, object> > items         = JsonConvert.DeserializeObject <List <Dictionary <string, object> > >(tableData);
                decimal                  decMasterIdForEdit       = 0;
                MonthlySalarySP          spMonthlySalary          = new MonthlySalarySP();
                MonthlySalaryInfo        infoMonthlySalary        = new MonthlySalaryInfo();
                MonthlySalaryDetailsSP   spMonthlySalaryDetails   = new MonthlySalaryDetailsSP();
                MonthlySalaryDetailsInfo infoMonthlySalaryDetails = new MonthlySalaryDetailsInfo();
                EmployeeSP               spEmployee = new EmployeeSP();
                infoMonthlySalary.SalaryMonth = Convert.ToDateTime(month);
                infoMonthlySalary.Narration   = string.Empty;
                infoMonthlySalary.Extra1      = string.Empty;
                infoMonthlySalary.Extra2      = string.Empty;
                int RowCount = items.Count;
                for (int i = 0; i < RowCount; i++)
                {
                    if (items[i]["monthlySalaryId"].GetType().Name != "JObject")
                    {
                        decMasterIdForEdit = Convert.ToDecimal(items[i]["monthlySalaryId"].ToString());
                    }
                }
                infoMonthlySalary.MonthlySalaryId = decMasterIdForEdit;
                spMonthlySalary.MonthlySalarySettingsEdit(infoMonthlySalary);
                infoMonthlySalaryDetails.MonthlySalaryId = decMasterIdForEdit;
                for (int i = 0; i <= RowCount - 1; i++)
                {
                    if (items[i]["monthlySalaryDetailsId"].GetType().Name != "JObject")
                    {
                        string st = items[i]["selectedSalaryPackageId"].ToString();
                        if (items[i]["selectedSalaryPackageId"].ToString() != "0")
                        {
                            if (items[i]["employeeId"].GetType().Name != "JObject" && items[i]["employeeId"].ToString() != string.Empty)
                            {
                                infoMonthlySalaryDetails.EmployeeId = Convert.ToDecimal(items[i]["employeeId"].ToString());
                            }
                            if (items[i]["monthlySalaryDetailsId"].GetType().Name != "JObject" && items[i]["monthlySalaryDetailsId"].ToString() != string.Empty)
                            {
                                infoMonthlySalaryDetails.MonthlySalaryDetailsId = Convert.ToDecimal(items[i]["monthlySalaryDetailsId"].ToString());
                            }
                            if (items[i]["monthlySalaryId"].GetType().Name != "JObject" && items[i]["monthlySalaryId"].ToString() != "0")
                            {
                                infoMonthlySalaryDetails.MonthlySalaryId = Convert.ToDecimal(items[i]["monthlySalaryId"].ToString());
                            }
                            if (items[i]["selectedSalaryPackageId"].GetType().Name != "JObject" && items[i]["selectedSalaryPackageId"].ToString() != "0")
                            {
                                infoMonthlySalaryDetails.SalaryPackageId = Convert.ToDecimal(items[i]["selectedSalaryPackageId"].ToString());
                                infoMonthlySalaryDetails.Extra1          = string.Empty;
                                infoMonthlySalaryDetails.Extra2          = string.Empty;
                                spEmployee.EmployeePackageEdit(infoMonthlySalaryDetails.EmployeeId, infoMonthlySalaryDetails.SalaryPackageId);
                                spMonthlySalaryDetails.MonthlySalaryDetailsEditUsingMasterIdAndDetailsId(infoMonthlySalaryDetails);
                            }
                        }
                        else
                        {
                            decimal decMonthlySalaryDetailsId = 0;
                            for (int j = 0; j < RowCount; j++)
                            {
                                if (items[j]["monthlySalaryDetailsId"].GetType().Name != "JObject" && items[j]["monthlySalaryDetailsId"].ToString() != string.Empty)
                                {
                                    if (items[j]["selectedSalaryPackageId"].ToString() == "0")
                                    {
                                        decMonthlySalaryDetailsId = Convert.ToDecimal(items[j]["monthlySalaryDetailsId"].ToString());
                                        spMonthlySalaryDetails.MonthlySalarySettingsDetailsIdDelete(decMonthlySalaryDetailsId);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        if (items[i]["employeeId"].GetType().Name != "JObject" && items[i]["employeeId"].ToString() != string.Empty)
                        {
                            infoMonthlySalaryDetails.EmployeeId = Convert.ToDecimal(items[i]["employeeId"].ToString());

                            if (items[i]["selectedSalaryPackageId"].GetType().Name != "JObject" && items[i]["selectedSalaryPackageId"].ToString() != "0")
                            {
                                infoMonthlySalaryDetails.SalaryPackageId = Convert.ToDecimal(items[i]["selectedSalaryPackageId"].ToString());
                                infoMonthlySalaryDetails.Extra1          = string.Empty;
                                infoMonthlySalaryDetails.Extra2          = string.Empty;
                                infoMonthlySalaryDetails.MonthlySalaryId = decMasterIdForEdit;
                                spMonthlySalaryDetails.MonthlySalaryDetailsAddWithMonthlySalaryId(infoMonthlySalaryDetails);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                return("MSS8" + ex.Message);
            }
            return("no");
        }