Ejemplo n.º 1
0
        protected void BindBasePlans()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("Name", typeof(string)));
            dt.Columns.Add(new DataColumn("BasePlanSlotId", typeof(int)));
            Hashtable ht = ProjectSpreadSheet.GetFilledSlotHash(int.Parse(Request["ProjectId"]));

            if (ht.Keys.Count <= 0)
            {
                trBasePlanFilter.Visible = false;
            }

            foreach (BasePlanSlot bps in BasePlanSlot.List())
            {
                DataRow row = dt.NewRow();

                row["BasePlanSlotId"] = bps.BasePlanSlotId;
                DateTime d_time = DateTime.MinValue;
                if (ht.Contains(bps.BasePlanSlotId))
                {
                    foreach (BasePlan bp in BasePlan.List(int.Parse(Request["ProjectId"])))
                    {
                        if (bp.BasePlanSlotId == bps.BasePlanSlotId)
                        {
                            d_time = bp.Created;
                            break;
                        }
                    }
                }
                if (d_time != DateTime.MinValue)
                {
                    row["Name"] = String.Format("{0} ({1}: {2})", bps.Name, LocRM.GetString("LastSaved"), d_time);
                }
                else
                {
                    continue;
                }
                dt.Rows.Add(row);
            }

            ddlBasePlans.DataSource     = dt;
            ddlBasePlans.DataTextField  = "Name";
            ddlBasePlans.DataValueField = "BasePlanSlotId";
            ddlBasePlans.DataBind();
            ddlBasePlans.Items.Insert(0, new ListItem(LocRM.GetString("NotSet"), "-1"));
            ddlBasePlans.SelectedValue = BasePlanSlotId.ToString();
        }
Ejemplo n.º 2
0
        void BindDropDown()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("Name", typeof(string)));
            dt.Columns.Add(new DataColumn("BasePlanSlotId", typeof(int)));

            Hashtable ht       = ProjectSpreadSheet.GetFilledSlotHash(int.Parse(Request["ProjectId"]));
            int       selvalue = -1;
            DateTime  d_time   = DateTime.Now;

            foreach (BasePlanSlot bps in BasePlanSlot.List())
            {
                if (bps.IsDefault)
                {
                    selvalue = bps.BasePlanSlotId;
                }
                DataRow row = dt.NewRow();

                row["BasePlanSlotId"] = bps.BasePlanSlotId;

                if (ht.Contains(bps.BasePlanSlotId))
                {
                    foreach (BasePlan bp in BasePlan.List(int.Parse(Request["ProjectId"])))
                    {
                        if (bp.BasePlanSlotId == bps.BasePlanSlotId)
                        {
                            d_time = bp.Created;
                            break;
                        }
                    }

                    row["Name"] = String.Format("{0} ({1}: {2})", bps.Name, LocRM.GetString("LastSaved"), d_time);
                    //row["Created"] = ht[bps.BasePlanSlotId];
                }
                else
                {
                    row["Name"] = bps.Name;
                }
                dt.Rows.Add(row);
            }

            ddBasePlan.DataSource     = dt;
            ddBasePlan.DataTextField  = "Name";
            ddBasePlan.DataValueField = "BasePlanSlotId";
            ddBasePlan.DataBind();
            ddBasePlan.SelectedValue = selvalue.ToString();
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
        private void BindDG()
        {
            if (ddDictionaries.SelectedValue == "0")            //Business Score
            {
                dgScore.Visible               = true;
                dgPlanSlot.Visible            = false;
                dgDic.Visible                 = false;
                dgEnum.Visible                = false;
                dgScore.Columns[1].HeaderText = LocRM.GetString("tKey");
                dgScore.Columns[2].HeaderText = LocRM.GetString("Name");

                dgScore.DataSource = GetTable(BusinessScore.List()).DefaultView;
                dgScore.DataBind();

                foreach (DataGridItem dgi in dgScore.Items)
                {
                    ImageButton ib = (ImageButton)dgi.FindControl("ibDelete2");
                    if (ib != null)
                    {
                        ib.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("Warning") + "')");
                    }

                    RequiredFieldValidator rf = (RequiredFieldValidator)dgi.FindControl("rfKey");
                    if (rf != null)
                    {
                        rf.ErrorMessage = LocRM.GetString("Required");
                    }

                    RequiredFieldValidator rf2 = (RequiredFieldValidator)dgi.FindControl("rfName2");
                    if (rf2 != null)
                    {
                        rf2.ErrorMessage = LocRM.GetString("Required");
                    }
                }
            }
            else if (ddDictionaries.SelectedValue == "-1")            //Base Plan Slot
            {
                dgScore.Visible    = false;
                dgDic.Visible      = false;
                dgPlanSlot.Visible = true;
                dgEnum.Visible     = false;
                dgPlanSlot.Columns[1].HeaderText = LocRM.GetString("Name");
                dgPlanSlot.Columns[2].HeaderText = LocRM.GetString("tIsDefault");

                dgPlanSlot.DataSource = GetTableSlot(BasePlanSlot.List()).DefaultView;
                dgPlanSlot.DataBind();

                foreach (DataGridItem dgi in dgPlanSlot.Items)
                {
                    ImageButton ib = (ImageButton)dgi.FindControl("ibDelete3");
                    if (ib != null)
                    {
                        ib.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("Warning") + "')");
                    }

                    RequiredFieldValidator rf3 = (RequiredFieldValidator)dgi.FindControl("rfName3");
                    if (rf3 != null)
                    {
                        rf3.ErrorMessage = LocRM.GetString("Required");
                    }
                }
            }
            else if (ddDictionaries.SelectedValue == ListManager.ListTypeEnumName)              //List Types
            {
                dgScore.Visible    = false;
                dgPlanSlot.Visible = false;
                dgDic.Visible      = false;
                dgEnum.Visible     = true;

                dgEnum.DataSource = GetListTable().DefaultView;
                dgEnum.DataBind();

                foreach (DataGridItem row in dgEnum.Items)
                {
                    ImageButton ib = (ImageButton)row.FindControl("ibDelete");
                    if (ib != null)
                    {
                        ib.Attributes.Add("onclick", "return confirm('" + GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "Delete").ToString() + "?')");
                    }
                    TextBox   tb = (TextBox)row.FindControl("txtName");
                    HtmlImage im = (HtmlImage)row.FindControl("imResourceTemplate");
                    RequiredFieldValidator rfv = (RequiredFieldValidator)row.FindControl("rfName");
                    if (im != null && tb != null && rfv != null)
                    {
                        im.Attributes.Add("onclick", "SetText('" + tb.ClientID + "','{ResourceName:ResourceKey}','" + rfv.ClientID + "')");
                    }
                }

                if (dgEnum.EditItemIndex >= 0)
                {
                    DropDownList ddl = (DropDownList)dgEnum.Items[dgEnum.EditItemIndex].FindControl("ddlOrder");
                    if (ddl != null)
                    {
                        for (int i = 1; i <= dgEnum.Items.Count; i++)
                        {
                            ddl.Items.Add(i.ToString());
                        }
                        ddl.SelectedIndex = dgEnum.EditItemIndex;
                    }
                }
            }
            else
            {
                dgScore.Visible             = false;
                dgPlanSlot.Visible          = false;
                dgDic.Visible               = true;
                dgEnum.Visible              = false;
                dgDic.Columns[1].HeaderText = LocRM.GetString("Name");
                dgDic.Columns[2].HeaderText = LocRM.GetString("tWeight");
                //dgDic.Columns[3].HeaderText = LocRM.GetString("Options");

                DictionaryTypes dic = (DictionaryTypes)Enum.Parse(typeof(DictionaryTypes), ddDictionaries.SelectedItem.Value);
                DataView        dv  = Dictionaries.GetList(dic).DefaultView;
                //			dv.Sort = "ItemName";
                dgDic.DataSource = dv;
                dgDic.DataBind();

                foreach (DataGridItem dgi in dgDic.Items)
                {
                    ImageButton ib = (ImageButton)dgi.FindControl("ibDelete");
                    if (ib != null)
                    {
                        ib.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("Warning") + "')");
                    }

                    RequiredFieldValidator rf = (RequiredFieldValidator)dgi.FindControl("rfName");
                    if (rf != null)
                    {
                        rf.ErrorMessage = LocRM.GetString("Required");
                    }
                }
            }
        }
Ejemplo n.º 6
0
        protected void btnAddNewItem_Click(object sender, System.EventArgs e)
        {
            if (ddDictionaries.SelectedValue == "0")
            {
                DataTable dt = GetTable(BusinessScore.List());

                DataRow dr = dt.NewRow();
                dr["BusinessScoreId"] = -1;
                dr["Key"]             = "";
                dr["Name"]            = "";
                dt.Rows.Add(dr);

                dgScore.EditItemIndex = dt.Rows.Count - 1;
                dgScore.DataSource    = dt.DefaultView;
                dgScore.DataBind();
            }
            else if (ddDictionaries.SelectedValue == "-1")
            {
                DataTable dt = GetTableSlot(BasePlanSlot.List());

                DataRow dr = dt.NewRow();
                dr["BasePlanSlotId"] = -1;
                dr["Name"]           = "";
                dr["IsDefault"]      = false;
                dt.Rows.Add(dr);

                dgPlanSlot.EditItemIndex = dt.Rows.Count - 1;
                dgPlanSlot.DataSource    = dt.DefaultView;
                dgPlanSlot.DataBind();
            }
            else if (ddDictionaries.SelectedValue == ListManager.ListTypeEnumName)              //List Types
            {
                DataTable dt = GetListTable();

                DataRow dr = dt.NewRow();
                dr["Id"]      = -1;
                dr["OrderId"] = dt.Rows.Count + 1;
                dr["Name"]    = "";
                dt.Rows.Add(dr);

                dgEnum.EditItemIndex = dt.Rows.Count - 1;
                dgEnum.DataSource    = dt.DefaultView;
                dgEnum.DataBind();

                DropDownList ddl = (DropDownList)dgEnum.Items[dgEnum.EditItemIndex].FindControl("ddlOrder");
                if (ddl != null)
                {
                    for (int i = 1; i <= dgEnum.Items.Count; i++)
                    {
                        ddl.Items.Add(i.ToString());
                    }
                    ddl.SelectedIndex = dgEnum.EditItemIndex;
                }
            }
            else
            {
                DictionaryTypes dic = (DictionaryTypes)Enum.Parse(typeof(DictionaryTypes), ddDictionaries.SelectedItem.Value);

                DataTable dt = Dictionaries.GetList(dic);

                DataRow dr = dt.NewRow();
                dr["ItemId"]    = -1;
                dr["ItemName"]  = "";
                dr["Weight"]    = 0;
                dr["CanDelete"] = 0;
                dt.Rows.Add(dr);

                dgDic.EditItemIndex = dt.Rows.Count - 1;
                dgDic.DataSource    = dt.DefaultView;
                dgDic.DataBind();
            }
        }