Ejemplo n.º 1
0
        public static void ClearTotal2(object o)
        {
            Log4netHelper.Error(new Exception("clearTotal2 开始执行"), "clearTotal2", "bery");
            BasicConfigService service = new BasicConfigService();
            BasicConfig        byName  = service.GetByName("IsClearTaskTotal2");

            if (byName.ParaValue != "1")
            {
                try
                {
                    BudTaskService       service2 = new BudTaskService();
                    BudModifyTaskService source   = new BudModifyTaskService();
                    new PTPrjInfoService();
                    foreach (BudModifyTask task in source.ToList <BudModifyTask>())
                    {
                        source.UpdateTotal2(task.ModifyTaskId);
                    }
                    string    cmdText = string.Format("\r\n\t\t\t\t\tSELECT TaskId FROM Bud_Task\r\n\t\t\t\t\tWHERE TaskId IN ( SELECT TaskId FROM Bud_TaskResource )\r\n\t\t\t\t", new object[0]);
                    DataTable table   = SqlHelper.ExecuteQuery(CommandType.Text, cmdText, new SqlParameter[0]);
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        string taskId = table.Rows[i][0].ToString();
                        service2.UpdateTotal2(taskId);
                    }
                    byName.ParaValue = "1";
                    service.Update(byName);
                    Log4netHelper.Error(new Exception("clearTotal2 执行成功"), "clearTotal2", "bery");
                }
                catch (Exception exception)
                {
                    Log4netHelper.Error(exception, "clearTotal2", "bery");
                }
            }
        }
Ejemplo n.º 2
0
 protected void btnSave_ServerClick(object sender, System.EventArgs e)
 {
     try
     {
         System.Collections.Generic.List <TaskResource> list = new System.Collections.Generic.List <TaskResource>();
         cn.justwin.Domain.BudTask budTask = null;
         if (this.hfldIsWBSRelevance.Value == "1")
         {
             budTask           = cn.justwin.Domain.BudTask.GetById(this.taskId);
             budTask.Resources = list;
         }
         for (int i = 0; i < this.gvResource.Rows.Count; i++)
         {
             cn.justwin.Domain.Resource byId = cn.justwin.Domain.Resource.GetById(this.gvResource.DataKeys[i].Values[0].ToString());
             decimal quantity = System.Convert.ToDecimal(((TextBox)this.gvResource.Rows[i].FindControl("txtNumber")).Text);
             decimal price    = System.Convert.ToDecimal(((TextBox)this.gvResource.Rows[i].FindControl("txtPrice")).Text);
             decimal num      = System.Convert.ToDecimal(((TextBox)this.gvResource.Rows[i].FindControl("txtLoss")).Text);
             if (this.hfldIsWBSRelevance.Value == "1")
             {
                 budTask.AddResource(byId, quantity, price, num, "save");
             }
             else
             {
                 list.Add(new TaskResource
                 {
                     Resource        = byId,
                     Quantity        = quantity,
                     Price           = price,
                     PrjGuid         = this.prjId,
                     Versions        = System.Convert.ToInt32(this.hfldVersion.Value.Trim()),
                     InputDate       = new System.DateTime?(System.DateTime.Now),
                     InputUser       = PageHelper.QueryUser(this, base.UserCode),
                     LossCoefficient = new decimal?(num)
                 });
             }
         }
         if (this.hfldIsWBSRelevance.Value == "1")
         {
             budTask.InputUser = PageHelper.QueryUser(this, base.UserCode);
             budTask.InputDate = System.DateTime.Now;
             cn.justwin.Domain.BudTask.AddResource(budTask);
             BudTaskService budTaskService = new BudTaskService();
             budTaskService.UpdateTotal2(this.taskId);
         }
         else
         {
             TaskResource.AddResource(list, this.prjId, System.Convert.ToInt32(this.hfldVersion.Value));
         }
         base.RegisterScript("top.ui.tabSuccess({ parentName: '_ResourceDeploy' });");
     }
     catch (System.Exception)
     {
     }
 }
Ejemplo n.º 3
0
 protected void btnBindResource_Click(object sender, System.EventArgs e)
 {
     if (this.hfldType.Value == "task")
     {
         if (!string.IsNullOrEmpty(this.hfldTaskId.Value))
         {
             ResourceTemp byId = ResourceTemp.GetById(this.hfldPurchaseChecked.Value.ToString());
             byId.BudTask = BudTask.GetById(this.hfldTaskId.Value.Trim());
             string inputUser = PageHelper.QueryUser(this, base.UserCode);
             ResourceTemp.Delete(byId, inputUser, this.hfldIsWBSRelevance.Value);
             this.BindGv();
             BudTaskService budTaskService = new BudTaskService();
             budTaskService.UpdateTotal2(this.hfldTaskId.Value.Trim());
         }
     }
     else
     {
         if (this.hfldType.Value == "resource" && !string.IsNullOrEmpty(this.hfldResourceIds.Value))
         {
             ResourceTemp byId2 = ResourceTemp.GetById(this.hfldPurchaseChecked.Value.ToString());
             byId2.ResourceId = this.hfldResourceIds.Value.Trim();
             byId2.BudTask    = BudTask.GetById(this.hfldTaskId.Value);
             string inputUser2 = PageHelper.QueryUser(this, base.UserCode);
             if (this.hfldIsWBSRelevance.Value == "1")
             {
                 byId2.BudTask = BudTask.GetById(this.hfldTaskId.Value);
             }
             ResourceTemp.Delete(byId2, inputUser2, this.hfldIsWBSRelevance.Value);
             this.BindGv();
             BudTaskService budTaskService2 = new BudTaskService();
             budTaskService2.UpdateTotal2(this.hfldTaskId.Value.Trim());
         }
     }
     this.hfldTaskId.Value            = "";
     this.hfldResourceIds.Value       = "";
     this.SelectResource1.ResourceId  = string.Empty;
     this.SelectResource1.ResTempType = string.Empty;
 }