private bool process() { try { Label lbl_ID = new Label(); Label lbl_taxName = new Label(); RadNumericTextBox rntxt_Value = new RadNumericTextBox(); Label lbl_MaxAmt = new Label(); bool status1 = false; int index = 0; for (index = 0; index <= RG_Employee.Items.Count - 1; index++) { lbl_ID = RG_Employee.Items[index].FindControl("lbl_tax_id") as Label; rntxt_Value = RG_Employee.Items[index].FindControl("rntxt_Number") as RadNumericTextBox; lbl_MaxAmt = RG_Employee.Items[index].FindControl("lbl_tax_maxlimit") as Label; if (rntxt_Value.Value != 0.00) { _obj_smhr_income_trans = new SMHR_INCOME_TRANS(); _obj_smhr_income_trans.Mode = 2; _obj_smhr_income_trans.SMHR_EMPINCOME_EMPID = Convert.ToInt32(rcb_Employee.SelectedValue); _obj_smhr_income_trans.SMHR_EMPINCOME_INCOMEID = Convert.ToInt32(Convert.ToString(lbl_ID.Text)); _obj_smhr_income_trans.SMHR_EMPINCOME_PERIOD = Convert.ToInt32(rcmb_period.SelectedItem.Value); // Verifying whether the Entered Exemption value is greater than the max limit // if Entered Value is greater than the max limit then take max limit value // else take entered value if (Convert.ToDouble(rntxt_Value.Value) > Convert.ToDouble(Convert.ToString(lbl_MaxAmt.Text))) { _obj_smhr_income_trans.SMHR_EMPINCOME_AMOUNT = Convert.ToDouble(rntxt_Value.Value); _obj_smhr_income_trans.SMHR_EMPINCOME_AMT = Convert.ToDouble(Convert.ToString(lbl_MaxAmt.Text)); } else { _obj_smhr_income_trans.SMHR_EMPINCOME_AMOUNT = Convert.ToDouble(rntxt_Value.Value); _obj_smhr_income_trans.SMHR_EMPINCOME_AMT = Convert.ToDouble(rntxt_Value.Value); } _obj_smhr_income_trans.SMHR_EMPINCOME_CREATEDBY = Convert.ToInt32(Convert.ToString(Session["EMP_ID"])); _obj_smhr_income_trans.SMHR_EMPINCOME_CREATEDDATE = DateTime.Now; status1 = BLL.set_Income_Trans(_obj_smhr_income_trans); } } return(status1); } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_Income_Trans", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); return(false); } }
private void LoadGrid() { try { _obj_smhr_income_trans = new SMHR_INCOME_TRANS(); _obj_smhr_income_trans.Mode = 1; _obj_smhr_income_trans.SMHR_EMPINCOME_EMPID = Convert.ToInt32(rcb_Employee.SelectedValue); _obj_smhr_income_trans.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); _obj_smhr_income_trans.SMHR_EMPINCOME_PERIOD = Convert.ToInt32(rcmb_period.SelectedItem.Value); DataTable dt = BLL.get_Income_trans(_obj_smhr_income_trans); RG_Employee.DataSource = dt; } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_Income_Trans", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void btn_Save_Click(object sender, EventArgs e) { try { Label lbl_ID = new Label(); Label lbl_taxName = new Label(); RadNumericTextBox rntxt_Value = new RadNumericTextBox(); Label lbl_MaxAmt = new Label(); //int index = 0; //int Counter = 0; //for (index = 0; index <= RG_Employee.Items.Count - 1; index++) //{ // rntxt_Value = RG_Employee.Items[index].FindControl("rntxt_Number") as RadNumericTextBox; // if (rntxt_Value.Value == 0.00) // { // Counter = Counter + 1; // } //} //if (Counter == RG_Employee.Items.Count) //{ // BLL.ShowMessage(this, "Please Enter atleast one Exemption Value"); // return; //} //else //{ bool status = false; bool status1 = false; _obj_smhr_income_trans = new SMHR_INCOME_TRANS(); _obj_smhr_income_trans.Mode = 4; _obj_smhr_income_trans.SMHR_EMPINCOME_EMPID = Convert.ToInt32(rcb_Employee.SelectedValue); _obj_smhr_income_trans.SMHR_EMPINCOME_PERIOD = Convert.ToInt32(rcmb_period.SelectedItem.Value); DataTable dt = BLL.get_Income_trans(_obj_smhr_income_trans); if (dt.Rows.Count != 0) { _obj_smhr_income_trans = new SMHR_INCOME_TRANS(); _obj_smhr_income_trans.Mode = 3; _obj_smhr_income_trans.SMHR_EMPINCOME_EMPID = Convert.ToInt32(rcb_Employee.SelectedValue); _obj_smhr_income_trans.SMHR_EMPINCOME_PERIOD = Convert.ToInt32(rcmb_period.SelectedItem.Value); status = BLL.set_Income_Trans(_obj_smhr_income_trans); status1 = process(); if (status1 == true) { BLL.ShowMessage(this, "Income Exemptions Added Successfully"); RG_Employee.Visible = false; btn_Cancel.Visible = false; btn_Save.Visible = false; rcb_Employee.Items.Clear(); rcb_Employee.Items.Insert(0, new RadComboBoxItem("", "")); //rcb_BusinessUnit.SelectedIndex = 0; rcmb_period.ClearSelection(); rcb_BusinessUnit.ClearSelection(); return; } else { //BLL.ShowMessage(this, "An Error Occured while doing the process"); // BLL.ShowMessage(this, "Enter the amount for Income Elements to process"); return; } } else { status1 = process(); if (status1 == true) { BLL.ShowMessage(this, "Income Exemptions Added Successfully"); RG_Employee.Visible = false; btn_Cancel.Visible = false; btn_Save.Visible = false; rcb_Employee.Items.Clear(); //rcb_BusinessUnit.SelectedIndex = 0; rcmb_period.ClearSelection(); rcb_BusinessUnit.ClearSelection(); return; } else { //BLL.ShowMessage(this, "Enter the amount for Income Elements to process"); return; } } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_Income_Trans", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } //} }