protected void Btn_Finalize_Click(object sender, EventArgs e) { try { bool result = false; for (int i = 0; i < Rg_YTDOB.Items.Count; i++) { _obj_Smhr_YTDOpeningBalance = new SMHR_YTDOPENINGBALANCE(); _obj_Smhr_YTDOpeningBalance.OPERATION = operation.Select; _obj_Smhr_YTDOpeningBalance.YTD_BUSINESSUNIT_ID = Convert.ToInt32(rcmb_BusinessUnit.SelectedItem.Value); DataTable DT = BLL.get_YTDOpeningBalance(_obj_Smhr_YTDOpeningBalance); RadNumericTextBox rtxtoldbalance = new RadNumericTextBox(); RadNumericTextBox rntb = new RadNumericTextBox(); RadComboBox rcmb = new RadComboBox(); rtxtoldbalance = Rg_YTDOB.Items[i].FindControl("txt_oldbalance") as RadNumericTextBox; rntb = Rg_YTDOB.Items[i].FindControl("rnt_NewBal") as RadNumericTextBox; rcmb = Rg_YTDOB.Items[i].FindControl("rcmb_Select") as RadComboBox; _obj_Smhr_YTDOpeningBalance = new SMHR_YTDOPENINGBALANCE(); _obj_Smhr_YTDOpeningBalance.YTD_ID = Convert.ToInt32(Rg_YTDOB.Items[i]["YTD_ID"].Text); _obj_Smhr_YTDOpeningBalance.YTD_PERIOD_ID = Convert.ToInt32(rcmb_Period.SelectedItem.Value); _obj_Smhr_YTDOpeningBalance.YTD_PAYITEM_ID = Convert.ToInt32(rcmb_Payitem.SelectedItem.Value); _obj_Smhr_YTDOpeningBalance.YTD_OLDBALANCE = Convert.ToDecimal(rtxtoldbalance.Text); _obj_Smhr_YTDOpeningBalance.YTD_NEWBALANCE = Convert.ToInt32(rntb.Value); //_obj_Smhr_YTDOpeningBalance.YTD_OPERATION = Convert.ToString(rcmb.SelectedItem.Text); _obj_Smhr_YTDOpeningBalance.YTD_EMP_ID = Convert.ToInt32(Rg_YTDOB.Items[i]["EMP_ID"].Text); _obj_Smhr_YTDOpeningBalance.YTD_BUSINESSUNIT_ID = Convert.ToInt32(rcmb_BusinessUnit.SelectedItem.Value); _obj_Smhr_YTDOpeningBalance.YTD_STATUS = 1; _obj_Smhr_YTDOpeningBalance.CREATEDBY = Convert.ToInt32(Session["USER_ID"]); _obj_Smhr_YTDOpeningBalance.CREATEDDATE = DateTime.Now; _obj_Smhr_YTDOpeningBalance.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); _obj_Smhr_YTDOpeningBalance.LASTMDFBY = Convert.ToInt32(Session["USER_ID"]); _obj_Smhr_YTDOpeningBalance.LASTMDFDATE = DateTime.Now; _obj_Smhr_YTDOpeningBalance.OPERATION = operation.Update; result = true; result = BLL.set_YTDOpeningBalance(_obj_Smhr_YTDOpeningBalance); } if (result == true) { BLL.ShowMessage(this, "YTD Transaction Finalized successfully"); Rg_YTDOB.DataSource = null; Rg_YTDOB.DataBind(); Btn_Finalize.Enabled = false; Btn_Save.Enabled = false; } else { } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_YTDOpeningBalances", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
public void LoadGrid() { try { _obj_Smhr_YTDOpeningBalance = new SMHR_YTDOPENINGBALANCE(); _obj_Smhr_YTDOpeningBalance.OPERATION = operation.Select; _obj_Smhr_YTDOpeningBalance.YTD_BUSINESSUNIT_ID = Convert.ToInt32(rcmb_BusinessUnit.SelectedItem.Value); _obj_Smhr_YTDOpeningBalance.YTD_PERIOD_ID = Convert.ToInt32(rcmb_Period.SelectedItem.Value); _obj_Smhr_YTDOpeningBalance.YTD_PAYITEM_ID = Convert.ToInt32(rcmb_Payitem.SelectedItem.Value); DataTable DT = BLL.get_YTDOpeningBalance(_obj_Smhr_YTDOpeningBalance); Rg_YTDOB.DataSource = DT; Rg_YTDOB.DataBind(); } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_YTDOpeningBalances", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void rcmb_Payitem_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) { try { if (rcmb_BusinessUnit.SelectedIndex > 0 && rcmb_Period.SelectedIndex > 0) { if (rcmb_Payitem.SelectedIndex != 0) { _obj_Smhr_YTDOpeningBalance = new SMHR_YTDOPENINGBALANCE(); _obj_Smhr_YTDOpeningBalance.OPERATION = operation.Validate; _obj_Smhr_YTDOpeningBalance.YTD_BUSINESSUNIT_ID = Convert.ToInt32(rcmb_BusinessUnit.SelectedItem.Value); _obj_Smhr_YTDOpeningBalance.YTD_PERIOD_ID = Convert.ToInt32(rcmb_Period.SelectedItem.Value); _obj_Smhr_YTDOpeningBalance.YTD_PAYITEM_ID = Convert.ToInt32(rcmb_Payitem.SelectedItem.Value); DataTable dt_count = BLL.get_YTDCount(_obj_Smhr_YTDOpeningBalance); if (dt_count.Rows.Count != 0) { if (Convert.ToInt32(dt_count.Rows[0]["CNT"]) > 0) { _obj_Smhr_YTDOpeningBalance = new SMHR_YTDOPENINGBALANCE(); _obj_Smhr_YTDOpeningBalance.YTD_BUSINESSUNIT_ID = Convert.ToInt32(rcmb_BusinessUnit.SelectedItem.Value); _obj_Smhr_YTDOpeningBalance.YTD_PERIOD_ID = Convert.ToInt32(rcmb_Period.SelectedItem.Value); _obj_Smhr_YTDOpeningBalance.YTD_PAYITEM_ID = Convert.ToInt32(rcmb_Payitem.SelectedItem.Value); _obj_Smhr_YTDOpeningBalance.OPERATION = operation.Select; DataTable DT = BLL.get_YTDOpeningBalance(_obj_Smhr_YTDOpeningBalance); if (DT.Rows.Count != 0) { if (Convert.ToInt32((DT.Rows[0]["YTD_STATUS"])) == 1) { Rg_YTDOB.Enabled = false; Rg_YTDOB.DataSource = DT; Rg_YTDOB.DataBind(); Btn_Save.Visible = false; Btn_Save.Enabled = false; } else { Rg_YTDOB.Enabled = true; Rg_YTDOB.DataSource = DT; Rg_YTDOB.DataBind(); Btn_Save.Visible = true; Btn_Save.Enabled = true; } } } else { _obj_Smhr_YTDOpeningBalance.OPERATION = operation.Empty; DataTable DT1 = BLL.get_YTDOpeningBalance(_obj_Smhr_YTDOpeningBalance); Rg_YTDOB.DataSource = DT1; Rg_YTDOB.DataBind(); Rg_YTDOB.Enabled = true; Btn_Save.Visible = true; Btn_Save.Enabled = true; } } Rg_YTDOB.Visible = true; if (Convert.ToInt32(Session["WRITEFACILITY"]) == 2) { Btn_Finalize.Visible = false; Btn_Save.Visible = false; } else { Btn_Finalize.Visible = false; //Btn_Save.Visible = true; //Btn_Save.Enabled = true; Btn_Finalize.Enabled = true; } Btn_Cancel.Visible = true; } else { Rg_YTDOB.Visible = false; } } else { BLL.ShowMessage(this, "Please Select All Parameters."); return; } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_YTDOpeningBalances", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }