コード例 #1
0
ファイル: BudTaskEdit.aspx.cs プロジェクト: zxl881203/src
    protected void btnSave_Click(object sender, System.EventArgs e)
    {
        string value = this.txtQuantity.Text.Trim();
        string text  = string.Empty;
        string text2 = string.Empty;

        if (string.IsNullOrEmpty(value))
        {
            base.RegisterScript("alert('工程量必须输入');");
            this.txtQuantity.Focus();
            return;
        }
        if (this.hfldIsWBSRelevance.Value == "0" && base.Request["page"].ToString() != "BudTemplateList.aspx" && string.IsNullOrEmpty(this.txtUnitPrice.Text.Trim()))
        {
            base.RegisterScript("alert('综合单价必须输入');");
            this.txtUnitPrice.Focus();
            return;
        }
        if (this.hfldIsWBSRelevance.Value == "0" && base.Request["page"].ToString() != "BudTemplateList.aspx")
        {
            text  = System.Convert.ToDecimal(this.txtUnitPrice.Text.Trim()).ToString();
            text2 = System.Convert.ToDecimal(this.txtTotal.Value.Trim()).ToString();
        }
        string text3     = this.txtTaskCode.Text.Trim();
        bool   flag      = false;
        string text4     = base.Request["type"];
        string arg_14E_0 = base.Request["isBudTask"];

        if (this.ViewState["oldCode"] != null)
        {
            this.ViewState["oldCode"].ToString();
        }
        else
        {
            string arg_17E_0 = string.Empty;
        }
        if (flag)
        {
            base.RegisterScript("top.ui.alert('清单编码不能重复');");
            this.txtTaskCode.Focus();
            return;
        }
        string text5     = System.Guid.NewGuid().ToString();
        string text6     = this.txtTaskName.Text.Trim();
        string text7     = this.txtStartDate.Text;
        string text8     = this.txtEndDate.Text;
        string text9     = this.txtUnit.Text.Trim();
        string arg_1F9_0 = this.ddlTaskType.SelectedValue;
        string text10    = this.txtNote.Text.Trim();
        string text11    = this.txtConstructionPeriod.Text.Trim();
        string text12    = this.txtDescription.Text.Trim();
        string a         = base.Request["page"];

        if (a == "BudgetPlaitList.aspx")
        {
            BudTaskService budTaskService = new BudTaskService();
            string         text13         = string.Empty;
            text13 = base.Request["prjId"];
            string text14 = base.Request["id"];
            cn.justwin.Domain.Entities.BudTask budTask;
            if (text4.ToLower() == "edit")
            {
                budTask = budTaskService.GetById(text14);
            }
            else
            {
                budTask             = new cn.justwin.Domain.Entities.BudTask();
                budTask.TaskId      = text5;
                budTask.OrderNumber = cn.justwin.Domain.BudTask.GetOrderNumber(text13, text14);
                if (string.IsNullOrEmpty(text14))
                {
                    budTask.ParentId = null;
                }
                else
                {
                    budTask.ParentId = text14;
                }
                budTask.PrjId     = text13;
                budTask.InputUser = base.UserCode;
                budTask.InputDate = System.DateTime.Now;
                budTask.IsValid   = new bool?(true);
                budTask.Version   = new int?(1);
                budTask.Modified  = null;
            }
            budTask.TaskCode = text3;
            budTask.TaskName = text6;
            System.DateTime?startDate = null;
            if (!string.IsNullOrEmpty(text7))
            {
                startDate = new System.DateTime?(System.Convert.ToDateTime(text7));
            }
            budTask.StartDate = startDate;
            System.DateTime?endDate = null;
            if (!string.IsNullOrEmpty(text8))
            {
                endDate = new System.DateTime?(System.Convert.ToDateTime(text8));
            }
            budTask.EndDate = endDate;
            if (!string.IsNullOrEmpty(value))
            {
                budTask.Quantity = new decimal?(System.Convert.ToDecimal(value));
            }
            if (!string.IsNullOrEmpty(text))
            {
                budTask.UnitPrice = new decimal?(System.Convert.ToDecimal(text));
            }
            if (!string.IsNullOrEmpty(text2))
            {
                budTask.Total = new decimal?(System.Convert.ToDecimal(text2));
            }
            budTask.Unit = text9;
            budTask.Note = text10;
            if (!string.IsNullOrEmpty(text11))
            {
                budTask.ConstructionPeriod = new int?(System.Convert.ToInt32(text11));
            }
            budTask.TaskType           = "";
            budTask.FeatureDescription = this.txtDescription.Text.Trim();
            if (text4.ToLower() == "edit")
            {
                budTaskService.Update(budTask);
            }
            else
            {
                budTaskService.Add(budTask);
            }
            string str  = "resetData();";
            string str2 = "top.ui.winSuccess({ parentName: '_BudTaskEdit' });";
            base.RegisterScript(str + str2);
        }
        if (a == "BudTemplateList.aspx")
        {
            string message = string.Concat(new string[]
            {
                "closeDial('",
                text3,
                "','",
                text6,
                "','",
                text9,
                "','",
                System.Convert.ToDecimal(value).ToString(),
                "','",
                text10,
                "','",
                this.ddlTaskType.SelectedItem.Text,
                "','",
                text7,
                "','",
                text8,
                "','",
                text,
                "','",
                text2,
                "','",
                text11,
                "','",
                text5,
                "','",
                text12,
                "');"
            });
            string str3 = "/BudgetManage/Template/BudTemplateList.aspx?tempId=" + this.hfldTempId.Value;
            //"top.ui.winSuccess({ parentName: '_BudTaskEdit',url:" + str3 + " });";
            base.RegisterScript(message);
        }
    }
コード例 #2
0
ファイル: BudModifyAudit.cs プロジェクト: zxl881203/src
        public void CommitEvent(object key)
        {
            BudModifyService       service  = new BudModifyService();
            BudTaskService         service2 = new BudTaskService();
            BudModifyTaskService   service3 = new BudModifyTaskService();
            BudTaskResourceService service4 = new BudTaskResourceService();
            ConPayoutModifyService service5 = new ConPayoutModifyService();
            string    modifyId  = key.ToString();
            BudModify budmodify = (from r in service
                                   where r.ModifyId == modifyId
                                   select r).FirstOrDefault <BudModify>();
            ConPayoutModify item = (from r in service5
                                    where r.BudModifyId == modifyId
                                    select r).FirstOrDefault <ConPayoutModify>();

            if (item != null)
            {
                item.FlowState = 1;
                service5.Update(item);
            }
            using (List <BudModifyTask> .Enumerator enumerator = (from p in service3
                                                                  where p.ModifyId == budmodify.ModifyId
                                                                  select p).ToList <BudModifyTask>().GetEnumerator())
            {
                BudModifyTask taskx;
                while (enumerator.MoveNext())
                {
                    taskx = enumerator.Current;
                    cn.justwin.Domain.Entities.BudTask task = (from p in service2
                                                               where p.TaskId == taskx.TaskId
                                                               select p).FirstOrDefault <cn.justwin.Domain.Entities.BudTask>();
                    if ((task != null) && (budmodify.Flowstate == 1))
                    {
                        if (taskx.ModifyType == 0)
                        {
                            task.IsValid = true;
                            service2.Update(task);
                            service3.UpdateTotal2(taskx.ModifyTaskId);
                        }
                        if ((task.ModifyId != task.ModifyId) || (taskx.ModifyType == 1))
                        {
                            task.ModifyId = task.ModifyId;
                            if (!task.Total2.HasValue)
                            {
                                task.Total2 = 0;
                            }
                            if (!task.Quantity.HasValue)
                            {
                                task.Quantity = 0;
                            }
                            task.Total2   = new decimal?(Convert.ToDecimal(task.Total2) + Convert.ToDecimal(task.Total2));
                            task.Quantity = new decimal?(Convert.ToDecimal(task.Quantity) + Convert.ToDecimal(task.Quantity));
                            if (task.Quantity != 0M)
                            {
                                task.UnitPrice = task.Total2 / task.Quantity;
                            }
                            service2.Update(task);
                            service3.UpdateTotal2(taskx.ModifyTaskId);
                        }
                    }
                }
            }
            if (ConfigHelper.Get("BudgetRequireDiff") != "0")
            {
                string    str2 = ConfigHelper.Get("IsWBSRelevance");
                BudModify byId = service.GetById(key.ToString());
                service2.DeleteYearMonthByPrj(byId.PrjId);
                IList <cn.justwin.Domain.Entities.BudTask> byProject = service2.GetByProject(byId.PrjId, 0x3e7);
                IList <int> years = service2.GetYears(byId.PrjId);
                if (years != null)
                {
                    foreach (int num in years)
                    {
                        IList <cn.justwin.Domain.Entities.BudTask> yearTask = service2.GetYearTask(byProject, num);
                        foreach (cn.justwin.Domain.Entities.BudTask task2 in yearTask)
                        {
                            service2.Add(task2);
                        }
                        foreach (int num2 in service2.GetMonths(yearTask, num))
                        {
                            foreach (cn.justwin.Domain.Entities.BudTask task3 in service2.GetMonthTasks(yearTask, num, num2))
                            {
                                service2.Add(task3);
                            }
                        }
                    }
                    if (str2 == "1")
                    {
                        service4.AddTaskResource(byId.PrjId);
                    }
                }
            }
        }