Exemple #1
0
        protected void DropDownState_SelectedIndexChanged(object sender, EventArgs e)
        {
            string        connString = ConfigurationManager.ConnectionStrings["tomms_prodConnectionString"].ConnectionString;
            SqlConnection con        = null;

            try
            {
                con = new SqlConnection(connString);
                /*For District Dropdown Load*/
                string com1 = "select RowID , ast_loc_ast_loc from  ast_loc (nolock) where ast_loc_state = '" + DropDownState.SelectedItem.Text + "'";

                SqlDataAdapter adpt1 = new SqlDataAdapter(com1, con);
                DataTable      dt1   = new DataTable();
                adpt1.Fill(dt1);
                DropDownDistrict.DataSource = dt1;
                DropDownDistrict.DataBind();
                DropDownDistrict.DataTextField  = "ast_loc_ast_loc";
                DropDownDistrict.DataValueField = "RowID";
                DropDownDistrict.DataBind();
                DropDownDistrict.Items.Insert(0, new ListItem("ALL", "0"));

                /*For Zone Dropdown Load*/
                if (DropDownState.SelectedItem.Text == "ALL")
                {
                    string com01 = "select distinct  ast_loc_zone , ast_loc_zone from ast_loc (nolock)";

                    SqlDataAdapter adptzo = new SqlDataAdapter(com01, con);
                    DataTable      dtzo   = new DataTable();
                    adptzo.Fill(dtzo);
                    DropDownZone.DataSource = dtzo;
                    DropDownZone.DataBind();
                    DropDownZone.DataTextField  = "ast_loc_zone";
                    DropDownZone.DataValueField = "ast_loc_zone";
                    DropDownZone.DataBind();
                    DropDownZone.Items.Insert(0, new ListItem("ALL", "0"));
                }
                else
                {
                    string com3 = "select distinct  ast_loc_zone , ast_loc_zone from ast_loc (nolock) where ast_loc_state = '" + DropDownState.SelectedItem.Text + "'";

                    SqlDataAdapter adpt3 = new SqlDataAdapter(com3, con);
                    DataTable      dt3   = new DataTable();
                    adpt3.Fill(dt3);
                    DropDownZone.DataSource = dt3;
                    DropDownZone.DataBind();
                    DropDownZone.DataTextField  = "ast_loc_zone";
                    DropDownZone.DataValueField = "ast_loc_zone";
                    DropDownZone.DataBind();
                    // DropDownZone.Items.Insert(0, new ListItem("ALL", "0"));
                }
            }
            catch (Exception ex)
            {
                //log error
                //display friendly error to user
                string msg = "Insert Error:";
                msg += ex.Message;
            }
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["name"] == null)
                {
                    Session["prevUrl"] = Request.Url;
                    Response.Redirect("~/loginPage.aspx");
                }
                else
                {
                    string username = Session["name"].ToString();
                    this.Label8.Text = string.Format("Hi {0}", Session["name"].ToString() + "!");
                    // Label8.Visible = false;
                    //  Label8.Text = username;

                    string        connString = ConfigurationManager.ConnectionStrings["tomms_prodConnectionString"].ConnectionString;
                    SqlConnection con        = null;

                    try
                    {
                        con = new SqlConnection(connString);

                        /*For Zone Dropdown Load*/
                        string com01 = "select distinct  ast_loc_zone , ast_loc_zone from ast_loc (nolock)";

                        SqlDataAdapter adptzo = new SqlDataAdapter(com01, con);
                        DataTable      dtzo   = new DataTable();
                        adptzo.Fill(dtzo);
                        DropDownZone.DataSource = dtzo;
                        DropDownZone.DataBind();
                        DropDownZone.DataTextField  = "ast_loc_zone";
                        DropDownZone.DataValueField = "ast_loc_zone";
                        DropDownZone.DataBind();
                        DropDownZone.Items.Insert(0, new ListItem("ALL", "0"));

                        /*For State Dropdown Load*/
                        string com = "Select RowID, ast_lvl_ast_lvl  from ast_lvl (nolock)";

                        SqlDataAdapter adpt = new SqlDataAdapter(com, con);
                        DataTable      dt   = new DataTable();
                        adpt.Fill(dt);
                        DropDownState.DataSource = dt;
                        DropDownState.DataBind();
                        DropDownState.DataTextField  = "ast_lvl_ast_lvl";
                        DropDownState.DataValueField = "RowID";
                        DropDownState.DataBind();
                        DropDownState.Items.Insert(0, new ListItem("ALL", "0"));

                        /*For District Dropdown Load*/
                        DropDownDistrict.Items.Insert(0, new ListItem("ALL", "0"));

                        /*For Circle Dropdown Load*/
                        DropDowncircle.Items.Insert(0, new ListItem("ALL", "0"));

                        /*For Clinic Cate Dropdown Load*/
                        DropDownCliniccat.Items.Insert(0, new ListItem("KESIHATAN", "1"));
                        DropDownCliniccat.Items.Insert(0, new ListItem("PERGIGIAN", "2"));
                        DropDownCliniccat.Items.Insert(0, new ListItem("ALL", "0"));

                        /*For BE Category Cate Dropdown Load*/
                        string com4 = "select ast_grp_grp_cd , ast_grp_category  from ast_grp (nolock) order by ast_grp_category ";

                        SqlDataAdapter adpt4 = new SqlDataAdapter(com4, con);
                        DataTable      dt4   = new DataTable();
                        adpt4.Fill(dt4);
                        DropDownBECate.DataSource = dt4;
                        DropDownBECate.DataBind();
                        DropDownBECate.DataTextField  = "ast_grp_category";
                        DropDownBECate.DataValueField = "ast_grp_grp_cd";
                        DropDownBECate.DataBind();
                        DropDownBECate.Items.Insert(0, new ListItem("ALL", "0"));

                        /*For BE Category Cate Dropdown Load*/
                        string com5 = "select wrk_sts_status ,wrk_sts_desc from wrk_sts (nolock) where wrk_sts_disable_flag = 0";

                        SqlDataAdapter adpt5 = new SqlDataAdapter(com5, con);
                        DataTable      dt5   = new DataTable();
                        adpt5.Fill(dt5);
                        DropDownList1.DataSource = dt5;
                        DropDownList1.DataBind();
                        DropDownList1.DataTextField  = "wrk_sts_desc";
                        DropDownList1.DataValueField = "wrk_sts_status";
                        DropDownList1.DataBind();
                        DropDownList1.Items.Insert(0, new ListItem("ALL", "0"));
                    }
                    catch (Exception ex)
                    {
                        //log error
                        //display friendly error to user
                        string msg = "Insert Error:";
                        msg += ex.Message;
                        throw new Exception(msg);
                    }
                    finally
                    {
                        con.Close();
                    }
                }
            }
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["name"] == null)
                {
                    Session["prevUrl"] = Request.Url;
                    Response.Redirect("~/loginPage.aspx");
                }
                else
                {
                    string username = Session["name"].ToString();
                    this.Label8.Text = string.Format("Hi {0}", Session["name"].ToString() + "!");
                    //Label8.Visible = false;
                    //Label8.Text = username;

                    string        connString = ConfigurationManager.ConnectionStrings["tomms_prodConnectionString"].ConnectionString;
                    SqlConnection con        = null;

                    try
                    {
                        con = new SqlConnection(connString);

                        string com01 = "select distinct  ast_loc_zone , ast_loc_zone from ast_loc (nolock)";

                        SqlDataAdapter adptzo = new SqlDataAdapter(com01, con);
                        DataTable      dtzo   = new DataTable();
                        adptzo.Fill(dtzo);
                        DropDownZone.DataSource = dtzo;
                        DropDownZone.DataBind();
                        DropDownZone.DataTextField  = "ast_loc_zone";
                        DropDownZone.DataValueField = "ast_loc_zone";
                        DropDownZone.DataBind();
                        DropDownZone.Items.Insert(0, new ListItem("ALL", "0"));


                        /*For State Dropdown Load*/
                        string com = "Select RowID, ast_lvl_ast_lvl  from ast_lvl (nolock)";

                        SqlDataAdapter adpt = new SqlDataAdapter(com, con);
                        DataTable      dt   = new DataTable();
                        adpt.Fill(dt);
                        DropDownState.DataSource = dt;
                        DropDownState.DataBind();
                        DropDownState.DataTextField  = "ast_lvl_ast_lvl";
                        DropDownState.DataValueField = "RowID";
                        DropDownState.DataBind();
                        DropDownState.Items.Insert(0, new ListItem("ALL", "0"));

                        DropDownDistrict.Items.Insert(0, new ListItem("ALL", "0"));

                        DropDownCliniccat.Items.Insert(0, new ListItem("KESIHATAN", "1"));
                        DropDownCliniccat.Items.Insert(0, new ListItem("PERGIGIAN", "2"));
                        DropDownCliniccat.Items.Insert(0, new ListItem("ALL", "0"));

                        /*For State Dropdown Load*/
                        string comown = "select distinct Ownership_desc as 'Ownership' , Ownership_desc from ownership_mst (nolock)";

                        SqlDataAdapter adptown = new SqlDataAdapter(comown, con);
                        DataTable      dtown   = new DataTable();
                        adptown.Fill(dtown);
                        DropDownownership.DataSource = dtown;
                        DropDownownership.DataBind();
                        DropDownownership.DataTextField  = "Ownership_desc";
                        DropDownownership.DataValueField = "Ownership";
                        DropDownownership.DataBind();
                        DropDownownership.Items.Insert(0, new ListItem("ALL", "0"));


                        MyReportViewer.ProcessingMode = ProcessingMode.Remote;
                        MyReportViewer.ServerReport.ReportServerUrl = new Uri("http://localhost/ReportServer");
                        MyReportViewer.ServerReport.ReportPath      = "/TSD-Performance/TSD-USM-KPIPenalty";
                        MyReportViewer.ServerReport.Refresh();
                    }
                    catch (Exception ex)
                    {
                        //log error
                        //display friendly error to user
                        string msg = "Insert Error:";
                        msg += ex.Message;
                        throw new Exception(msg);
                    }
                    finally
                    {
                        con.Close();
                    }
                }
            }
        }