protected void rdpEndDate_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e) { try { rcmb_ServiceProvider.Items.Clear(); rcmb_ServiceProvider.Text = string.Empty; if (Control == "MedicalInvoiceDetails" && rdpStartDate.SelectedDate != null && rdpEndDate.SelectedDate != null) { SMHR_INSPECTION objInspection = new SMHR_INSPECTION(); objInspection.INSPECTION_FROMDATE = Convert.ToDateTime(rdpStartDate.SelectedDate); objInspection.INSPECTION_TODATE = Convert.ToDateTime(rdpEndDate.SelectedDate); objInspection.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); objInspection.MODE = 3; DataTable dtServiceProviders = new DataTable(); dtServiceProviders = BLL.get_MedicalServiceProvider(objInspection); if (dtServiceProviders.Rows.Count > 0) { rcmb_ServiceProvider.DataSource = dtServiceProviders; rcmb_ServiceProvider.DataTextField = "SERVICEPROVIDERNAME"; rcmb_ServiceProvider.DataValueField = "SERVICEPROVIDERNAME"; rcmb_ServiceProvider.DataBind(); rcmb_ServiceProvider.Items.Insert(0, new RadComboBoxItem("Select", "-1")); } else { BLL.ShowMessage(this, "There is no data in the selected date range"); } } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "EmployeeRetirment", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void LoadInspectionsGrid() { try { _obj_smhr_Inspection = new SMHR_INSPECTION(); _obj_smhr_Inspection.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); Rg_Inspection.DataSource = BLL.get_AllInspections(_obj_smhr_Inspection); } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_InspectionsMaster", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void lnk_Edit(object sender, CommandEventArgs e) { try { ClearFields(); rad_InspectionName.Enabled = false; rad_Description.Enabled = true; rad_IsActive.Enabled = true; _obj_smhr_Inspection = new SMHR_INSPECTION(); _obj_smhr_Inspection.INSPECTION_ID = Convert.ToInt32(e.CommandArgument); DataTable dt = BLL.get_Inspections(_obj_smhr_Inspection); lbl_INSPECTIONID.Text = Convert.ToString(dt.Rows[0]["INSPECTION_ID"]); rad_InspectionName.Text = Convert.ToString(dt.Rows[0]["INSPECTION_NAME"]); rad_Description.Text = Convert.ToString(dt.Rows[0]["INSPECTION_DESCRIPTION"]); LoadBusinessUnit(); rcmb_EmpReg_BU.SelectedValue = Convert.ToString(dt.Rows[0]["INSPECTION_BU_ID"]); Load_Directorate(); rad_Directorate.SelectedValue = Convert.ToString(dt.Rows[0]["INSPECTION_DIRECTORATE_ID"]); LoadDepartment(); rad_Department.SelectedValue = Convert.ToString(dt.Rows[0]["INSPECTION_DEPARTMENT_ID"]); LoadDivision(); rad_SubDepartment.SelectedValue = Convert.ToString(dt.Rows[0]["INSPECTION_SUBDEPARTMENT_ID"]); rad_IsActive.Checked = Convert.ToBoolean(dt.Rows[0]["INSPECTION_ISACTIVE"]); Rm_HDPT_page.SelectedIndex = 1; rcmb_EmpReg_BU.Enabled = false; rad_Directorate.Enabled = false; rad_Department.Enabled = false; rad_SubDepartment.Enabled = false; BTN_SAVE.Visible = false; btn_Update.Visible = true; } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_InspectionsMaster", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void btn_submit_Click(object sender, EventArgs e) { try { bool status = false; _obj_smhr_Inspection = new SMHR_INSPECTION(); int buID = Convert.ToInt32(rcmb_EmpReg_BU.SelectedValue); DataTable dtInspctnExists = new DataTable(); switch (((Button)sender).ID.ToUpper()) { case "BTN_SAVE": _obj_smhr_Inspection.OPERATION = operation.Insert; _obj_smhr_Inspection.INSPECTION_NAME = Convert.ToString(rad_InspectionName.Text); _obj_smhr_Inspection.INSPECTION_DESCRIPTION = Convert.ToString(rad_Description.Text); _obj_smhr_Inspection.INSPECTION_DIRECTORATE_ID = Convert.ToInt32(rad_Directorate.SelectedValue); if (buID != 0) { _obj_smhr_Inspection.INSPECTION_BU_ID = buID; } else { BLL.ShowMessage(this, "Please Select Business Unit"); return; } if (rad_Department.SelectedIndex > 0) { _obj_smhr_Inspection.INSPECTION_DEPARTMENT_ID = Convert.ToInt32(rad_Department.SelectedValue); } else { _obj_smhr_Inspection.INSPECTION_DEPARTMENT_ID = 0; } if (rad_SubDepartment.SelectedIndex > 0) { _obj_smhr_Inspection.INSPECTION_SUBDEPARTMENT_ID = Convert.ToInt32(rad_SubDepartment.SelectedValue); } else { _obj_smhr_Inspection.INSPECTION_SUBDEPARTMENT_ID = 0; } _obj_smhr_Inspection.INSPECTION_CREATEDBY = Convert.ToInt32(Session["USER_ID"]); _obj_smhr_Inspection.INSPECTION_CREATEDDATE = DateTime.Now; _obj_smhr_Inspection.INSPECTION_ISACTIVE = Convert.ToBoolean(rad_IsActive.Checked); dtInspctnExists = BLL.checkInspectionexistsbyBuID(_obj_smhr_Inspection); if (dtInspctnExists.Rows.Count == 0) { status = BLL.set_Inspections(_obj_smhr_Inspection); if (status == true) { BLL.ShowMessage(this, "Information Successfully Saved"); } } else { BLL.ShowMessage(this, "This Inspection Already Exists"); return; } break; case "BTN_UPDATE": _obj_smhr_Inspection.OPERATION = operation.Update; _obj_smhr_Inspection.INSPECTION_NAME = Convert.ToString(rad_InspectionName.Text); _obj_smhr_Inspection.INSPECTION_DESCRIPTION = Convert.ToString(rad_Description.Text); _obj_smhr_Inspection.INSPECTION_DIRECTORATE_ID = Convert.ToInt32(rad_Directorate.SelectedValue); if (rad_Department.SelectedIndex > 0) { _obj_smhr_Inspection.INSPECTION_DEPARTMENT_ID = Convert.ToInt32(rad_Department.SelectedValue); } else { _obj_smhr_Inspection.INSPECTION_DEPARTMENT_ID = 0; } if (rad_SubDepartment.SelectedIndex > 0) { _obj_smhr_Inspection.INSPECTION_SUBDEPARTMENT_ID = Convert.ToInt32(rad_SubDepartment.SelectedValue); } else { _obj_smhr_Inspection.INSPECTION_SUBDEPARTMENT_ID = 0; } if (buID != 0) { _obj_smhr_Inspection.INSPECTION_BU_ID = buID; } else { BLL.ShowMessage(this, "Please Select Business Unit"); return; } _obj_smhr_Inspection.INSPECTION_ID = Convert.ToInt32(lbl_INSPECTIONID.Text); _obj_smhr_Inspection.INSPECTION_MODIFIEDBY = Convert.ToInt32(Session["USER_ID"]); _obj_smhr_Inspection.INSPECTION_MODIFIEDDATE = DateTime.Now; _obj_smhr_Inspection.INSPECTION_ISACTIVE = Convert.ToBoolean(rad_IsActive.Checked); status = BLL.set_Inspections(_obj_smhr_Inspection); if (status == true) { BLL.ShowMessage(this, "Information Updated Successfully"); } break; } Rm_HDPT_page.SelectedIndex = 0; LoadInspectionsGrid(); Rg_Inspection.DataBind(); } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_InspectionsMaster", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
public static DataTable checkInspectionexistsbyBuID(SMHR_INSPECTION _obj_smhr_inspection) { return(ExecuteQuery("EXEC USP_SMHR_INSPECTION_MASTER @Operation = 'CHECKEXISTS_BY_BU_ID',@INSPECTION_NAME = '" + _obj_smhr_inspection.INSPECTION_NAME + "'" + ",@INSPECTION_BU_ID=" + _obj_smhr_inspection.INSPECTION_BU_ID)); }
public static DataTable get_allInspections_by_buID(SMHR_INSPECTION _obj_smhr_inspection) { return(ExecuteQuery("EXEC USP_SMHR_INSPECTION_MASTER @Operation = 'GET_INSPECTIONS_BY_BUID'" + ", @INSPECTION_BU_ID=" + _obj_smhr_inspection.INSPECTION_BU_ID + ",@ORG_ID = " + _obj_smhr_inspection.ORGANISATION_ID)); }