Example #1
0
        private void LoadDayUnregistered()
        {
            DAYS dia = DaysDao.getDay(int.Parse(Request["Day"]));

            if (dia != null)
            {
                int contador2 = 1;
                int contador3 = 0;
                //if (diaReported != null && diaReported.REPORT_DAY != null && diaReported.REPORT_DAY.Count > 0)
                //{
                //    contador3 += diaReported.REPORT_DAY.Count;
                //    contador2 += diaReported.REPORT_DAY.Count;
                //}
                List <DAYS_CONFIG> listado = dia.DAYS_CONFIG.ToList();
                if (contador2 <= listado.Count)
                {
                    for (int i = contador3; i < listado.Count; i++)
                    {
                        Label lbl = (Label)FindControl("lblReport" + contador2);
                        lbl.Text = listado[i].name;

                        HtmlGenericControl divPanel = (HtmlGenericControl)FindControl("div" + contador2);
                        divPanel.Style.Remove("display");

                        DropDownList ddl = (DropDownList)FindControl("ddlDataTypeReport" + contador2);
                        ddl.Items.Insert(0, listado[i].dataType);

                        TextBox txt = (TextBox)FindControl("txtReport" + contador2);
                        switch (listado[i].dataType)
                        {
                        case "Time":
                            txt.CssClass = "validateTime";
                            break;

                        case "Integer":
                            txt.CssClass  = "validateOnlyNumber";
                            txt.MaxLength = 4;
                            break;

                        case "Broken/Unbroken":
                            txt.CssClass  = "validateOnlyBOrU";
                            txt.MaxLength = 1;
                            break;
                        }
                        contador2++;
                    }
                }
                int otroCont = 1;
                for (int k = 0; k < listado.Count; k++)
                {
                    Label lblDesc = (Label)FindControl("lblDescReport" + otroCont);
                    lblDesc.Text = listado[k].description;
                    otroCont++;
                }
                //foreach (DAYS_CONFIG confDay in dia.DAYS_CONFIG)
                //{

                //}
            }
        }
Example #2
0
        private void LoadDayRegisteredToBeModified()
        {
            DAYS diaReported = DaysDao.getDay(int.Parse(Request["Day"]));

            if (diaReported != null)
            {
                hdIdDayConfigured.Value   = diaReported.idDay.ToString();
                txtDateOfDay.Text         = ((DateTime)diaReported.completeDay).ToString("dd/MM/yyyy");
                ddlStateDay.SelectedValue = diaReported.state;
                int cont = 1;
                if (diaReported.DAYS_CONFIG != null && diaReported.DAYS_CONFIG.Count > 0)
                {
                    foreach (DAYS_CONFIG confDay in diaReported.DAYS_CONFIG)
                    {
                        HiddenField hdField = (HiddenField)FindControl("hdReport" + cont);
                        hdField.Value = confDay.idReportNum.ToString();

                        CheckBox cbField = (CheckBox)FindControl("CheckBox" + cont);
                        cbField.Checked = true;
                        cbField.Enabled = false;

                        TextBox lbl = (TextBox)FindControl("txtReport" + cont);
                        lbl.Text = confDay.name;

                        DropDownList ddl = (DropDownList)FindControl("ddlDataTypeReport" + cont);
                        ddl.SelectedValue = confDay.dataType;

                        TextBox txtDesc = (TextBox)FindControl("txtDescription" + cont);
                        txtDesc.Text = confDay.description;

                        HtmlAnchor anchorDel = (HtmlAnchor)FindControl("anchorDelete" + cont);
                        anchorDel.Visible = true;
                        anchorDel.HRef    = "javascript:DeleteExercise(" + confDay.idReportNum.ToString() + ");";

                        cont++;
                    }
                }
            }
        }
Example #3
0
        private void ArmarTable()
        {
            //DAYS excerciseForDay = DaysDao.getDay(int.Parse(ddlDay.SelectedValue));
            DAYS excerciseForDay = DaysDao.getDay(1);

            if (Users != null)
            {
                DataTable tabla = new DataTable("Usuarios");

                DataColumn dtColumnIdUser = new DataColumn("idUser");
                tabla.Columns.Add(dtColumnIdUser);

                DataColumn dtName = new DataColumn("name");
                tabla.Columns.Add(dtName);

                DataColumn dtAge = new DataColumn("age");
                tabla.Columns.Add(dtAge);
                DataColumn dtGender = new DataColumn("gender");
                tabla.Columns.Add(dtGender);
                DataColumn dtNationality = new DataColumn("nationality");
                tabla.Columns.Add(dtNationality);
                DataColumn dtEmail = new DataColumn("email");
                tabla.Columns.Add(dtEmail);
                DataColumn dtPass = new DataColumn("pass");
                tabla.Columns.Add(dtPass);
                DataColumn dtHades = new DataColumn("hades_pb");
                tabla.Columns.Add(dtHades);
                DataColumn dtPoseidon = new DataColumn("poseidon_pb");
                tabla.Columns.Add(dtPoseidon);
                DataColumn dtVenus = new DataColumn("venus_pb");
                tabla.Columns.Add(dtVenus);

                if (excerciseForDay != null && excerciseForDay.DAYS_CONFIG != null && excerciseForDay.DAYS_CONFIG.Count > 0)
                {
                    List <DAYS_CONFIG> excer = excerciseForDay.DAYS_CONFIG.ToList();
                    for (int i = 0; i < excer.Count; i++)
                    {
                        DataColumn column = new DataColumn(excer[i].name + " " + excer[i].dataType);

                        BoundField columna = new BoundField();
                        columna.DataField      = excer[i].name + " " + excer[i].dataType;
                        columna.HeaderText     = excer[i].name + " " + excer[i].dataType;
                        columna.SortExpression = excer[i].name + " " + excer[i].dataType;
                        gvUsuarios.Columns.Add(columna);

                        tabla.Columns.Add(column);
                    }
                }


                for (int j = 0; j < Users.Count; j++)
                {
                    DataRow dw = tabla.NewRow();
                    dw.SetField("idUser", Users[j].idUser);
                    dw.SetField("name", Users[j].name);
                    dw.SetField("age", Users[j].age);
                    dw.SetField("gender", Users[j].gender);
                    dw.SetField("nationality", Users[j].nationality);
                    dw.SetField("email", Users[j].email);
                    dw.SetField("pass", Users[j].pass);
                    dw.SetField("hades_pb", Users[j].hades_pb);
                    dw.SetField("poseidon_pb", Users[j].poseidon_pb);
                    dw.SetField("venus_pb", Users[j].venus_pb);
                    //if (Users[j].DAYS_REPORT != null && Users[j].DAYS_REPORT.Count > 0)
                    //{
                    DAYS_REPORT diaSolicitado = UserDao.getDiaReportado(Users[j].idUser, 1);
                    if (diaSolicitado != null)
                    {
                        List <REPORT_DAY> diasReportados = DaysDao.getDiasReportados(diaSolicitado.idRegister);
                        for (int i = 0; i < diasReportados.Count; i++)
                        {
                            dw.SetField(diasReportados[i].Name + " " + diasReportados[i].DataInform, diasReportados[i].Inform);
                        }
                    }
                    //}
                    tabla.Rows.Add(dw);
                }

                //TablaUsuarios = tabla;
                //gvUsuarios.DataSource = TablaUsuarios;
                //gvUsuarios.DataBind();
            }
        }