Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            A_ChargeProgres ent = null;

            switch (RequestActionString)
            {
            case "delete":
                ent = this.GetTargetData <A_ChargeProgres>();
                ent.DoDelete();
                break;

            case "batchdelete":
                DoBatchDelete();
                break;

            case "charge":
                A_TaskWBS[] charges = A_TaskWBS.FindAll(Expression.Eq(A_TaskWBS.Prop_ParentID, this.RequestData.Get <string>("TaskId")), Expression.Not(Expression.Eq(A_TaskWBS.Prop_State, "2")));
                if (charges.Length > 0)
                {
                    PageState.Add("Finish", "false");
                }
                else
                {
                    PageState.Add("Finish", "true");
                }
                break;

            default:
                DoSelect();
                break;
            }
        }
        string type = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");

            A_ChargeProgres ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <A_ChargeProgres>();
                ent.DoUpdate();
                A_TaskWBS tb = A_TaskWBS.Find(ent.TaskId);
                tb.TaskProgress = float.Parse(ent.Progress);

                /*if (int.Parse(tb.TaskProgress.ToString()).Equals(100))
                 * {
                 *  tb.State = "2";
                 *  tb.FactEndDate = ent.CreateTime;
                 * }
                 * else
                 *  tb.State = "1";*/
                tb.Save();
                CalculateRates(tb);
                this.SetMessage("修改成功!");
                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent            = this.GetPostedData <A_ChargeProgres>();
                ent.CreateId   = this.UserInfo.UserID;
                ent.CreateName = this.UserInfo.Name;
                ent.CreateTime = DateTime.Now;
                ent.DoCreate();
                A_TaskWBS tb1 = A_TaskWBS.Find(ent.TaskId);
                tb1.TaskProgress = float.Parse(ent.Progress);

                /*if (int.Parse(tb1.TaskProgress.ToString()).Equals(100))
                 * {
                 *  tb1.State = "2";
                 *  tb1.FactEndDate = ent.CreateTime;
                 * }
                 * else
                 *  tb1.State = "1";*/
                tb1.Save();
                CalculateRates(tb1);
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <A_ChargeProgres>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                return;

            default:
                if (RequestActionString == "charge")
                {
                    A_TaskWBS[] charges = A_TaskWBS.FindAll(Expression.Eq(A_TaskWBS.Prop_ParentID, this.RequestData.Get <string>("TaskId")), Expression.Not(Expression.Eq(A_TaskWBS.Prop_State, "2")));
                    if (charges.Length > 0)
                    {
                        this.PageState.Add("Finish", "false");
                    }
                    else
                    {
                        this.PageState.Add("Finish", "true");
                    }
                }
                break;
            }

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = A_ChargeProgres.Find(id);
                }

                this.SetFormData(ent);
            }
            else
            {
                this.PageState.Add("TaskModel", A_TaskWBS.Find(this.RequestData.Get <string>("TaskId")));
            }
        }