Пример #1
0
    private void BindBudget()
    {
        List <BudModifyTask> dataSource = JsonNetWrap.DeserializeObject <List <BudModifyTask> >(this.hfldAllModifyTaskJson.Value);

        this.gvBudget.DataSource = dataSource;
        this.gvBudget.DataBind();
    }
Пример #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 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();
    }
Пример #4
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);
        }
    }
Пример #5
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;
         }
     }
 }
Пример #6
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();");
    }
Пример #7
0
    private List <BudModifyTask> GetModifyTaskGV()
    {
        List <BudModifyTask> list = new List <BudModifyTask>();

        return(JsonNetWrap.DeserializeObject <List <BudModifyTask> >(this.hfldAllModifyTaskJson.Value));
    }
Пример #8
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();
 }
Пример #9
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));
 }