protected void Page_Load(object sender, EventArgs e)
    {
        if ((Request.ServerVariables["HTTP_REFERER"] == null) || (Request.ServerVariables["HTTP_REFERER"] == ""))
        {
            Response.Redirect("~/Error.aspx");
        }
        else
        {
            string http_ref = Request.ServerVariables["HTTP_REFERER"].Trim();
            string http_hos = Request.ServerVariables["HTTP_HOST"].Trim();
            int    len      = http_hos.Length;
            if (http_ref.IndexOf(http_hos, 0) < 0)
            {
                Response.Redirect("~/Error.aspx");
            }
        }
        if (Session["Role"].ToString() == null || Session["Role"].ToString() != "3")
        {
            Response.Redirect("~/Error.aspx");
        }
        lblUsrName.Text = Session["UsrName"].ToString();
        UniqueInsId     = Session["UniqueInstId"].ToString();
        ConnKey         = Session["ConnStr"].ToString();
        if (!IsPostBack)
        {
            try
            {
                lblDate.Text      = DateTime.Now.ToString("dd-MM-yyyy");
                imgstate.ImageUrl = "~/img/" + Session["statecd"].ToString().Trim() + ".png";
                lblstatename.Text = "GOVERNMENT OF " + Session["statename"].ToString();
                /*BY DEFAULT SET TODAYS DATE AS FROM AND TO DATE*/
                txtDate.Text = DateTime.Today.ToString("dd/MM/yyyy");

                /*Bind RegNos*/
                DateTime Dt = DateTime.Parse(txtDate.Text.Trim(), provider, System.Globalization.DateTimeStyles.NoCurrentDateDefault).Date;
                ddt = objMstBL.GetRegNosByInstIdBAL(UniqueInsId, Dt, ConnKey);
                objCommon.BindDropDownLists_WithAllOption(ddlRegNo, ddt, "RegistrationNo", "RegistrationNo", "0");

                getReport();
            }
            catch (Exception ex)
            {
                ExceptionLogging.SendExcepToDB(ex, Session["UsrName"].ToString(), Request.ServerVariables["REMOTE_ADDR"].ToString());
                Response.Redirect("~/Error.aspx");
            }
        }
    }
Example #2
0
 protected void ddlInst_OnSelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         /*Fetch Drugs*/
         DataTable ddt = ObjPhBL.getdrugIns(ddlInst.SelectedValue.ToString(), ConnKey);
         objCommon.BindDropDownLists_WithAllOption(ddlDrug, ddt, "DrugName", "DrugCode", "0");
         RefreshOnChng();
     }
     catch (Exception ex)
     {
         Response.Redirect("~/Error.aspx");
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if ((Request.ServerVariables["HTTP_REFERER"] == null) || (Request.ServerVariables["HTTP_REFERER"] == ""))
        {
            Response.Redirect("~/Error.aspx");
        }
        else
        {
            string http_ref = Request.ServerVariables["HTTP_REFERER"].Trim();
            string http_hos = Request.ServerVariables["HTTP_HOST"].Trim();
            int    len      = http_hos.Length;
            if (http_ref.IndexOf(http_hos, 0) < 0)
            {
                Response.Redirect("~/Error.aspx");
            }
        }
        if (Session["Role"].ToString() == null || Session["Role"].ToString() != "2")
        {
            Response.Redirect("~/Error.aspx");
        }
        lblUsrName.Text = Session["UsrName"].ToString();
        lblDate.Text    = DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year;
        UserName        = Session["UsrName"].ToString();
        StateCode       = Session["StateCd"].ToString();
        UniqueInstId    = Session["UniqueInstId"].ToString();
        ConnKey         = Session["ConnStr"].ToString();
        if (!IsPostBack)
        {
            imgstate.ImageUrl = "~/img/" + Session["statecd"].ToString().Trim() + ".png";
            lblstatename.Text = "GOVERNMENT OF " + Session["statename"].ToString();
            lblDate.Text      = DateTime.Now.ToString("dd-MM-yyyy");
            txtFromDate.Text  = txtToDate.Text = DateTime.Today.ToString("dd/MM/yyyy");
            ddt = ObjIns.viewAnimaldataBAL(ConnKey);
            try
            {
                objCommon.BindDropDownLists_WithAllOption(ddl_AnimalType, ddt, "AnimalTypeDesc", "AnimalTypeCode", "0");
            }
            catch (Exception ex)
            {
                ExceptionLogging.SendExcepToDB(ex, Session["UsrName"].ToString(), Request.ServerVariables["REMOTE_ADDR"].ToString());
                Response.Redirect("~/Error.aspx");
            }
            GetInsNameBAL();
        }

        // total = 0;
    }
    protected void ddlInst_OnSelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            /*Fetch Drugs*/
            DataTable ddt = ObjPhBL.getdrugIns(ddlInst.SelectedValue.ToString(), ConnKey);
            objCommon.BindDropDownLists_WithAllOption(ddlDrug, ddt, "DrugName", "DrugCode", "0");

            //if (ddt.Rows.Count > 0)
            //{
            //    ddl_Drug.DataSource = ddt;
            //    ddl_Drug.DataTextField = "DrugName";
            //    ddl_Drug.DataValueField = "DrugCode";
            //    ddl_Drug.DataBind();
            //}
            RefreshOnChng();
        }
        catch (Exception ex)
        {
            Response.Redirect("~/Error.aspx");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        /*KILL COOKIE*/
        //  DeleteCookie.DelCookie();
        //Htpp Referer Check
        if ((Request.ServerVariables["HTTP_REFERER"] == null) || (Request.ServerVariables["HTTP_REFERER"] == ""))
        {
            Response.Redirect("~/Error.aspx");
        }
        else
        {
            string http_ref = Request.ServerVariables["HTTP_REFERER"].Trim();
            string http_hos = Request.ServerVariables["HTTP_HOST"].Trim();
            int    len      = http_hos.Length;
            if (http_ref.IndexOf(http_hos, 0) < 0)
            {
                // Response.Redirect("~/Error.aspx");
            }
        }
        if (Session["UsrName"] == null || Session["Role"] == null)
        {
            Response.Redirect("~/Error.aspx");
        }
        ConnKey = Session["ConnStr"].ToString();
        if (!IsPostBack)
        {
            Random _rand = new Random();
            ViewState["keyGen"] = _rand.Next().ToString();
            imgstate.ImageUrl   = "~/img/" + Session["statecd"].ToString().Trim() + ".png";
            lblstatename.Text   = "GOVERNMENT OF " + Session["statename"].ToString();
            /*Bind Districts*/
            ddt = objMstBL.getDistrictsByStateCodeBAL(Session["statecd"].ToString().Trim(), ConnKey);
            objCommon.BindDropDownLists_WithAllOption(ddlDist, ddt, "DistName", "DistCode", "0");
            //if (Session["Role"].ToString() == "1")
            //{
            //    Session["UniqueInstId"] = "ALL";
            //    Imghome.PostBackUrl = "Admin/DashBoard_Admin.aspx";

            //}
            //if (Session["Role"].ToString() == "2")
            //{
            //    Imghome.PostBackUrl = "Institution/DashBoard_Ins.aspx";

            //}
            //if (Session["Role"].ToString() == "3")
            //{
            //    Imghome.PostBackUrl = "Pharmacy/DashBoard_Phar.aspx";

            //}
            //if (Session["Role"].ToString() == "4")
            //{
            //    Imghome.PostBackUrl = "Diagnostic/DashBoard_Dia.aspx";

            //}
            //if (Session["Role"].ToString() == "5")
            //{
            //    Imghome.PostBackUrl = "Doctor/Rpt_PatientHistory.aspx";

            //}
            lblUsrName.Text = Session["UsrName"].ToString();
            lblDate.Text    = DateTime.Now.ToString("dd-MM-yyyy");
            //lblInsName.Text = Session["InstitutionName"].ToString();
            txtFromDate.Text = txtToDt.Text = DateTime.Today.ToString("dd/MM/yyyy");
            try
            {
                getReport();
            }
            catch (Exception ex)
            {
                ExceptionLogging.SendExcepToDB(ex, Session["UsrName"].ToString(), Request.ServerVariables["REMOTE_ADDR"].ToString());
                Response.Redirect("~/Error.aspx");
            }
        }
    }