Esempio n. 1
0
 public static List <SubCodeVm> GetAllSubCode(string generalId)
 {
     return(MgrSub.GetAllSubCode(generalId, (int)Utils.GetLanguage()));
 }
Esempio n. 2
0
        protected void CreateRadioBtn(object sender, EventArgs e)
        {
            var variables = MgrVariable.GetVariables(RunningVariableDrp.SelectedValue, ChangingVariableDrp.SelectedValue, string.IsNullOrEmpty(ddlThemes.SelectedValue)?0: int.Parse(ddlThemes.SelectedValue), (int)Utils.GetLanguage());

            i = variables.Count;
            ReportVM result;

            if (Request.QueryString["RepId"] != null)
            {
                result = MgrReports.GetReportsByID(int.Parse(Request.QueryString["RepId"]), (int)Utils.GetLanguage());
            }
            else
            {
                result = null;
            }
            object       sub;
            PropertyInfo propertyInfo;

            if (variables.Count > 0)
            {
                var subcode = MgrSubCode.GetAllSubCode(variables[0].VariableID, (int)Utils.GetLanguage());
                for (int x = 0; x < variables.Count; x++)
                {
                    SelectLbl.Visible = true;
                    subcode           = MgrSubCode.GetAllSubCode(variables[x].GeneralID, (int)Utils.GetLanguage());


                    RadioButtonList VariablesRadio = new RadioButtonList();
                    ListItem        item1;
                    item1 = new ListItem(variables[x].GeneralName, variables[x].VariableColumnName);
                    ListItem item2;
                    item2 = new ListItem("All", variables[x].VariableColumnName);
                    VariablesRadio.Items.Add(item1);
                    VariablesRadio.Items.Add("unselect");
                    VariablesRadio.ID = "VariablesRadio" + x;
                    VariablesRadio.RepeatDirection       = RepeatDirection.Horizontal;
                    VariablesRadio.SelectedIndexChanged += this.VariablesRadio_SelectedIndexChanged;
                    VariablesRadio.AutoPostBack          = true;
                    VariablesRadio.Font.Bold             = true;
                    VariablesRadio.ForeColor             = Color.DarkBlue;

                    RadioButtonList VariablesValueRadio = new RadioButtonList();
                    foreach (var item in subcode)
                    {
                        VariablesValueRadio.Items.Add(new ListItem(item.Name, item.SubID));
                    }
                    //  VariablesValueRadio.DataSource = subcode;
                    //  VariablesValueRadio.DataTextField = "Name";
                    // VariablesValueRadio.DataValueField = "SubID";
                    VariablesValueRadio.ID = "VariablesValueChck" + x;
                    VariablesValueRadio.RepeatDirection = RepeatDirection.Horizontal;
                    VariablesValueRadio.RepeatColumns   = 5;
                    VariablesValueRadio.CellPadding     = 10;
                    //  VariablesValueRadio.DataBind();
                    VariablesValueRadio.Visible = false;
                    TableCell tcell = new TableCell();
                    if (result != null)
                    {
                        propertyInfo = result.GetType().GetProperty(variables[x].VariableColumnName);
                        sub          = propertyInfo.GetValue(result, null);



                        if (sub != null)
                        {
                            if (sub.ToString().Substring(0, 3) == variables[x].GeneralID)
                            {
                                VariablesRadio.SelectedValue = variables[x].VariableColumnName;

                                VariablesValueRadio.SelectedValue = sub.ToString();

                                VariablesValueRadio.Visible = true;
                            }
                        }
                    }
                    tcell.Controls.Add(VariablesRadio);
                    tcell.Controls.Add(VariablesValueRadio);

                    TableRow tr = new TableRow();
                    tr.Cells.Add(tcell);
                    Table1.Rows.Add(tr);
                    Table1.DataBind();
                }
            }
        }