Esempio n. 1
0
        private void dg_update3(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            int      ItemID = int.Parse(e.Item.Cells[0].Text);
            TextBox  tbN    = (TextBox)e.Item.FindControl("tbName3");
            CheckBox cb     = (CheckBox)e.Item.FindControl("cbIsDef");

            if (cb != null && tbN != null)
            {
                if (ItemID > 0)
                {
                    BasePlanSlot bs = BasePlanSlot.Load(ItemID);
                    bs.IsDefault = cb.Checked;
                    bs.Name      = tbN.Text;
                    BasePlanSlot.Update(bs);
                }
                else
                {
                    BasePlanSlot.Create(tbN.Text, cb.Checked);
                }
            }

            dgPlanSlot.EditItemIndex = -1;
            BindDG();
        }
Esempio n. 2
0
        void BindDropDowns()
        {
            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("tTotal") });

            ArrayList list = new ArrayList(SpreadSheetTemplateInfo.List());

            list.Sort(new SortComparer());
            ddTemplate.DataSource     = list;         //SpreadSheetTemplateInfo.List();
            ddTemplate.DataTextField  = "Name";
            ddTemplate.DataValueField = "FileName";
            ddTemplate.DataBind();

            ddDocType.DataSource     = dt;
            ddDocType.DataTextField  = "Name";
            ddDocType.DataValueField = "Id";
            ddDocType.DataBind();

            ddDocType.SelectedValue = "2";

            DataTable dt2 = new DataTable();

            dt2.Columns.Add(new DataColumn("Id", typeof(int)));
            dt2.Columns.Add(new DataColumn("Name", typeof(string)));

            foreach (BasePlan bp in BasePlan.List(ProjectId))
            {
                DataRow row = dt2.NewRow();
                row["Id"]   = bp.BasePlanSlotId;
                row["Name"] = String.Format("{0} ({1}: {2})", BasePlanSlot.Load(bp.BasePlanSlotId).Name, LocRM.GetString("LastSaved"), bp.Created);
                dt2.Rows.Add(row);
            }
            dt2.Rows.Add(new object[] { -1, LocRM.GetString("Fact") });
            dt2.Rows.Add(new object[] { 0, LocRM.GetString("Current") });

            DataView dv = dt2.DefaultView;

            dv.Sort = "Id ASC";


            ddPrimarySheet.DataSource     = dv;
            ddPrimarySheet.DataTextField  = "Name";
            ddPrimarySheet.DataValueField = "Id";
            ddPrimarySheet.DataBind();
            ddPrimarySheet.SelectedValue = "0";

            dt2.Rows.Add(new object[] { -2, LocRM.GetString("NotSelected") });

            ddSecondarySheet.DataSource     = dv;
            ddSecondarySheet.DataTextField  = "Name";
            ddSecondarySheet.DataValueField = "Id";
            ddSecondarySheet.DataBind();
            ddSecondarySheet.SelectedValue = "-2";

            tbFrom.Text = DateTime.Now.Year.ToString();
            tbTo.Text   = DateTime.Now.Year.ToString();

            BindUserValues();
        }