Esempio n. 1
0
        private void filterGv(int job)
        {
            List <int>            emID = new List <int>();
            List <EmployeeScore>  s    = new List <EmployeeScore>();
            EmployeeJobRepository ej   = new EmployeeJobRepository();
            DataTable             dt   = ej.findEmployeeByJob(job);
            EmployeeScore         ss   = new EmployeeScore();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                emID.Add(dt.Rows[i][1].ToString().ToInt());
                ss = er.getEmployeeScore(emID[i]);
                s.Add(ss);
            }
            DataTable data = new DataTable();

            data = OnlineTools.ToDataTable(s);
            gvEmployees.DataSource = data;
            gvEmployees.DataBind();
            for (int i = 0; i < data.Rows.Count; i++)
            {
                GridViewRow row   = gvEmployees.Rows[i];
                var         input = new HtmlInputGenericControl("number");
                input       = (HtmlInputGenericControl)row.FindControl("Score");
                input.Value = er.getEmployeeScore(emID[i]).Score.ToString();
            }
        }
Esempio n. 2
0
 public ExpenseMap(ExpenseType type, TextBox textActual, TextBox textPlanned, HtmlInputGenericControl slider)
 {
     Type        = type;
     TextActual  = textActual;
     TextPlanned = textPlanned;
     Slider      = slider;
 }
Esempio n. 3
0
 protected void btnSearch_ServerClick(object sender, EventArgs e)
 {
     gvEmployees.DataSource = er.searchEmployeeForScores(tbxSearch.Value);
     gvEmployees.DataBind();
     for (int i = 0; i < gvEmployees.Rows.Count; i++)
     {
         GridViewRow row   = gvEmployees.Rows[i];
         var         input = new HtmlInputGenericControl("number");
         input       = (HtmlInputGenericControl)row.FindControl("Score");
         input.Value = er.searchEmployeeForScores(tbxSearch.Value).Rows[i][6].ToString();
     }
 }
 public static double?GetMinutes(this HtmlInputGenericControl htmlInput)
 {
     if (htmlInput.Value.NotEmpty())
     {
         var vals = htmlInput.Value.Split(':').Where(x => x.Length > 0).ToList();
         if (vals.Count == 2)
         {
             return(vals[1].ToInteger());
         }
     }
     return(null);
 }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HtmlInputGenericControl rangeInput = new HtmlInputGenericControl("range")
            {
                ID = "userVal2"
            };

            rangeInput.Attributes["step"] = "5";
            rangeInput.Attributes["min"]  = "50";
            rangeInput.Attributes["max"]  = "100";
            inputContainer.Controls.Add(rangeInput);
            if (IsPostBack)
            {
                Debug.WriteLine($"Value 1:{userVal.Value}");
                Debug.WriteLine($"Value 2:{Request.Form["userVal2"]}");
            }
        }
Esempio n. 6
0
        private void fillGv()
        {
            EmployeesRepository er     = new EmployeesRepository();
            DataTable           source = er.getEmployeeForScore();

            gvEmployees.DataSource = source;
            gvEmployees.DataBind();
            int count = er.getEmployeeForScore().Rows.Count;

            for (int i = 0; i < count; i++)
            {
                GridViewRow row   = gvEmployees.Rows[i];
                var         input = new HtmlInputGenericControl("number");
                input       = (HtmlInputGenericControl)row.FindControl("Score");
                input.Value = er.getEmployeeForScore().Rows[i][6].ToString();
            }
        }
Esempio n. 7
0
 private bool Validation(TextBox tbFName, TextBox tbLName, HtmlInputGenericControl birthDate)
 {
     if (string.IsNullOrWhiteSpace(tbFName.Text))
     {
         ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Please enter First Name value');", true);
         tbFName.Focus();
         return(false);
     }
     if (string.IsNullOrWhiteSpace(tbLName.Text))
     {
         ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Please enter Last Name value');", true);
         tbLName.Focus();
         return(false);
     }
     if (string.IsNullOrWhiteSpace(birthDate.Value))
     {
         ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Please enter Date of birth ');", true);
         return(false);
     }
     return(true);
 }
Esempio n. 8
0
        protected void gv_xml_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string      Xmlpath = String.Format(Util.filePath + "User.xml");
            GridViewRow row     = gv_xml.Rows[e.RowIndex]; //获得当前行

            int numCell    = row.Cells.Count;              //共几列单元格(包含Edit和Delete 2列)
            int currentRow = row.DataItemIndex;            //对应DataSet对应的行索引

            DataSet ds = new DataSet();

            ds.ReadXml(Xmlpath);
            DataRow dr = null;

            foreach (DataRow d in ds.Tables[0].Rows)
            {
                if ((String)d["id"] == ori)
                {
                    dr = d;
                    break;
                }
            }

            String id    = ((TextBox)row.Cells[0].FindControl("Txtbox0")).Text;
            String phone = ((TextBox)row.Cells[3].FindControl("Txtbox3")).Text;

            if (id != (String)dr["id"] && Util.isUserExist(id))
            {
                Response.Write("<script   language='javascript'>alert('id已存在');</script>");
                return;
            }

            if (!Regex.IsMatch(phone, @"1\d{10}"))
            {
                Response.Write("<script   language='javascript'>alert('手机号格式错误');</script>");
                return;
            }


            string[] str = null;  //此数组定义表的列名
            str = new string[] { "id", "name", "gender", "phone",
                                 "birthday", "password" };
            int j = 0;

            TextBox myTextBox = null;

            for (int i = 0; i < 6; i++)
            {
                if (i == 4)
                {
                    HtmlInputGenericControl h = row.Cells[i].FindControl("dateText") as HtmlInputGenericControl;
                    if (h.Value != "")
                    {
                        dr[str[j]] = h.Value;
                    }
                }
                else if (i == 2)
                {
                    DropDownList ddl = row.Cells[i].FindControl("ddl") as DropDownList;
                    dr[str[j]] = ddl.SelectedItem.Text;
                }
                else
                {
                    myTextBox  = row.Cells[i].FindControl("Txtbox" + i) as TextBox;
                    dr[str[j]] = myTextBox.Text;
                }

                j++;
            }
            ds.WriteXml(Xmlpath);
            gv_xml.EditIndex = -1;
            Databind();
        }
Esempio n. 9
0
        /// <summary>
        /// Nasconde o Visualizza i campi del form cosi come da configurazione in tabella
        /// </summary>
        /// <param name="pagina"></param>
        public void showHideFields(string pagina)
        {
            DataSet DsFields       = new DataSet();
            string  nomeCampoLabel = string.Empty;
            string  nomeCampoText  = string.Empty;
            string  tipoCampo      = string.Empty;
            string  fieldContainer = string.Empty;
            bool    flagRequired   = false;
            bool    flagVisibile   = false;
            bool    flagImportant  = false;

            try
            {
                DsFields = RichiestaViaggio.showHideFields(idCliente, pagina);
                foreach (DataRow ElencoRighe in DsFields.Tables["CAMPI_NASCOSTI_CLIENTE"].Rows)
                {
                    nomeCampoLabel = "lbl" + ElencoRighe["cnc_nome_campo_nascosto"].ToString();
                    nomeCampoText  = "txt" + ElencoRighe["cnc_nome_campo_nascosto"].ToString();
                    tipoCampo      = ElencoRighe["cnc_tipo"].ToString();
                    fieldContainer = "div" + ElencoRighe["cnc_nome_campo_nascosto"].ToString();
                    flagVisibile   = Convert.ToBoolean(ElencoRighe["cnc_flag_visibile"].ToString());
                    flagRequired   = Convert.ToBoolean(ElencoRighe["cnc_flag_required"].ToString());
                    flagImportant  = Convert.ToBoolean(ElencoRighe["cnc_flag_important"].ToString());

                    Control genericLbl = new Control();
                    genericLbl = Page.FindControl(nomeCampoLabel);

                    HtmlGenericControl div = new HtmlGenericControl("div");
                    div = (HtmlGenericControl)Page.FindControl(fieldContainer);

                    TextBox genericTxt = new TextBox();
                    if (tipoCampo == "textbox" || tipoCampo == "textarea")
                    {
                        genericTxt = (TextBox)Page.FindControl(nomeCampoText);
                    }

                    DropDownList genericDdl = new DropDownList();
                    if (tipoCampo == "dropdownlist")
                    {
                        genericDdl = (DropDownList)Page.FindControl(nomeCampoText);
                    }

                    HtmlInputCheckBox genericChk = new HtmlInputCheckBox();
                    if (tipoCampo == "checkbox")
                    {
                        genericChk = (HtmlInputCheckBox)Page.FindControl(nomeCampoText);
                    }

                    HtmlInputGenericControl genericHtmlControl = new HtmlInputGenericControl();
                    if (tipoCampo == "htmlinputgenericcontrol")
                    {
                        genericHtmlControl = (HtmlInputGenericControl)Page.FindControl(nomeCampoText);
                    }

                    //Verifico se il container deve essere visibile o meno
                    if (div != null)
                    {
                        div.Visible = flagVisibile;
                    }

                    //Verifico se la Label deve essere visibile o meno
                    if (genericLbl != null)
                    {
                        genericLbl.Visible = flagVisibile;
                        ((HtmlGenericControl)genericLbl).InnerText = GetValueDizionarioUI(ElencoRighe["cnc_chiave_label"].ToString());
                    }

                    //Verifico se il campo Textbox deve essere visibile o meno
                    if (genericTxt != null)
                    {
                        genericTxt.Visible = flagVisibile;

                        if (flagRequired)
                        {
                            ((TextBox)genericTxt).CssClass += " required";
                        }

                        if (flagImportant)
                        {
                            ((TextBox)genericTxt).CssClass += " missyoImportant";
                        }
                    }

                    //Verifico se il campo DropDown deve essere visibile o meno
                    if (genericDdl != null)
                    {
                        genericDdl.Visible = flagVisibile;
                        if (flagRequired)
                        {
                            ((DropDownList)genericDdl).CssClass += " required";
                        }

                        if (flagImportant)
                        {
                            ((DropDownList)genericDdl).CssClass += " missyoImportant";
                        }
                    }

                    //Verifico se il campo HtmlGenericControl deve essere visibile o meno
                    if (genericHtmlControl != null)
                    {
                        genericHtmlControl.Visible = flagVisibile;

                        if (flagRequired)
                        {
                            ((HtmlInputGenericControl)genericHtmlControl).Attributes["class"] = ((HtmlInputGenericControl)genericHtmlControl).Attributes["class"] + " required";
                        }

                        if (flagImportant)
                        {
                            ((HtmlInputGenericControl)genericHtmlControl).Attributes.Add("class", " missyoImportant");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                // Gestione messaggistica all'utente e trace in DB dell'errore
                ExceptionPolicy.HandleException(ex, "Propagate Policy");
            }
        }
Esempio n. 10
0
    protected void Button_find_diamonds_Click(object sender, EventArgs e)
    {
        List <string> list_shapes   = new List <string>();
        List <string> list_clarity  = new List <string>();
        List <string> list_color    = new List <string>();
        List <string> list_cut      = new List <string>();
        List <string> list_polish   = new List <string>();
        List <string> list_symmetry = new List <string>();
        List <string> list_lab      = new List <string>();
        double        weightMin;
        double        weightMax;
        double        priceMin;
        double        priceMax;
        string        name;


        #region SHAPE
        List <string> list_shapes_ = s.readfromyDS("Shape");
        foreach (var S in list_shapes_)
        {
            var chk_SHAPE = (HtmlInputCheckBox)SAHPE.FindControl("ShapeCB_" + S.ToString());


            if (chk_SHAPE.Checked == true)
            {
                list_shapes.Add(S.ToString());
            }
        }


        #endregion

        #region Weight

        HtmlInputGenericControl weightMin_control = (HtmlInputGenericControl)WEIGHT.FindControl("weightMin");
        if (weightMin_control.Value == "".ToString())
        {
            weightMin_control.Value = "0.1";
        }
        weightMin = Convert.ToDouble(weightMin_control.Value);

        HtmlInputGenericControl weightMax_control = (HtmlInputGenericControl)WEIGHT.FindControl("weightMax");
        if (weightMax_control.Value == "".ToString())
        {
            weightMax_control.Value = "0.1";
        }
        weightMax = Convert.ToDouble(weightMax_control.Value);

        #endregion

        #region Price

        HtmlInputGenericControl priceMin_control = (HtmlInputGenericControl)WEIGHT.FindControl("priceMin");
        if (priceMin_control.Value == "".ToString())
        {
            priceMin_control.Value = "1";
        }
        priceMin = Convert.ToDouble(priceMin_control.Value.ToString());

        HtmlInputGenericControl priceMax_control = (HtmlInputGenericControl)WEIGHT.FindControl("priceMax");
        if (priceMax_control.Value == "".ToString())
        {
            priceMax_control.Value = "1";
        }
        priceMax = Convert.ToDouble(priceMax_control.Value.ToString());

        #endregion

        #region CLARITY
        List <string> list_clarity_ = s.readfromyDS("Clarity");
        foreach (var C in list_clarity_)
        {
            CheckBox chk_CLARITY = (CheckBox)CLARITY.FindControl("ClarityCB_" + C.ToString());
            if (chk_CLARITY.Checked == true)
            {
                list_clarity.Add(C.ToString());
            }
        }

        #endregion

        #region COLOR
        List <string> list_color_ = s.readfromyDS("Color");
        foreach (var CR in list_color_)
        {
            CheckBox chk_COLOR = (CheckBox)COLOR.FindControl("ColorCB_" + CR.ToString());
            if (chk_COLOR.Checked == true)
            {
                list_color.Add(CR.ToString());
            }
        }

        #endregion

        #region CUT
        List <string> list_cut_ = s.readfromyDS("Cut");
        foreach (var CU_ in list_cut_)
        {
            CheckBox chk_CUT = (CheckBox)CUT.FindControl("CutCB_" + CU_.ToString());
            if (chk_CUT.Checked == true)
            {
                list_cut.Add(CU_.ToString());
            }
        }
        #endregion

        #region POLISH
        List <string> list_polish_ = s.readfromyDS("Polish");
        foreach (var P in list_polish_)
        {
            CheckBox chk_P = (CheckBox)POLISH.FindControl("PolishCB_" + P.ToString());
            if (chk_P.Checked == true)
            {
                list_polish.Add(P.ToString());
            }
        }
        #endregion

        #region SYMMETRY
        List <string> list_symmetry_ = s.readfromyDS("Symmetry");
        foreach (var SYM in list_symmetry_)
        {
            CheckBox chk_SYM = (CheckBox)SYMMETRY.FindControl("SymmetryCB_" + SYM.ToString());
            if (chk_SYM.Checked == true)
            {
                list_symmetry.Add(SYM.ToString());
            }
        }

        #endregion

        #region LAB
        List <string> list_lab_ = s.readfromyDS("Lab");
        foreach (var LAB_ in list_lab_)
        {
            CheckBox chk_LAB = (CheckBox)LAB.FindControl("LabCB_" + LAB_.ToString());
            if (chk_LAB.Checked == true)
            {
                list_lab.Add(LAB_.ToString());
            }
        }

        #endregion

        #region Name

        HtmlInputText txt_name = (HtmlInputText)NAME.FindControl("Search_By_ID".ToString());
        name = txt_name.Value;

        #endregion

        addproducts_after_filter(list_shapes,
                                 list_clarity,
                                 list_color,
                                 list_cut,
                                 list_polish,
                                 list_symmetry,
                                 list_lab,
                                 weightMin,
                                 weightMax,
                                 priceMin,
                                 priceMax,
                                 name);
    }