Пример #1
0
    protected void btnBindResource_Click(object sender, EventArgs e)
    {
        this.UpdatePurchaseplanStockDataSource();
        this.InitResource(this.hfldResourceId.Value);
        List <BudModifyTask> modifyTaskGV = this.GetModifyTaskGV();
        string text = string.Empty;

        text = this.hfldEditModifyTaskId.Value;
        HttpCookie httpCookie        = base.Request.Cookies[text];
        List <BudModifyTaskRes> list = new List <BudModifyTaskRes>();

        if (httpCookie != null)
        {
            string value = httpCookie.Value;
            if (!string.IsNullOrEmpty(value))
            {
                list = JsonConvert.DeserializeObject <List <BudModifyTaskRes> >(value);
            }
        }
        decimal num = 0m;

        foreach (BudModifyTaskRes current in list)
        {
            num += current.ResourcePrice * current.ResourceQuantity;
        }
        int i = 0;

        while (i < this.gvBudget.Rows.Count)
        {
            string value2 = ((HiddenField)this.gvBudget.Rows[i].FindControl("hfldModifyTaskId")).Value;
            if (!string.IsNullOrEmpty(value2) && value2 == text)
            {
                ((Label)this.gvBudget.Rows[i].FindControl("lblTotal")).Text = num.ToString("0.000");
                modifyTaskGV[i].Total  = num;
                modifyTaskGV[i].Total2 = new decimal?(num);
                string value3 = ((Label)this.gvBudget.Rows[i].FindControl("lblQuantity")).Text.Trim();
                if (string.IsNullOrEmpty(value3))
                {
                    break;
                }
                decimal num2 = Convert.ToDecimal(value3);
                modifyTaskGV[i].Quantity = num2;
                if (num2 != 0m)
                {
                    ((Label)this.gvBudget.Rows[i].FindControl("lblUnitPrice")).Text = (num / num2).ToString("0.000");
                    modifyTaskGV[i].UnitPrice = num / num2;
                    break;
                }
                ((Label)this.gvBudget.Rows[i].FindControl("lblUnitPrice")).Text = "0.000";
                modifyTaskGV[i].UnitPrice = 0m;
                break;
            }
            else
            {
                i++;
            }
        }
        this.BindGv(modifyTaskGV);
        this.hfldAllModifyTaskJson.Value = JsonNetWrap.SerializeObject(modifyTaskGV);
    }
Пример #2
0
    private void InitEidtModifyTask(string modifyTaskJson)
    {
        BudModifyTask budModifyTask = JsonNetWrap.DeserializeObject <BudModifyTask>(modifyTaskJson);

        if (budModifyTask != null)
        {
            if (this.type == "edit")
            {
                this.ModifyType.Attributes.Add("disabled", "disabled");
            }
            this.ModifyType.SelectedIndex = budModifyTask.ModifyType.Value;
            this.txtTaskName.Value        = this.GetTaskCode(budModifyTask);
            this.txtTaskCode.Text         = budModifyTask.ModifyTaskCode;
            this.txtModifyTaskName.Text   = budModifyTask.ModifyTaskContent;
            this.txtUnit.Text             = budModifyTask.Unit;
            this.txtQuantity.Value        = budModifyTask.Quantity.ToString();
            this.txtUnitPrice.Value       = budModifyTask.UnitPrice.ToString();
            this.txtTotal.Value           = budModifyTask.Total.ToString();
            this.txtStartDate.Value       = budModifyTask.StartDate.ToString();
            this.txtEndDate.Text          = budModifyTask.EndDate.ToString();
            this.txtNode.Text             = budModifyTask.Note;
            if (budModifyTask.ModifyType.Value == 0)
            {
                this.hfldOriginalTaskId.Value = budModifyTask.ParentId;
                return;
            }
            this.hfldOriginalTaskId.Value = budModifyTask.TaskId;
        }
    }
Пример #3
0
    private void BindBudget()
    {
        List <BudModifyTask> dataSource = JsonNetWrap.DeserializeObject <List <BudModifyTask> >(this.hfldAllModifyTaskJson.Value);

        this.gvBudget.DataSource = dataSource;
        this.gvBudget.DataBind();
    }
Пример #4
0
    private void InitBudTask()
    {
        BudModifyTaskService budModifyTaskService = new BudModifyTaskService();
        List <BudModifyTask> byModifyId           = budModifyTaskService.GetByModifyId(this.hfldBudModifyId.Value);

        this.hfldAllModifyTaskJson.Value = JsonNetWrap.SerializeObject(byModifyId);
        this.gvBudget.DataSource         = byModifyId;
        this.gvBudget.DataBind();
    }
Пример #5
0
    private void UpdateModifyTask()
    {
        HttpCookie httpCookie        = base.Request.Cookies[this.hfldEditModifyTaskId.Value];
        List <BudModifyTaskRes> list = new List <BudModifyTaskRes>();

        if (httpCookie != null)
        {
            string value = httpCookie.Value;
            if (!string.IsNullOrEmpty(value))
            {
                list = JsonConvert.DeserializeObject <List <BudModifyTaskRes> >(value);
            }
        }
        decimal num = 0m;

        foreach (BudModifyTaskRes current in list)
        {
            num += current.ResourcePrice * current.ResourceQuantity;
        }
        BudModifyTask budModifyTask = (
            from r in this.modifyTaskSer
            where r.ModifyTaskId == this.hfldEditModifyTaskId.Value
            select r).FirstOrDefault <BudModifyTask>();
        List <BudModifyTask> list2 = JsonNetWrap.DeserializeObject <List <BudModifyTask> >(this.hfldAllModifyTaskJson.Value);

        for (int i = 0; i < list2.Count; i++)
        {
            if (list2[i].ModifyTaskId == this.hfldEditModifyTaskId.Value)
            {
                list2[i].Total  = num;
                list2[i].Total2 = new decimal?(num);
                if (list2[i].Quantity != 0m)
                {
                    list2[i].UnitPrice = num / Convert.ToDecimal(list2[i].Quantity);
                }
            }
        }
        this.modifyTaskSer.DelByModifyTaskId(this.hfldEditModifyTaskId.Value);
        foreach (BudModifyTask current2 in list2)
        {
            if (current2.ModifyTaskId == this.hfldEditModifyTaskId.Value)
            {
                this.modifyTaskSer.Add(current2);
                this.SaveModifyTaskRes(this.hfldEditModifyTaskId.Value);
                this.modifyTaskSer.UpdateTotal2(current2.ModifyTaskId);
            }
        }
        if (!list2.Contains(budModifyTask) && budModifyTask != null)
        {
            this.modifyTaskSer.Delete(budModifyTask);
        }
        this.gvBudget.DataSource = list2;
        this.gvBudget.DataBind();
    }
Пример #6
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        if (!base.IsPostBack)
        {
            this.hfldIsWBSRelevance.Value = this.isWBSRelevance;
            System.Collections.Generic.List <BudModifyTask> list = new System.Collections.Generic.List <BudModifyTask>();
            if (this.action == "Add")
            {
                this.hfldModifyId.Value = System.Guid.NewGuid().ToString();
            }
            else
            {
                this.hfldModifyId.Value = this.id;
                list = (
                    from mt in this.modifyTaskSer
                    where mt.ModifyId == this.hfldModifyId.Value
                    select mt).ToList <BudModifyTask>();
                this.BindModifyInfo();
                decimal d = 0m;
                d += list.Sum((BudModifyTask imt) => imt.Total);
                this.txtBudAmount.Value          = d.ToString("0.000");
                this.hfldAllModifyTaskJson.Value = JsonNetWrap.SerializeObject(list);
            }
            this.BindGv(list);
            if (this.hfldIsWBSRelevance.Value == "1")
            {
                using (System.Collections.Generic.List <BudModifyTask> .Enumerator enumerator = list.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        BudModifyTask current = enumerator.Current;
                        this.BindModifyTaskRes(current.ModifyTaskId);
                    }
                    goto IL_2AE;
                }
            }
            base.Request.Cookies.Remove(this.hfldModifyId.Value);
            System.Collections.Generic.List <BudModifyTaskRes> t = (
                from mtss in this.modifyTaskResSer
                where mtss.ModifyId == this.hfldModifyId.Value
                select mtss).ToList <BudModifyTaskRes>();
            string     value      = JsonHelper.JsonSerializer <System.Collections.Generic.List <BudModifyTaskRes> >(t);
            HttpCookie httpCookie = new HttpCookie(this.hfldModifyId.Value);
            httpCookie.Value = value;
            base.Response.Cookies.Add(httpCookie);
IL_2AE:
            this.hfldPrjId.Value         = this.prjId;
            this.uploadModify.RecordCode = this.hfldModifyId.Value;
        }
    }
Пример #7
0
 protected void btnDel_Click(object sender, System.EventArgs e)
 {
     System.Collections.Generic.List <BudModifyTask> modifyTaskGV = this.GetModifyTaskGV();
     System.Collections.Generic.List <string>        list         = new System.Collections.Generic.List <string>();
     if (this.hfldEditModifyTaskId.Value.Contains('['))
     {
         list = JsonHelper.GetListFromJson(this.hfldEditModifyTaskId.Value);
     }
     else
     {
         list.Add(this.hfldEditModifyTaskId.Value);
     }
     try
     {
         foreach (string current in list)
         {
             foreach (BudModifyTask budModifyTask in modifyTaskGV)
             {
                 if (budModifyTask.ModifyTaskId == current)
                 {
                     modifyTaskGV.Remove(budModifyTask);
                     base.Request.Cookies.Remove(current);
                     System.Collections.Generic.List <BudModifyTaskRes> list2 = (
                         from r in this.modifyTaskResSer
                         where r.ModifyTaskId == budModifyTask.ModifyTaskId
                         select r).ToList <BudModifyTaskRes>();
                     using (System.Collections.Generic.List <BudModifyTaskRes> .Enumerator enumerator3 = list2.GetEnumerator())
                     {
                         while (enumerator3.MoveNext())
                         {
                             BudModifyTaskRes current2 = enumerator3.Current;
                             this.modifyTaskResSer.Delete(current2);
                         }
                         break;
                     }
                 }
             }
         }
         this.BindGv(modifyTaskGV);
         this.hfldAllModifyTaskJson.Value = JsonNetWrap.SerializeObject(modifyTaskGV);
         System.Collections.Generic.List <BudModifyTask> modifyTaskGV2 = this.GetModifyTaskGV();
         decimal d = 0m;
         d += modifyTaskGV2.Sum((BudModifyTask imt) => imt.Total);
         this.txtBudAmount.Value = d.ToString("0.000");
     }
     catch
     {
         base.RegisterScript("top.ui.alert('删除失败!');");
     }
 }
Пример #8
0
    public void AddBudModifTask()
    {
        List <BudModifyTask> list = JsonNetWrap.DeserializeObject <List <BudModifyTask> >(this.hfldAllModifyTaskJson.Value);

        if (list == null)
        {
            return;
        }
        BudModifyTaskService budModifyTaskService = new BudModifyTaskService();

        budModifyTaskService.DelModifyTask(this.hfldBudModifyId.Value);
        foreach (BudModifyTask current in list)
        {
            budModifyTaskService.Add(current);
            budModifyTaskService.UpdateTotal2(current.ModifyTaskId);
        }
    }
Пример #9
0
    private void InitChildMenu(PTMK[] ptmkArr)
    {
        PTMKService pTMKService      = new PTMKService();
        Dictionary <int, string> obj = new Dictionary <int, string>();
        int num = 0;

        if (num >= ptmkArr.Length)
        {
            this.hfldChildMk.Value = JsonNetWrap.SerializeObject(obj);
        }
        else
        {
            PTMK         pTMK  = ptmkArr[num];
            IList <PTMK> all   = pTMKService.GetAll(this.userCode, pTMK.C_MKDM);
            string       value = JsonHelper.JsonSerializer <PTMK[]>(all.ToArray <PTMK>());
            this.hfldChildMk.Value = value;
        }
    }
Пример #10
0
 private void SetInputValuesIntoResourceTable(DataTable hasResourceTable)
 {
     StockManage_SmPurchaseplan_AddSmPurchaseplan._PurchasePlan[] array = JsonNetWrap.DeserializeObject <StockManage_SmPurchaseplan_AddSmPurchaseplan._PurchasePlan[]>(this.hdfdInputValues.Value);
     for (int i = 0; i < array.Length; i++)
     {
         DataRow targetRow = this.GetTargetRow(array[i].scode, hasResourceTable);
         if (targetRow != null)
         {
             targetRow["number"] = array[i].num;
             DateTime dateTime;
             if (DateTime.TryParse(array[i].date, out dateTime))
             {
                 targetRow["arrivalDate"] = dateTime;
             }
             targetRow["Remark"] = array[i].note;
         }
     }
 }
Пример #11
0
    private void AddInModify()
    {
        BudModifyTask budModifyTask = new BudModifyTask();

        budModifyTask.ModifyTaskId      = this.hfldModifyTaskId.Value;
        budModifyTask.ModifyId          = this.modifyId;
        budModifyTask.TaskId            = this.hfldOriginalTaskId.Value;
        budModifyTask.ModifyTaskCode    = this.GetTaskCode(this.hfldOriginalTaskId.Value);
        budModifyTask.ModifyTaskContent = this.txtModifyTaskName.Text.Trim();
        budModifyTask.Unit = this.txtUnit.Text.Trim();
        if (!string.IsNullOrEmpty(this.txtQuantity.Value.Trim()))
        {
            budModifyTask.Quantity = Convert.ToDecimal(this.txtQuantity.Value.Trim());
        }
        else
        {
            budModifyTask.Quantity = 0m;
        }
        if (!string.IsNullOrEmpty(this.txtUnitPrice.Value.Trim()))
        {
            budModifyTask.UnitPrice = Convert.ToDecimal(this.txtUnitPrice.Value.Trim());
        }
        else
        {
            budModifyTask.UnitPrice = 0m;
        }
        if (!string.IsNullOrEmpty(this.txtTotal.Value.Trim()))
        {
            budModifyTask.Total = Convert.ToDecimal(this.txtTotal.Value.Trim());
        }
        else
        {
            budModifyTask.Total = 0m;
        }
        if (!string.IsNullOrEmpty(this.txtStartDate.Value.Trim()))
        {
            budModifyTask.StartDate = new DateTime?(Convert.ToDateTime(this.txtStartDate.Value.Trim()));
        }
        else
        {
            budModifyTask.StartDate = null;
        }
        if (!string.IsNullOrEmpty(this.txtEndDate.Text.Trim()))
        {
            budModifyTask.EndDate = new DateTime?(Convert.ToDateTime(this.txtEndDate.Text.Trim()));
        }
        else
        {
            budModifyTask.EndDate = null;
        }
        if (this.type == "edit")
        {
            string        value          = base.Request.Cookies["modifyTaskJson"].Value;
            string        json           = HttpUtility.UrlDecode(value);
            BudModifyTask budModifyTask2 = JsonNetWrap.DeserializeObject <BudModifyTask>(json);
            budModifyTask.OrderNumber = budModifyTask2.OrderNumber;
        }
        else
        {
            budModifyTask.OrderNumber = this.tSer.GetNextChildOrderNumber(this.hfldOriginalTaskId.Value);
        }
        budModifyTask.Note       = this.txtNode.Text.Trim();
        budModifyTask.ModifyType = new int?(1);
        if (!string.IsNullOrEmpty(this.txtConstructPeriod.Text.Trim()))
        {
            budModifyTask.ConstructionPeriod = new int?(Convert.ToInt32(this.txtConstructPeriod.Text.Trim()));
        }
        budModifyTask.FeatureDescription = string.Empty;
        budModifyTask.ParentId           = this.hfldOriginalTaskId.Value;
        budModifyTask.PrjId2             = this.prjId;
        budModifyTask.ContractId         = this.contractId;
        budModifyTask.Total2             = new decimal?(budModifyTask.UnitPrice * budModifyTask.Quantity);
        this.hfldTaskJson.Value          = JsonNetWrap.SerializeObject(budModifyTask);
        base.RegisterScript("save();");
    }
Пример #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         this.hfldIsWBSRelevance.Value = this.isWBSRelevance;
         List <BudModifyTask> list      = new List <BudModifyTask>();
         DataTable            dataTable = new DataTable();
         if (string.Compare(this.action, "Add", true) == 0)
         {
             this.InintAddState();
             this.modifyStockAction = "add";
             dataTable = this.purchaseStock.GetPurchaseStockByContractId(this.contractId, false);
             DataColumn dataColumn = new DataColumn("ModifyStockId", typeof(string));
             dataColumn.DefaultValue = string.Empty;
             dataTable.Columns.Add(dataColumn);
             this.hfldBudModifyId.Value = Guid.NewGuid().ToString();
         }
         else
         {
             this.InitUpdateState();
             this.modifyStockAction = "edit";
             dataTable = this.purchaseStock.GetModifyStockByContractId(this.contractId, this.modifyId);
             ConPayoutModifyService conPayoutModifyService = new ConPayoutModifyService();
             ConPayoutModify        byId = conPayoutModifyService.GetById(this.modifyId);
             if (byId != null && !string.IsNullOrEmpty(byId.BudModifyId))
             {
                 this.hfldBudModifyId.Value = byId.BudModifyId;
             }
             else
             {
                 this.hfldBudModifyId.Value = Guid.NewGuid().ToString();
             }
             this.hfldModifyId.Value = this.modifyId;
             list = (
                 from mt in this.modifyTaskSer
                 where mt.ModifyId == this.hfldBudModifyId.Value
                 select mt).ToList <BudModifyTask>();
             this.hfldAllModifyTaskJson.Value = JsonNetWrap.SerializeObject(list);
         }
         this.ViewState["modifyStockAction"] = this.modifyStockAction;
         this.ViewState["resource"]          = dataTable;
         this.DataBindPurchaseplanStock();
         string conPurchasePcode = this.purchase.GetConPurchasePcode(this.contractId);
         if (string.IsNullOrEmpty(conPurchasePcode))
         {
             this.divPurchase.Style.Add("display", "none");
         }
         this.FileLink1.MID  = 1902;
         this.FileLink1.FID  = this.hfldModifyId.Value;
         this.FileLink1.Type = 1;
         this.BindGv(list);
         if (this.hfldIsWBSRelevance.Value == "1")
         {
             using (List <BudModifyTask> .Enumerator enumerator = list.GetEnumerator())
             {
                 while (enumerator.MoveNext())
                 {
                     BudModifyTask current = enumerator.Current;
                     this.BindModifyTaskRes(current.ModifyTaskId);
                 }
                 return;
             }
         }
         base.Request.Cookies.Remove(this.hfldModifyId.Value);
         List <BudModifyTaskRes> t = (
             from mtss in this.modifyTaskResSer
             where mtss.ModifyId == this.hfldModifyId.Value
             select mtss).ToList <BudModifyTaskRes>();
         string     value      = JsonHelper.JsonSerializer <List <BudModifyTaskRes> >(t);
         HttpCookie httpCookie = new HttpCookie(this.hfldModifyId.Value);
         httpCookie.Value = value;
         base.Response.Cookies.Add(httpCookie);
     }
 }
Пример #13
0
    private List <BudModifyTask> GetModifyTaskGV()
    {
        List <BudModifyTask> list = new List <BudModifyTask>();

        return(JsonNetWrap.DeserializeObject <List <BudModifyTask> >(this.hfldAllModifyTaskJson.Value));
    }
Пример #14
0
 private void BindBudget()
 {
     System.Collections.Generic.List <BudModifyTask> dataSource = JsonNetWrap.DeserializeObject <System.Collections.Generic.List <BudModifyTask> >(this.hfldAllModifyTaskJson.Value);
     this.gvBudget.DataSource = dataSource;
     this.gvBudget.DataBind();
 }
Пример #15
0
 private System.Collections.Generic.List <BudModifyTask> GetModifyTaskGV()
 {
     System.Collections.Generic.List <BudModifyTask> list = new System.Collections.Generic.List <BudModifyTask>();
     return(JsonNetWrap.DeserializeObject <System.Collections.Generic.List <BudModifyTask> >(this.hfldAllModifyTaskJson.Value));
 }