public void LoadGrid()
    {
        try
        {
            _obj_Smhr_County = new SMHR_COUNTY();
            _obj_Smhr_County.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
            DataTable DT = BLL.get_County(_obj_Smhr_County);
            Rg_Counties.DataSource = DT;

            clearControls();
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_County", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
Example #2
0
    private void LoadCounties()
    {
        try
        {
            SMHR_COUNTY _obj_Smhr_County = new SMHR_COUNTY();
            _obj_Smhr_County.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);

            rcmb_County.DataSource     = BLL.get_County(_obj_Smhr_County);
            rcmb_County.DataTextField  = "COUNTY_CODE";
            rcmb_County.DataValueField = "COUNTY_ID";
            rcmb_County.DataBind();
            rcmb_County.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("Select", "0"));
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_TownMaster", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
Example #3
0
 private void LoadCounty()
 {
     try
     {
         SMHR_COUNTY _obj_Smhr_County = new SMHR_COUNTY();
         _obj_Smhr_County.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
         _obj_Smhr_County.OPERATION       = operation.Select;
         DataTable dt = BLL.get_County(_obj_Smhr_County);
         rcmb_County.DataSource     = dt;
         rcmb_County.DataTextField  = "COUNTY_CODE";
         rcmb_County.DataValueField = "COUNTY_ID";
         rcmb_County.DataBind();
         rcmb_County.Items.Insert(0, new RadComboBoxItem("ALL"));
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "EmployeeList", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
     }
 }
Example #4
0
 protected void rc_Country_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
 {
     try
     {
         rc_County.SelectedIndex = -1;
         rc_Town.SelectedIndex   = -1;
         SMHR_COUNTY _obj_Smhr_County = new SMHR_COUNTY();
         _obj_Smhr_County.OPERATION       = operation.Select2;
         _obj_Smhr_County.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
         _obj_Smhr_County.COUNTRY_ID      = Convert.ToInt32(rc_Country.SelectedValue);
         rc_County.DataSource             = BLL.get_County(_obj_Smhr_County);
         rc_County.DataTextField          = "COUNTY_CODE";
         rc_County.DataValueField         = "COUNTY_ID";
         rc_County.DataBind();
         rc_County.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("Select", "0"));
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "TrainerProfile", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
     }
 }
 protected void lnk_Edit_Command(object sender, CommandEventArgs e)
 {
     try
     {
         clearControls();
         LoadCountries();
         //if (rcmb_Country.FindItemByText("Kenya") != null)
         //    rcmb_Country.FindItemByText("Kenya").Selected = true;
         rtxt_CountyCode.Enabled = false;
         SMHR_COUNTY _obj_Smhr_County = new SMHR_COUNTY();
         _obj_Smhr_County.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
         _obj_Smhr_County.COUNTY_ID       = Convert.ToInt32(e.CommandArgument);
         DataTable dt = BLL.get_County(_obj_Smhr_County);
         //DataTable dt = BLL.get_County(new SMHR_COUNTY(Convert.ToInt32(Convert.ToString(e.CommandArgument))));
         lbl_CountyID.Text          = Convert.ToString(dt.Rows[0]["COUNTY_ID"]);
         rtxt_CountyCode.Text       = Convert.ToString(dt.Rows[0]["COUNTY_CODE"]);
         rtxt_CountyName.Text       = Convert.ToString(dt.Rows[0]["COUNTY_NAME"]);
         rcmb_Country.SelectedIndex = rcmb_Country.Items.FindItemIndexByValue(Convert.ToString(dt.Rows[0]["COUNTRY_ID"]));
         //code for security
         rcmb_Country.Enabled = false;
         if (Convert.ToInt32(Session["WRITEFACILITY"]) == 2)
         {
             btn_Update.Visible = false;
         }
         else
         {
             btn_Update.Visible = true;
         }
         Rm_CY_page.SelectedIndex = 1;
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_County", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
     }
 }
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        try
        {
            _obj_Smhr_County                 = new SMHR_COUNTY();
            _obj_Smhr_County.COUNTY_CODE     = BLL.ReplaceQuote(rtxt_CountyCode.Text);
            _obj_Smhr_County.COUNTY_NAME     = BLL.ReplaceQuote(rtxt_CountyName.Text);
            _obj_Smhr_County.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
            _obj_Smhr_County.COUNTRY_ID      = Convert.ToInt32(rcmb_Country.SelectedValue);
            _obj_Smhr_County.CREATEDBY       = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session
            _obj_Smhr_County.CREATEDDATE     = DateTime.Now;

            _obj_Smhr_County.LASTMDFBY   = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session
            _obj_Smhr_County.LASTMDFDATE = DateTime.Now;

            switch (((Button)sender).ID.ToUpper())
            {
            case "BTN_UPDATE":
                _obj_Smhr_County.COUNTY_ID = Convert.ToInt32(lbl_CountyID.Text);
                _obj_Smhr_County.OPERATION = operation.Update;
                if (BLL.set_County(_obj_Smhr_County))
                {
                    BLL.ShowMessage(this, "Information Updated Successfully");
                }
                else
                {
                    BLL.ShowMessage(this, "Information Not Updated");
                }

                break;

            case "BTN_SAVE":
                _obj_Smhr_County.OPERATION = operation.Check;
                if (Convert.ToString(BLL.get_County(_obj_Smhr_County).Rows[0]["Count"]) != "0")
                {
                    BLL.ShowMessage(this, "District Name Already Exists");
                    return;
                }
                _obj_Smhr_County.OPERATION = operation.Insert;
                if (BLL.set_County(_obj_Smhr_County))
                {
                    BLL.ShowMessage(this, "Information Saved Successfully");
                }
                else
                {
                    BLL.ShowMessage(this, "Information Not Saved");
                }
                break;

            default:
                break;
            }
            Rm_CY_page.SelectedIndex = 0;
            LoadGrid();
            Rg_Counties.DataBind();
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_County", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }