private void BindInitialValues() { ddPrjGroup.DataSource = ProjectGroup.GetProjectGroups(); ddPrjGroup.DataTextField = "Title"; ddPrjGroup.DataValueField = "ProjectGroupId"; ddPrjGroup.DataBind(); ddPrjGroup.Items.Insert(0, new ListItem(LocRM.GetString("AllFem"), "0")); ddPrjGroup.Items.Add(new ListItem(LocRM.GetString("tCustom"), "-1")); switch (ProjectListType) { case "All": if (ddPrjGroup.Items.FindByValue("0") != null) { ddPrjGroup.SelectedValue = "0"; } break; case "Custom": if (ddPrjGroup.Items.FindByValue("-1") != null) { ddPrjGroup.SelectedValue = "-1"; } break; case "Portfolio": if (ddPrjGroup.Items.FindByValue(ProjectListData) != null) { ddPrjGroup.SelectedValue = ProjectListData; } break; } DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("Id", typeof(int))); dt.Columns.Add(new DataColumn("Name", typeof(string))); dt.Rows.Add(new object[] { 1, LocRM.GetString("tWeekYear") }); dt.Rows.Add(new object[] { 2, LocRM.GetString("tMonthQuarterYear") }); dt.Rows.Add(new object[] { 3, LocRM.GetString("tQuarterYear") }); dt.Rows.Add(new object[] { 4, LocRM.GetString("tYear") }); dt.Rows.Add(new object[] { 5, LocRM.GetString("tTotalSum") }); ddFinanceType.DataSource = dt; ddFinanceType.DataTextField = "Name"; ddFinanceType.DataValueField = "Id"; ddFinanceType.DataBind(); ddFinanceType.SelectedValue = FinanceType; DataTable dt1 = new DataTable(); dt1.Columns.Add(new DataColumn("Id", typeof(int))); dt1.Columns.Add(new DataColumn("Name", typeof(string))); foreach (BasePlanSlot bps in BasePlanSlot.List()) { DataRow dr = dt1.NewRow(); dr["Id"] = bps.BasePlanSlotId; dr["Name"] = bps.Name; dt1.Rows.Add(dr); } dt1.Rows.Add(new object[] { "-1", LocRM.GetString("tFact") }); dt1.Rows.Add(new object[] { "0", LocRM.GetString("tCurrent") }); DataView dv = dt1.DefaultView; dv.Sort = "Id ASC"; ddBasePlan1.DataSource = dv; ddBasePlan1.DataTextField = "Name"; ddBasePlan1.DataValueField = "Id"; ddBasePlan1.DataBind(); ddBasePlan1.SelectedValue = BasePlan1.ToString(); dt1.Rows.Add(new object[] { "-2", LocRM.GetString("tNotSelected") }); dv = dt1.DefaultView; dv.Sort = "Id ASC"; ddBasePlan2.DataSource = dv; ddBasePlan2.DataTextField = "Name"; ddBasePlan2.DataValueField = "Id"; ddBasePlan2.DataBind(); ddBasePlan2.SelectedValue = BasePlan2.ToString(); tbFromYear.Text = FromYear.ToString(); tbToYear.Text = ToYear.ToString(); ddGroupBy.Items.Clear(); ddGroupBy.Items.Add(new ListItem(LocRM.GetString("tByProject"), "false")); ddGroupBy.Items.Add(new ListItem(LocRM.GetString("tByBusinessScore"), "true")); ddGroupBy.SelectedValue = Reverse.ToString().ToLower(); }
private void BindInitialValues() { ddPrjGroup.DataSource = ProjectGroup.GetProjectGroups(); ddPrjGroup.DataTextField = "Title"; ddPrjGroup.DataValueField = "ProjectGroupId"; ddPrjGroup.DataBind(); ddPrjGroup.Items.Insert(0, new ListItem(LocRM.GetString("AllFem"), "0")); ddPrjGroup.Items.Add(new ListItem(LocRM.GetString("tCustom"), "-1")); switch (ProjectListType) { case "All": if (ddPrjGroup.Items.FindByValue("0") != null) { ddPrjGroup.SelectedValue = "0"; } break; case "Custom": if (ddPrjGroup.Items.FindByValue("-1") != null) { ddPrjGroup.SelectedValue = "-1"; } break; case "Portfolio": if (ddPrjGroup.Items.FindByValue(ProjectListData) != null) { ddPrjGroup.SelectedValue = ProjectListData; } break; } DataTable dt1 = new DataTable(); dt1.Columns.Add(new DataColumn("Id", typeof(int))); dt1.Columns.Add(new DataColumn("Name", typeof(string))); foreach (BasePlanSlot bps in BasePlanSlot.List()) { DataRow dr = dt1.NewRow(); dr["Id"] = bps.BasePlanSlotId; dr["Name"] = bps.Name; dt1.Rows.Add(dr); } dt1.Rows.Add(new object[] { "-2", LocRM.GetString("tNotSelected") }); DataView dv = dt1.DefaultView; dv.Sort = "Id ASC"; ddBasePlan.DataSource = dv; ddBasePlan.DataTextField = "Name"; ddBasePlan.DataValueField = "Id"; ddBasePlan.DataBind(); ddBasePlan.SelectedValue = BasePlan2.ToString(); DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("Id", typeof(int))); dt.Columns.Add(new DataColumn("Name", typeof(string))); foreach (BasePlanSlot bps in BasePlanSlot.List()) { DataRow dr = dt.NewRow(); dr["Id"] = bps.BasePlanSlotId; dr["Name"] = bps.Name; dt.Rows.Add(dr); } dt.Rows.Add(new object[] { "0", LocRM.GetString("tCurrent") }); dv = dt.DefaultView; dv.Sort = "Id ASC"; ddOrBasePlan.DataSource = dv; ddOrBasePlan.DataTextField = "Name"; ddOrBasePlan.DataValueField = "Id"; ddOrBasePlan.DataBind(); ddOrBasePlan.SelectedValue = BasePlan1.ToString(); }