Exemple #1
0
    public void LoadGrid()
    {
        try
        {
            _obj_Smhr_Country = new SMHR_COUNTRY();
            _obj_Smhr_Country.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
            DataTable DT = BLL.get_Country(_obj_Smhr_Country);
            Rg_Countries.DataSource = DT;

            clearControls();
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_Country", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
 private void LoadCountries()
 {
     try
     {
         SMHR_COUNTRY _obj_Country = new SMHR_COUNTRY();
         _obj_Country.OPERATION       = operation.Select;
         _obj_Country.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
         rcmb_Country.DataSource      = BLL.get_Country(_obj_Country);
         rcmb_Country.DataTextField   = "COUNTRY_CODE";
         rcmb_Country.DataValueField  = "COUNTRY_ID";
         rcmb_Country.DataBind();
         rcmb_Country.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_County", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
     }
 }
Exemple #3
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        try
        {
            _obj_Smhr_Country = new SMHR_COUNTRY();
            _obj_Smhr_Country.COUNTRY_CODE    = BLL.ReplaceQuote(rtxt_CountryCode.Text);
            _obj_Smhr_Country.COUNTRY_NAME    = BLL.ReplaceQuote(rtxt_CountryName.Text);
            _obj_Smhr_Country.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
            _obj_Smhr_Country.CREATEDBY       = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session
            _obj_Smhr_Country.CREATEDDATE     = DateTime.Now;

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

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

                break;

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

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