예제 #1
0
    private string GetParentId(string taskId)
    {
        BudTaskService budTaskService = new BudTaskService();

        cn.justwin.Domain.Entities.BudTask byId = budTaskService.GetById(taskId);
        return(byId.ParentId);
    }
예제 #2
0
 protected void BindTaskInfo()
 {
     if (this.hfldIsWBSRelevance.Value == "1")
     {
         BudTaskService budTaskService           = new BudTaskService();
         cn.justwin.Domain.Entities.BudTask byId = budTaskService.GetById(this.taskId);
         this.lblTaskCode.Text = byId.TaskCode;
         this.lblTaskName.Text = byId.TaskName;
         this.lblDesc.Text     = byId.FeatureDescription;
         this.lblQu.Text       = byId.Quantity.Value.ToString();
     }
 }
예제 #3
0
    private void GenerageBudgetByParent(string prjId)
    {
        PTPrjInfoService pTPrjInfoService = new PTPrjInfoService();
        PTPrjInfo        byId             = pTPrjInfoService.GetById(prjId);
        PTPrjInfo        parent           = pTPrjInfoService.GetParent(prjId);
        string           str            = byId.TypeCode.Substring(6, 4);
        BudTaskService   budTaskService = new BudTaskService();

        budTaskService.DeleteByProject(prjId);
        System.Collections.Generic.IList <cn.justwin.Domain.Entities.BudTask> byProject = budTaskService.GetByProject(parent.PrjGuid.Value.ToString(), 999);
        for (int i = 0; i < byProject.Count; i++)
        {
            cn.justwin.Domain.Entities.BudTask budTask = byProject[i];
            budTask.PrjId  = byId.PrjGuid.Value.ToString();
            budTask.TaskId = budTask.TaskId.Substring(0, 9) + str + budTask.TaskId.Substring(13);
            if (!string.IsNullOrEmpty(budTask.ParentId))
            {
                budTask.ParentId = budTask.ParentId.Substring(0, 9) + str + budTask.ParentId.Substring(13);
            }
            budTaskService.Add(budTask);
        }
        this.BindGv();
    }
예제 #4
0
    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);
        }
    }
예제 #5
0
    protected void BindHtmlData()
    {
        string text  = base.Request["type"];
        string text2 = base.Request["id"];

        if (text.ToLower() == "edit")
        {
            string a = base.Request["page"];
            if (a == "BudTemplateList.aspx")
            {
                BudTemplateItem byId = BudTemplateItem.GetById(text2, base.Request["tempType"]);
                if (byId != null)
                {
                    this.txtTaskCode.Text          = byId.Code;
                    this.ViewState["oldCode"]      = byId.Code;
                    this.txtTaskName.Text          = byId.Name;
                    this.txtUnit.Text              = byId.Unit;
                    this.txtQuantity.Text          = byId.Quantity.ToString();
                    this.ddlTaskType.SelectedValue = byId.Layer.ToString();
                    this.txtNote.Text              = byId.Note;
                    this.txtDescription.Text       = byId.FeatureDescription;
                }
            }
            else
            {
                if (a == "BudgetPlaitList.aspx" || a == "BudgetChange.aspx")
                {
                    cn.justwin.Domain.Entities.BudTask budTask = null;
                    BudTaskService budTaskService = new BudTaskService();
                    string         arg_145_0      = string.Empty;
                    if (text.ToLower() == "edit")
                    {
                        budTask = budTaskService.GetById(text2);
                    }
                    if (budTask != null)
                    {
                        this.txtTaskCode.Text     = budTask.TaskCode;
                        this.ViewState["oldCode"] = budTask.TaskCode;
                        this.txtTaskName.Text     = budTask.TaskName;
                        this.txtStartDate.Text    = ((!budTask.StartDate.HasValue) ? string.Empty : budTask.StartDate.Value.ToString("yyyy-M-d"));
                        this.txtEndDate.Text      = ((!budTask.EndDate.HasValue) ? string.Empty : budTask.EndDate.Value.ToString("yyyy-M-d"));
                        if (budTask.ConstructionPeriod.HasValue)
                        {
                            this.txtConstructionPeriod.Text = budTask.ConstructionPeriod.Value.ToString();
                        }
                        this.txtUnit.Text              = budTask.Unit;
                        this.txtQuantity.Text          = budTask.Quantity.ToString();
                        this.txtUnitPrice.Text         = ((!budTask.UnitPrice.HasValue) ? 0m.ToString("0.00") : budTask.UnitPrice.Value.ToString("0.00"));
                        this.txtTotal.Value            = ((!budTask.Total.HasValue) ? 0m.ToString("0.00") : budTask.Total.Value.ToString("0.00"));
                        this.ddlTaskType.SelectedValue = (budTask.OrderNumber.Length / 3).ToString();
                        this.txtNote.Text              = budTask.Note;
                        this.txtDescription.Text       = budTask.FeatureDescription;
                    }
                }
            }
            if (a == "BudgetChange.aspx")
            {
                this.hfldState.Value = "edit";
                return;
            }
        }
        else
        {
            string text3 = base.Request["layer"];
            if (text3 == "")
            {
                this.ddlTaskType.SelectedValue = "1";
                return;
            }
            if (text3 == "0")
            {
                this.ddlTaskType.SelectedValue = string.Empty;
                return;
            }
            this.ddlTaskType.SelectedValue = text3;
        }
    }
예제 #6
0
        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);
                    }
                }
            }
        }
예제 #7
0
    private void SaveTask()
    {
        List <BudModifyTask> list = (
            from r in this.modifyTaskSer
            where r.ModifyId == this.hfldBudModifyId.Value
            select r).ToList <BudModifyTask>();

        for (int i = 0; i < this.gvBudget.Rows.Count; i++)
        {
            string taskId = list[i].TaskId;
            cn.justwin.Domain.Entities.BudTask budTask = (
                from p in this.budTaskSer
                where p.TaskId == taskId && p.ModifyId == this.hfldBudModifyId.Value
                select p).FirstOrDefault <cn.justwin.Domain.Entities.BudTask>();
            BudModifyTask budModifyTask = (
                from p in this.modifyTaskSer
                where p.TaskId == taskId
                select p).FirstOrDefault <BudModifyTask>();
            if (budTask != null)
            {
                budTask.Total2    = new decimal?(Convert.ToDecimal(((Label)this.gvBudget.Rows[i].FindControl("lblTotal")).Text));
                budTask.Quantity  = new decimal?(Convert.ToDecimal(((Label)this.gvBudget.Rows[i].FindControl("lblQuantity")).Text));
                budTask.UnitPrice = new decimal?(Convert.ToDecimal(((Label)this.gvBudget.Rows[i].FindControl("lblUnitPrice")).Text));
                this.budTaskSer.Update(budTask);
            }
            if (budTask == null && budModifyTask.ModifyType == 0)
            {
                budTask           = new cn.justwin.Domain.Entities.BudTask();
                budTask.ModifyId  = this.hfldBudModifyId.Value;
                budTask.TaskId    = taskId;
                budTask.TaskCode  = ((Label)this.gvBudget.Rows[i].FindControl("lblModifyTaskCode")).Text;
                budTask.TaskName  = ((Label)this.gvBudget.Rows[i].FindControl("lblModifyTaskContent")).Text;
                budTask.Unit      = ((Label)this.gvBudget.Rows[i].FindControl("lblUnit")).Text;
                budTask.Quantity  = new decimal?(Convert.ToDecimal(((Label)this.gvBudget.Rows[i].FindControl("lblQuantity")).Text));
                budTask.UnitPrice = new decimal?(Convert.ToDecimal(((Label)this.gvBudget.Rows[i].FindControl("lblUnitPrice")).Text));
                budTask.Total2    = new decimal?(Convert.ToDecimal(((Label)this.gvBudget.Rows[i].FindControl("lblTotal")).Text));
                string text  = ((Label)this.gvBudget.Rows[i].FindControl("lblModifyType")).Text;
                string value = ((HiddenField)this.gvBudget.Rows[i].FindControl("hfldParentId")).Value;
                budTask.ParentId = value;
                if (text == "清单内")
                {
                    budTask.ModifyType = "1";
                }
                else
                {
                    budTask.ModifyType = "0";
                }
                budTask.PrjId              = this.hdnProjectCode.Value;
                budTask.StartDate          = list[i].StartDate;
                budTask.EndDate            = list[i].EndDate;
                budTask.ConstructionPeriod = list[i].ConstructionPeriod;
                budTask.FeatureDescription = list[i].FeatureDescription;
                budTask.Note        = ((Label)this.gvBudget.Rows[i].FindControl("hlinkShowNote")).Text;
                budTask.OrderNumber = list[i].OrderNumber;
                budTask.InputUser   = PageHelper.QueryUser(this, base.UserCode);
                budTask.InputDate   = DateTime.Now;
                budTask.TaskType    = string.Empty;
                budTask.Version     = new int?(1);
                budTask.ContractId  = this.contractId;
                budTask.IsValid     = new bool?(false);
                this.budTaskSer.Add(budTask);
            }
        }
    }
예제 #8
0
        public int ConverBudTaskList(string[] colArray, string inputUser, List <string> errors, string IsWBSRelevance)
        {
            int num = 0;
            List <cn.justwin.Domain.BudTask> list     = new List <cn.justwin.Domain.BudTask>();
            IDictionary <string, int>        relation = ExcelUtility.GetRelation(colArray);
            List <string> orderNumberByLayer          = new List <string>();

            try
            {
                this.ParseTaskTable(relation);
                List <int> layerList = new List <int>();
                if (this.rankIndex == -1)
                {
                    List <string> codeList = this.GetCodeList();
                    layerList = this.GetLayersByCode(codeList);
                }
                else
                {
                    layerList = this.GetLayers();
                }
                orderNumberByLayer = this.GetOrderNumberByLayer(layerList);
            }
            catch (Exception exception)
            {
                errors.Add(exception.Message);
            }
            string   code        = string.Empty;
            string   name        = string.Empty;
            string   unit        = string.Empty;
            decimal  quantity    = 0M;
            decimal  num3        = 0M;
            decimal  num4        = 0M;
            DateTime?startDate   = null;
            DateTime?endDate     = null;
            string   note        = string.Empty;
            string   orderNumber = cn.justwin.Domain.BudTask.GetOrderNumber(this.prjId, this.taskId);
            string   str6        = string.Empty;
            int      num5        = 0;
            string   str7        = string.Empty;
            string   str8        = string.Empty;

            for (int i = this.startIndex; i < this.taskTable.Rows.Count; i++)
            {
                bool    flag = true;
                DataRow row  = this.taskTable.Rows[i];
                code = (row[this.codeIndex] == null) ? "" : row[this.codeIndex].ToString();
                string item = string.Empty;
                name     = (row[this.nameIndex] == null) ? "" : row[this.nameIndex].ToString();
                quantity = 0M;
                if (this.quantityIndex != -1)
                {
                    try
                    {
                        string str10 = row[this.quantityIndex].ToString().Trim();
                        if (!string.IsNullOrEmpty(str10))
                        {
                            quantity = decimal.Parse(str10);
                        }
                    }
                    catch
                    {
                        item = "在您的Excel中:编码" + code + ",工程量存在非有效的数字,请修改!";
                        errors.Add(item);
                        flag = false;
                    }
                }
                if (IsWBSRelevance == "0")
                {
                    if (this.unitPriceIndex != -1)
                    {
                        try
                        {
                            string str11 = row[this.unitPriceIndex].ToString().Trim();
                            if (!string.IsNullOrEmpty(str11))
                            {
                                num3 = decimal.Parse(str11);
                            }
                        }
                        catch
                        {
                            item = "在您的Excel中:编码" + code + ",综合单价存在非有效的数字,请修改!";
                            errors.Add(item);
                            flag = false;
                        }
                    }
                    if (this.totalIndex != -1)
                    {
                        try
                        {
                            num4 = quantity * num3;
                        }
                        catch
                        {
                            item = "在您的Excel中:编码" + code + ",综合单价存在非有效的数字,请修改!";
                            errors.Add(item);
                            flag = false;
                        }
                    }
                }
                unit = string.Empty;
                if (this.unitIndex != -1)
                {
                    unit = row[this.unitIndex].ToString();
                }
                if (this.startDateIndex != -1)
                {
                    try
                    {
                        string str12 = row[this.startDateIndex].ToString().Trim();
                        if (!string.IsNullOrEmpty(str12))
                        {
                            startDate = new DateTime?(Convert.ToDateTime(str12));
                        }
                        else
                        {
                            startDate = null;
                        }
                    }
                    catch
                    {
                        item = "在您的Excel中:编码" + code + ",存在非有效时间类型,请修改!";
                        errors.Add(item);
                        flag = false;
                    }
                }
                if (this.endDateIndex != -1)
                {
                    try
                    {
                        string str13 = row[this.endDateIndex].ToString();
                        if (!string.IsNullOrEmpty(str13))
                        {
                            endDate = new DateTime?(Convert.ToDateTime(str13));
                        }
                        else
                        {
                            endDate = null;
                        }
                    }
                    catch
                    {
                        item = "在您的Excel中:编码" + code + ",存在非有效时间类型,请修改!";
                        errors.Add(item);
                        flag = false;
                    }
                }
                if (this.noteIndex != -1)
                {
                    note = row[this.noteIndex].ToString();
                }
                if (this.constructionPeriodIndex != -1)
                {
                    try
                    {
                        num5 = Convert.ToInt32(row[this.constructionPeriodIndex]);
                    }
                    catch
                    {
                    }
                }
                if (this.featureDescriptionIndex != -1)
                {
                    str7 = row[this.featureDescriptionIndex].ToString();
                }
                if (row.Table.Columns.Contains("序号"))
                {
                    str8 = row["序号"].ToString();
                }
                if (!flag)
                {
                    item = "在您的Excel中:编码" + code + ",存在错误数据导致其子节点不能导入!";
                    errors.Add(item);
                    int    num7  = 0;
                    string str14 = orderNumberByLayer[i];
                    for (int j = i + 1; j < orderNumberByLayer.Count; j++)
                    {
                        if (orderNumberByLayer[j].StartsWith(str14))
                        {
                            num7++;
                        }
                    }
                    i += num7;
                }
                else
                {
                    num++;
                    string id                      = Guid.NewGuid().ToString();
                    string parentTaskId            = (this.taskId == "") ? null : this.taskId;
                    cn.justwin.Domain.BudTask task = null;
                    if (IsWBSRelevance == "1")
                    {
                        decimal?unitPrice = null;
                        decimal?total     = null;
                        task = cn.justwin.Domain.BudTask.Create(id, parentTaskId, null, this.prjId, code, name, unit, quantity, startDate, endDate, true, note, inputUser, DateTime.Now, unitPrice, total);
                    }
                    else
                    {
                        task = cn.justwin.Domain.BudTask.Create(id, parentTaskId, null, this.prjId, code, name, unit, quantity, startDate, endDate, true, note, inputUser, DateTime.Now, new decimal?(num3), new decimal?(num4));
                    }
                    string str17 = orderNumberByLayer[i].Substring(3);
                    if (string.IsNullOrEmpty(str17))
                    {
                        if (i > this.startIndex)
                        {
                            orderNumber = cn.justwin.Domain.BudTask.GetOrderNumber(this.prjId, this.taskId);
                        }
                        task.OrderNumber = orderNumber;
                    }
                    else
                    {
                        task.OrderNumber = orderNumber + str17;
                    }
                    if (i > 0)
                    {
                        int count = list.Count;
                        if (count > 0)
                        {
                            if ((orderNumberByLayer[i].Length - str6.Length) == 3)
                            {
                                task.ParentId = list[count - 1].Id;
                            }
                            else if ((orderNumberByLayer[i].Length - str6.Length) == 0)
                            {
                                task.ParentId = list[count - 1].ParentId;
                            }
                            else
                            {
                                int length = orderNumberByLayer[i].Length;
                                if (length == 3)
                                {
                                    task.ParentId = list[0].ParentId;
                                }
                                else if (length > 3)
                                {
                                    int differOrderNumber = list[0].OrderNumber.Length - orderNumberByLayer[0].Length;
                                    int num10             = list.FindLastIndex(t => t.OrderNumber.Length == (length + differOrderNumber));
                                    task.ParentId = list[num10].ParentId;
                                }
                            }
                        }
                    }
                    str6 = orderNumberByLayer[i];
                    list.Add(task);
                    cn.justwin.Domain.Entities.BudTask task2 = null;
                    BudTaskService service = new BudTaskService();
                    task2 = new cn.justwin.Domain.Entities.BudTask {
                        TaskId             = task.Id,
                        ParentId           = task.ParentId,
                        OrderNumber        = task.OrderNumber,
                        PrjId              = task.Prj,
                        InputUser          = task.InputUser,
                        InputDate          = task.InputDate,
                        IsValid            = true,
                        Version            = 1,
                        Modified           = null,
                        TaskCode           = task.Code,
                        TaskName           = task.Name,
                        StartDate          = task.StartDate,
                        EndDate            = task.EndDate,
                        Quantity           = new decimal?(task.Quantity),
                        UnitPrice          = task.UnitPrice,
                        Total              = task.Total,
                        Unit               = task.Unit,
                        Note               = task.Note,
                        ConstructionPeriod = new int?(num5),
                        FeatureDescription = str7,
                        TaskType           = "",
                        Total2             = 0
                    };
                    service.Add(task2);
                    if (!string.IsNullOrEmpty(str8))
                    {
                        this.AddSerialNoAndTaskId(str8, task.Id);
                    }
                    else
                    {
                        this.AddCodeAndTaskId(task.Code, task.Id);
                    }
                }
            }
            return(num);
        }