Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["name"] == null)
                {
                    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 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 Clinic Cate Dropdown Load*/
                        DropDownCliniccat.Items.Insert(0, new ListItem("Dental Delivery Units", "1"));
                        DropDownCliniccat.Items.Insert(0, new ListItem("CHAIRS, EXAMINATION/TREATMENT, DENTISTRY, SPECIALIST", "2"));
                        DropDownCliniccat.Items.Insert(0, new ListItem("Chairs, Examination/Treatment, Dentistry", "3"));
                        DropDownCliniccat.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();
                    }
                }
            }
        }
Exemplo n.º 2
0
 private void fillddl()
 {
     DropDownState.DataSource     = db.manage_state(0, "", 4);
     DropDownState.DataTextField  = "StateName";
     DropDownState.DataValueField = "StateId";
     DropDownState.DataBind();
     DropDownState.Items.Insert(0, "--Select State--");
 }
Exemplo n.º 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() + "!");

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

                    try
                    {
                        con = new SqlConnection(connString);
                        /*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("--Select--", "0"));

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

                        // MyReportViewer.ServerReport.ReportServerUrl = new Uri("http://chs015-2-3/ReportServer");
                        MyReportViewer.ServerReport.ReportServerUrl = new Uri("http://Localhost/ReportServer");
                        MyReportViewer.ServerReport.ReportPath      = "/AdditionalEB EquipmentList FORMVAR2/MEET";
                        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();
                    }
                }
            }
        }
Exemplo n.º 4
0
            private void OnDropStateChange(DropDownState state)
            {
                var dropStateChange = DropStateChange;

                if (dropStateChange != null)
                {
                    dropStateChange(state);
                }
            }
Exemplo n.º 5
0
    protected void loadstate()
    {
        if (DropDowncountry.SelectedIndex != 0)
        {
            int conutryId = Convert.ToInt32(DropDowncountry.SelectedValue);

            DataTable dt = mpDetailsBAL.loadState(conutryId);
            DropDownState.DataSource     = dt;
            DropDownState.DataTextField  = "state";
            DropDownState.DataValueField = "stateId";
            DropDownState.DataBind();
            DropDownState.Items.Insert(0, new ListItem("Select State", "0"));
            string estate = dt1.Rows[0]["state"].ToString();
            DropDownState.Items.FindByText(estate).Selected = true;
            loadconstituency();// to load and select the relevant constituency.

            DropDownpermanentState.DataSource     = dt;
            DropDownpermanentState.DataTextField  = "state";
            DropDownpermanentState.DataValueField = "stateId";
            DropDownpermanentState.DataBind();
            DropDownpermanentState.Items.Insert(0, new ListItem("Select State", "0"));
            string pstate = dt1.Rows[0]["permanentState"].ToString();
            DropDownpermanentState.Items.FindByText(pstate).Selected = true;
            loadpermanentDistrict();

            DropDowncurrentState.DataSource     = dt;
            DropDowncurrentState.DataTextField  = "state";
            DropDowncurrentState.DataValueField = "stateId";
            DropDowncurrentState.DataBind();
            DropDowncurrentState.Items.Insert(0, new ListItem("Select State", "0"));
            string cstate = dt1.Rows[0]["currentState"].ToString();
            DropDowncurrentState.Items.FindByText(cstate).Selected = true;
            loadcurrentDistrict();

            // put party in party combo box.
            dt.Dispose();
            dt = mpDetailsBAL.loadParty(conutryId);
            DropDownparty.DataSource     = dt;
            DropDownparty.DataTextField  = "partyName";
            DropDownparty.DataValueField = "partyId";
            DropDownparty.DataBind();
            DropDownparty.Items.Insert(0, new ListItem("Select Party", "0"));
            string pparty = dt1.Rows[0]["partyName"].ToString();
            DropDownparty.Items.FindByText(pparty).Selected = true;
        }
        else
        {
            DropDownState.Items.Clear();
            DropDownState.Items.Insert(0, new ListItem("Select State", "0"));
            DropDownpermanentState.Items.Clear();
            DropDownpermanentState.Items.Insert(0, new ListItem("Select State", "0"));
            DropDowncurrentState.Items.Clear();
            DropDowncurrentState.Items.Insert(0, new ListItem("Select State", "0"));
        }
    }
Exemplo n.º 6
0
        public void CloseDropDown()
        {
            if (fDropContainer == null)
            {
                return;
            }

            fDropState            = DropDownState.Closing;
            fDropContainer.Freeze = false;
            fDropContainer.Close();
        }
Exemplo n.º 7
0
        public DropDownState GetStateIDByGSTIN(string gstin)
        {
            DropDownState dropDownState = new DropDownState();
            BAL_Common    bAL_Common    = new BAL_Common();
            State         state         = new State();

            state = bAL_Common.GetStateByGSTIN(gstin);
            if (state != null)
            {
                dropDownState.text  = state.Name;
                dropDownState.Value = state.ID;
            }
            return(dropDownState);
        }
Exemplo n.º 8
0
        protected void DropDownZone_SelectedIndexChanged(object sender, EventArgs e)
        {
            string        connString = ConfigurationManager.ConnectionStrings["tomms_prodConnectionString"].ConnectionString;
            SqlConnection con        = null;

            try
            {
                con = new SqlConnection(connString);

                /*For Zone Dropdown Load*/
                if (DropDownZone.SelectedItem.Text == "ALL")
                {
                    /*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"));
                }
                else
                {
                    /*For State Dropdown Load*/
                    string com = "Select distinct Dense_rank() Over(order by ast_loc_state) as RowID, ast_loc_state as ast_lvl_ast_lvl from ast_loc (Nolock) where ast_loc_zone = '" + DropDownZone.SelectedItem.Text + "'";

                    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"));
                }
            }
            catch (Exception ex)
            {
                //log error
                //display friendly error to user
                string msg = "Insert Error:";
                msg += ex.Message;
            }
        }
Exemplo n.º 9
0
        private void dropContainer_Closed(object sender, FormClosedEventArgs e)
        {
            if (!fDropContainer.IsDisposed)
            {
                fDropContainer.DropStateChange -= dropContainer_DropStateChange;
                fDropContainer.FormClosed      -= dropContainer_Closed;
                ParentForm.Move -= ParentForm_Move;
                fDropContainer.Dispose();
            }
            fDropContainer        = null;
            fClosedWhileInControl = (RectangleToScreen(ClientRectangle).Contains(Cursor.Position));
            fDropState            = DropDownState.Closed;

            Invalidate();
        }
Exemplo n.º 10
0
        public void fillData()
        {
            DropDownState.DataTextField = objBusinessLayer.BusinessFillState().Columns[0].ToString();
            objDataTableOne             = objBusinessLayer.BusinessFillState();
            DropDownState.DataSource    = objDataTableOne;
            DropDownState.DataBind();

            DropDownPlan.DataTextField = objBusinessLayer.BusinessFillPlan().Columns[0].ToString();
            objDataTableTwo            = objBusinessLayer.BusinessFillPlan();
            DropDownPlan.DataSource    = objDataTableTwo;
            DropDownPlan.DataBind();

            Random rnd = new Random();

            lblPatientID.Text = Convert.ToString(rnd.Next(10000, 99999));
        }
Exemplo n.º 11
0
        public List <DropDownState> GetListOfStates()
        {
            BAL_Common   bAL_Common = new BAL_Common();
            List <State> stateList  = new List <State>();

            stateList = bAL_Common.GetStateListForDropDown();
            List <DropDownState> dropDownStateList = new List <DropDownState>();

            foreach (State state in stateList)
            {
                DropDownState dropDownState = new DropDownState();
                dropDownState.text  = state.Name;
                dropDownState.Value = state.ID;
                dropDownStateList.Add(dropDownState);
            }
            return(dropDownStateList);
        }
Exemplo n.º 12
0
 public void State()
 {
     cn.Open();
     //Response.Write(DropDownCountry.SelectedValue);
     using (SqlCommand cmd = new SqlCommand("select StateName,stateid from Statetable where CountryId='" + DropDownCountry.SelectedValue + "'", cn))
     {
         using (SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection))
         {
             DropDownState.DataSource = dr;
             DropDownState.Items.Clear();
             DropDownState.Items.Add("Please Select State");
             DropDownState.DataTextField  = "StateName";
             DropDownState.DataValueField = "StateId";
             DropDownState.DataBind();
         }
     }
 }
Exemplo n.º 13
0
    protected void DropDowncountry_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (DropDowncountry.SelectedIndex != 0)
        {
            int conutryId = Convert.ToInt32(DropDowncountry.SelectedValue);

            DataTable dt = mpDetailsBAL.loadState(conutryId);
            DropDownState.DataSource     = dt;
            DropDownState.DataTextField  = "state";
            DropDownState.DataValueField = "stateId";
            DropDownState.DataBind();
            DropDownState.Items.Insert(0, new ListItem("Select State", "0"));

            DropDownpermanentState.DataSource     = dt;
            DropDownpermanentState.DataTextField  = "state";
            DropDownpermanentState.DataValueField = "stateId";
            DropDownpermanentState.DataBind();
            DropDownpermanentState.Items.Insert(0, new ListItem("Select State", "0"));

            DropDowncurrentState.DataSource     = dt;
            DropDowncurrentState.DataTextField  = "state";
            DropDowncurrentState.DataValueField = "stateId";
            DropDowncurrentState.DataBind();
            DropDowncurrentState.Items.Insert(0, new ListItem("Select State", "0"));

            // put party in party combo box.
            dt.Dispose();
            dt = mpDetailsBAL.loadParty(conutryId);
            DropDownparty.DataSource     = dt;
            DropDownparty.DataTextField  = "partyName";
            DropDownparty.DataValueField = "partyId";
            DropDownparty.DataBind();
            DropDownparty.Items.Insert(0, new ListItem("Select Party", "0"));
        }
        else
        {
            DropDownState.Items.Clear();
            DropDownState.Items.Insert(0, new ListItem("Select State", "0"));
            DropDownpermanentState.Items.Clear();
            DropDownpermanentState.Items.Insert(0, new ListItem("Select State", "0"));
            DropDowncurrentState.Items.Clear();
            DropDowncurrentState.Items.Insert(0, new ListItem("Select State", "0"));
        }
    }
Exemplo n.º 14
0
        public void InitializeDropDown(Control dropDownItem)
        {
            if (fDropDownItem != null)
            {
                throw new Exception("The drop down item has already been implemented!");
            }

            fDesignView = false;
            fDropState  = DropDownState.Closed;

            Size = fAnchorSize;
            fAnchorClientBounds = new Rectangle(2, 2, fAnchorSize.Width - 21, fAnchorSize.Height - 4);

            // removes the dropDown item from the controls list so it
            // won't be seen until the drop-down window is active
            if (Controls.Contains(dropDownItem))
            {
                Controls.Remove(dropDownItem);
            }
            fDropDownItem = dropDownItem;
        }
Exemplo n.º 15
0
        protected void OpenDropDown()
        {
            if (fDropDownItem == null)
            {
                throw new NotImplementedException("The drop down item has not been initialized! Use the InitializeDropDown() method to do so.");
            }

            if (!CanDrop)
            {
                return;
            }

            fDropContainer                  = new DropDownContainer(fDropDownItem);
            fDropContainer.Bounds           = GetDropDownBounds();
            fDropContainer.DropStateChange += dropContainer_DropStateChange;
            fDropContainer.FormClosed      += dropContainer_Closed;
            ParentForm.Move                += ParentForm_Move;
            fDropState = DropDownState.Dropping;
            fDropContainer.Show(this);
            fDropState = DropDownState.Dropped;

            Invalidate();
        }
Exemplo n.º 16
0
 protected void ChooseLeague(LeagueViewModel chosenLeague)
 {
     SelectedLeague = chosenLeague;
     DropDownState.SetLeague(SelectedLeague);
 }
Exemplo n.º 17
0
 private void dropContainer_DropStateChange(DropDownState state)
 {
     fDropState = state;
 }
Exemplo n.º 18
0
 protected void ChooseCompetition(CompetitionConfigViewModel chosenCompetition)
 {
     SelectedCompetition = chosenCompetition;
     DropDownState.SetSelectedCompetition(SelectedCompetition);
 }
Exemplo n.º 19
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() + "!");

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

                    try
                    {
                        con = new SqlConnection(connString);
                        /*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("--Select--", "0"));


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

                        DropDownDocType.Items.Insert(0, new ListItem("PPM B03 & CHECKLIST", "1"));
                        //  DropDownDocType.Items.Insert(0, new ListItem("PPM CHECKLIST", "2"));//commented by muruganantham
                        DropDownDocType.Items.Insert(0, new ListItem("--Select--", "0"));

                        freq_DropDownList1.Items.Insert(0, new ListItem("--Select--", "0"));
                        freq_DropDownList1.Items.Insert(1, new ListItem("1", "1"));
                        freq_DropDownList1.Items.Insert(2, new ListItem("2", "2"));



                        string com1 = "WITH Years(No , Year) AS  ( SELECT 1, 2013 year UNION ALL  SELECT No+1,year+1 FROM  Years AS d  where   Year < Year(getdate())) SELECT No , Year FROM Years order by year desc";

                        SqlDataAdapter adpt1 = new SqlDataAdapter(com1, con);
                        DataTable      dt1   = new DataTable();
                        adpt1.Fill(dt1);
                        DropDownYear.DataSource = dt1;
                        DropDownYear.DataBind();
                        DropDownYear.DataTextField  = "Year";
                        DropDownYear.DataValueField = "No";
                        DropDownYear.DataBind();
                        DropDownYear.Items.Insert(0, new ListItem("--Select--", "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();
                    }
                }
            }
        }
Exemplo n.º 20
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();
                    }
                }
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Draw a drop-down menu for selecting among a list
        /// of items (strings).
        /// </summary>
        /// <param name="buttonRect">
        /// specifies the position and size of the
        /// button that is clicked to open the drop-down list
        /// </param>
        /// <param name="items">
        /// the list of items (strings) in the drop-down list
        /// </param>
        /// <param name="state">
        /// the current state of the drop-down list,
        /// i.e. the currently selected item and whether
        /// or not the drop-down list is expanded.
        /// </param>
        /// <param name="icon">
        /// expander icon (arrow) that is drawn
        /// on the right side of the drop-down button
        /// </param>
        /// <param name="buttonStyle">
        /// the GUIStyle for the button that opens/closes
        /// the drop-down list
        /// </param>
        /// <param name="listBackgroundStyle">
        /// The GUIStyle for the box that is drawn
        /// behind the drop-down list items.
        /// </param>
        /// <param name="listForegroundStyle">
        /// The GUIStyle for a box that is drawn
        /// on top of the drop-down list items.
        /// This style should be mostly transparent
        /// so that the individual list items
        /// are not hidden. I use this style to draw
        /// the border around the drop-down list
        /// after the individual list items have
        /// been rendered.
        /// </param>
        /// <param name="listItemStyle">
        /// the GUIStyle for the individual items
        /// in the drop-down list
        /// </param>
        /// <returns>
        /// the new state of the drop-down list
        /// </returns>
        public static DropDownState DropDownMenu(
            Rect buttonRect,
            List <string> items,
            DropDownState state,
            Texture2D icon,
            GUIStyle buttonStyle,
            GUIStyle listBackgroundStyle,
            GUIStyle listForegroundStyle,
            GUIStyle listItemStyle)
        {
            // draw drop-down button

            GUI.Label(buttonRect, items[state.selectedIndex], buttonStyle);

            // draw expander icon (arrow)

            var origColor = GUI.color;

            GUI.color = Color.black;

            const int iconMargin = 10;

            var iconAspect = (float)icon.width / icon.height;
            var iconHeight = buttonRect.height - 2 * iconMargin;
            var iconWidth  = iconAspect * iconHeight;
            var iconRect   = new Rect(
                buttonRect.x + buttonRect.width - iconMargin - iconWidth,
                buttonRect.y + iconMargin,
                iconWidth,
                iconHeight);

            GUI.DrawTexture(iconRect, icon, ScaleMode.ScaleToFit);

            GUI.color = origColor;

            // handle mouse clicks on drop-down button

            var controlID = GUIUtility.GetControlID(FocusType.Passive);

            switch (Event.current.GetTypeForControl(controlID))
            {
            case EventType.MouseDown:
                if (buttonRect.Contains(Event.current.mousePosition))
                {
                    GUIUtility.hotControl = controlID;
                    state.expanded        = !state.expanded;
                }
                break;

            case EventType.MouseUp:
                if (GUIUtility.hotControl == controlID)
                {
                    GUIUtility.hotControl = 0;
                }
                break;
            }

            // draw drop-down menu and handle mouse clicks

            if (state.expanded)
            {
                // calculate total height of drop-down list

                var listHeight = 0f;
                foreach (var item in items)
                {
                    listHeight += listItemStyle.CalcSize(new GUIContent(item)).y;
                }

                // Draw background for the list box.
                // Note that we draw the list box border separately
                // so that it does not get overwritten by the
                // individual list items.

                const float listOffset = 10;

                var listY    = buttonRect.y - listOffset - listHeight;
                var listRect = new Rect(buttonRect.x, listY, buttonRect.width, listHeight);

                GUI.Box(listRect, "", listBackgroundStyle);

                // draw individual list items and handle mouse clicks

                var y = listY;

                for (var i = 0; i < items.Count; ++i)
                {
                    var itemHeight = listItemStyle.CalcSize(
                        new GUIContent(items[i])).y;

                    var itemRect = new Rect(buttonRect.x, y, buttonRect.width, itemHeight);

                    GUI.Box(itemRect, items[i], listItemStyle);

                    switch (Event.current.GetTypeForControl(controlID))
                    {
                    case EventType.MouseDown:
                        if (itemRect.Contains(Event.current.mousePosition))
                        {
                            state.selectedIndex = i;
                            state.expanded      = false;
                        }
                        break;
                    }

                    y += itemHeight;
                }

                // Draw border around drop-down list.
                // This needs to be drawn last so that the individual list
                // items don't overwrite the border.

                GUI.Box(listRect, "", listForegroundStyle);
            }

            return(state);
        }
Exemplo n.º 22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     DropDownState.DataSource = states;
     DropDownState.DataBind();
 }
Exemplo n.º 23
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();
                    }
                }
            }
        }
Exemplo n.º 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string        connString = ConfigurationManager.ConnectionStrings["tomms_prodConnectionString"].ConnectionString;
                SqlConnection con        = null;

                try
                {
                    con = new SqlConnection(connString);
                    /*For State Dropdown Load*/
                    string com = "select Statecode , SatateDesc  from PR_location_mst (nolock)";

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

                    /*For PO Status Dropdown Load*/
                    string com1 = "select ast_grp_grp_cd ,ast_grp_general_name from ast_grp (nolock) order by ast_grp_general_name";

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

                    /*For PO Status Dropdown Load*/
                    string com2 = "select mfg_mst_mfg_cd , mfg_mst_mfg_cd as MfgDescription from mfg_mst (nolock) order by mfg_mst_mfg_cd ";

                    SqlDataAdapter adpt2 = new SqlDataAdapter(com2, con);
                    DataTable      dt2   = new DataTable();
                    adpt2.Fill(dt2);
                    Manafacturer.DataSource = dt2;
                    Manafacturer.DataBind();
                    Manafacturer.DataTextField  = "MfgDescription";
                    Manafacturer.DataValueField = "mfg_mst_mfg_cd";
                    Manafacturer.DataBind();
                    Manafacturer.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();
                }
            }
        }
Exemplo n.º 25
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 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*/

                        //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 Circle Dropdown Load*/

                        //string Com2 = "select RowID , ast_loc_circle from  ast_loc (nolock) where ast_loc_state = '" + DropDownState.SelectedItem.Text + "' and ast_loc_ast_loc = '" + DropDownDistrict.SelectedItem.Text + "'";
                        //
                        //SqlDataAdapter adpt2 = new SqlDataAdapter(Com2, con);
                        //DataTable dt2 = new DataTable();
                        //adpt2.Fill(dt2);
                        //DropDowncircle.DataSource = dt2;
                        //DropDowncircle.DataBind();
                        //DropDowncircle.DataTextField = "ast_loc_circle";
                        //DropDowncircle.DataValueField = "RowID";
                        //DropDowncircle.DataBind();
                        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 Ownership Dropdown Load*/
                        DropDownOwner.Items.Insert(0, new ListItem("Existing", "1"));
                        DropDownOwner.Items.Insert(0, new ListItem("New Biomedical", "2"));
                        DropDownOwner.Items.Insert(0, new ListItem("Purchase Biomedical", "3"));
                        DropDownOwner.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"));
                    }
                    catch (Exception ex)
                    {
                        //log error
                        //display friendly error to user
                        string msg = "Insert Error:";
                        msg += ex.Message;
                        throw new Exception(msg);
                    }
                    finally
                    {
                        con.Close();
                    }
                }
            }
        }