private void LoadCombos() { try { _obj_Department = new SMHR_DEPARTMENT(); _obj_Department.MODE = 7; _obj_Department.BUID = Convert.ToInt32(rcmb_BU.SelectedValue); DataTable dt = BLL.get_Department(_obj_Department); ddl_Department.DataSource = dt; ddl_Department.DataTextField = "DEPARTMENT_NAME"; ddl_Department.DataValueField = "DEPARTMENT_ID"; ddl_Department.DataBind(); ddl_Department.Items.Insert(0, new RadComboBoxItem("Select")); SMHR_DIVISION _obj_Smhr_Division = new SMHR_DIVISION(); _obj_Smhr_Division.OPERATION = operation.Approve; _obj_Smhr_Division.BUID = Convert.ToInt32(rcmb_BU.SelectedValue); _obj_Smhr_Division.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); DataTable dt1 = BLL.get_DivisionMapping(_obj_Smhr_Division); ddl_Diviison.DataSource = dt1; ddl_Diviison.DataValueField = "SMHR_DIV_ID"; ddl_Diviison.DataTextField = "SMHR_DIV_CODE"; ddl_Diviison.DataBind(); ddl_Diviison.Items.Insert(0, new RadComboBoxItem("Select")); } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "DepartmentDivisionMapping", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
public void LoadGrid() { try { SMHR_DIVISION _obj_Smhr_Division = new SMHR_DIVISION(); _obj_Smhr_Division.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); DataTable DT = BLL.get_Division(_obj_Smhr_Division); Rg_Division.DataSource = DT; clearControls(); } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "DivisionMaster", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void btn_Save_Click(object sender, EventArgs e) { try { SMHR_DIVISION _obj_Smhr_Division = new SMHR_DIVISION(); _obj_Smhr_Division.DIVISION_CODE = BLL.ReplaceQuote(rtxt_SubDepartment.Text); _obj_Smhr_Division.DIVISION_DESCRIPTION = BLL.ReplaceQuote(rtxt_CountryName.Text); _obj_Smhr_Division.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); _obj_Smhr_Division.BUID = Convert.ToInt32(ddl_BusinessUnit.SelectedItem.Value); _obj_Smhr_Division.DEPARTMENT_ID = Convert.ToInt32(rad_Department.SelectedItem.Value); _obj_Smhr_Division.CREATEDBY = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session _obj_Smhr_Division.CREATEDDATE = DateTime.Now; _obj_Smhr_Division.LASTMDFBY = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session _obj_Smhr_Division.LASTMDFDATE = DateTime.Now; switch (((Button)sender).ID.ToUpper()) { case "BTN_UPDATE": _obj_Smhr_Division.DIVISION_ID = Convert.ToInt32(lbl_DivisionID.Text); _obj_Smhr_Division.OPERATION = operation.Update; if (BLL.set_Division(_obj_Smhr_Division)) { BLL.ShowMessage(this, "Information Updated Successfully"); } else { BLL.ShowMessage(this, "Information Not Updated"); } break; case "BTN_SAVE": _obj_Smhr_Division.OPERATION = operation.Check; if (Convert.ToString(BLL.get_Division(_obj_Smhr_Division).Rows[0]["Count"]) != "0") { BLL.ShowMessage(this, "SubDepartment Already Exists"); return; } _obj_Smhr_Division.OPERATION = operation.Insert; if (BLL.set_Division(_obj_Smhr_Division)) { SMHR_DEPARTMENT_DIVISION_MAPPING _obj_Smhr_DDM = new SMHR_DEPARTMENT_DIVISION_MAPPING(); SMHR_DIVISION _obj_Smhr_Divisions = new SMHR_DIVISION(); _obj_Smhr_Division.OPERATION = operation.D; DataTable dt = new DataTable(); dt = BLL.get_DivisionMapping(_obj_Smhr_Division); if (dt.Rows.Count > 0) { _obj_Smhr_DDM.DIVISION_ID = Convert.ToInt32(dt.Rows[0][0]); } _obj_Smhr_DDM.Type = "Division"; _obj_Smhr_DDM.ERP_CODE = "0"; _obj_Smhr_DDM.OPERATION = operation.Approve; _obj_Smhr_DDM.CREATEDBY = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session _obj_Smhr_DDM.CREATEDDATE = DateTime.Now; _obj_Smhr_DDM.LASTMDFBY = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session _obj_Smhr_DDM.LASTMDFDATE = DateTime.Now; BLL.set_DivisionMapping(_obj_Smhr_DDM); BLL.ShowMessage(this, "Information Saved Successfully"); } else { BLL.ShowMessage(this, "Information Not Saved"); } break; default: break; } Rm_Division_page.SelectedIndex = 0; LoadGrid(); Rg_Division.DataBind(); } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "DivisionMaster", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }