Esempio n. 1
0
    public void ShowTaskInfo_click(object sender, System.EventArgs e)
    {
        string id       = string.Empty;
        string arg_0B_0 = string.Empty;

        cn.justwin.Domain.Entities.BudContractTask budContractTask = null;
        DataTable dataSource = null;
        string    contractID = null;

        if (!string.IsNullOrEmpty(base.Request["id"]))
        {
            contractID = base.Request["id"];
        }
        if (!string.IsNullOrEmpty(this.hdTaskID.Value))
        {
            id = this.hdTaskID.Value;
            BudContractTaskService budContractTaskService = new BudContractTaskService();
            budContractTask          = budContractTaskService.GetTaskById(id);
            this.hdOrderNumber.Value = budContractTask.OrderNumber;
        }
        if (budContractTask != null)
        {
            dataSource = cn.justwin.Domain.BudContractTask.GetConByParent(this.hdnProjectCode.Value, contractID, budContractTask.OrderNumber, "", "", "", 0);
        }
        this.gvBudget.DataSource = dataSource;
        this.gvBudget.DataBind();
    }
Esempio n. 2
0
    public void BindInfo()
    {
        BudConModifyTask budConModifyTask = JsonConvert.DeserializeObject <BudConModifyTask>(this.hfldModifyTask.Value);

        if (budConModifyTask != null)
        {
            this.hfldBudModifyTaskId.Value = budConModifyTask.ModifyTaskId;
            this.ModifyType.Value          = budConModifyTask.ModifyType.ToString();
            this.ModifyType.Disabled       = true;
            if (budConModifyTask.ModifyType == 1)
            {
                this.txtTaskName.Value = this.GetTaskCode(budConModifyTask.TaskId);
                this.TaskId.Value      = budConModifyTask.TaskId;
                cn.justwin.Domain.Entities.BudContractTask taskById = this.conTaskSev.GetTaskById(budConModifyTask.TaskId);
                this.txtTaskCode.Text        = taskById.TaskName;
                this.txtModifyTaskName.Text  = budConModifyTask.ModifyTaskContent;
                this.txtUnit.Text            = budConModifyTask.Unit;
                this.txtQuantity.Value       = budConModifyTask.Quantity.ToString();
                this.txtUnitPrice.Value      = taskById.UnitPrice.ToString();
                this.txtTotal.Value          = budConModifyTask.Total.ToString();
                this.txtStartDate.Value      = Common2.GetTime(budConModifyTask.StartDate);
                this.txtEndDate.Text         = Common2.GetTime(budConModifyTask.EndDate);
                this.txtConstructPeriod.Text = budConModifyTask.ConstructionPeriod.ToString();
                this.txtNode.Text            = budConModifyTask.Note;
                this.ParentId.Value          = budConModifyTask.ParentId;
            }
            else
            {
                if (budConModifyTask.ModifyType == 0)
                {
                    this.ModifyType.Value        = budConModifyTask.ModifyType.ToString();
                    this.txtTaskName.Value       = this.GetTaskCode(budConModifyTask.ParentId);
                    this.TaskId.Value            = budConModifyTask.TaskId;
                    this.txtTaskCode.Text        = budConModifyTask.ModifyTaskCode;
                    this.txtModifyTaskName.Text  = budConModifyTask.ModifyTaskContent;
                    this.txtUnit.Text            = budConModifyTask.Unit;
                    this.txtQuantity.Value       = budConModifyTask.Quantity.ToString();
                    this.txtUnitPrice.Value      = budConModifyTask.UnitPrice.ToString();
                    this.txtTotal.Value          = budConModifyTask.Total.ToString();
                    this.txtStartDate.Value      = Common2.GetTime(budConModifyTask.StartDate);
                    this.txtEndDate.Text         = Common2.GetTime(budConModifyTask.EndDate);
                    this.txtConstructPeriod.Text = budConModifyTask.ConstructionPeriod.ToString();
                    this.txtNode.Text            = budConModifyTask.Note;
                    this.ParentId.Value          = budConModifyTask.ParentId;
                }
            }
            this.fileBud.RecordCode = budConModifyTask.ModifyTaskId;
        }
    }
Esempio n. 3
0
    private string GetParentId(string taskId)
    {
        BudContractTaskService budContractTaskService = new BudContractTaskService();

        cn.justwin.Domain.Entities.BudContractTask byId = budContractTaskService.GetById(taskId);
        BudConModifyTaskService source           = new BudConModifyTaskService();
        BudConModifyTask        budConModifyTask = (
            from r in source
            where r.TaskId == taskId
            select r).FirstOrDefault <BudConModifyTask>();

        if (byId != null)
        {
            return(byId.ParentId);
        }
        return(budConModifyTask.ParentId);
    }
Esempio n. 4
0
    protected void BindHtmlData()
    {
        if (this.type.ToLower() == "edit")
        {
            BudContractTaskService budContractTaskService   = new BudContractTaskService();
            cn.justwin.Domain.Entities.BudContractTask byId = budContractTaskService.GetById(this.id);
            if (byId != null)
            {
                this.txtTaskCode.Text           = byId.TaskCode;
                this.ViewState["oldCode"]       = byId.TaskCode;
                this.txtTaskName.Text           = byId.TaskName;
                this.txtStartDate.Text          = ((!byId.StartDate.HasValue) ? string.Empty : byId.StartDate.Value.ToString("yyyy-M-d"));
                this.txtEndDate.Text            = ((!byId.EndDate.HasValue) ? string.Empty : byId.EndDate.Value.ToString("yyyy-M-d"));
                this.txtConstructionPeriod.Text = (byId.ConstructionPeriod.HasValue ? byId.ConstructionPeriod.Value.ToString() : "");
                this.txtUnit.Text              = byId.Unit;
                this.txtQuantity.Text          = byId.Quantity.ToString();
                this.txtUnitPrice.Text         = byId.UnitPrice.ToString();
                this.txtTotal.Text             = byId.Total.ToString();
                this.ddlTaskType.SelectedValue = (byId.OrderNumber.Length / 3).ToString();
                this.txtNote.Text              = byId.Note;
                this.txtDescription.Text       = byId.FeatureDescription;
                this.txtMainMaterial.Text      = byId.MainMaterial.ToString();
                this.txtSubMaterial.Text       = byId.SubMaterial.ToString();
                this.txtLabor.Text             = byId.Labor.ToString();
            }
            cn.justwin.Domain.BudContractTask.GetById(this.id);
            this.hfldState.Value = "edit";
            return;
        }
        string text = base.Request["layer"];

        if (text == "")
        {
            this.ddlTaskType.SelectedValue = "1";
            return;
        }
        if (text == "0")
        {
            this.ddlTaskType.SelectedValue = string.Empty;
            return;
        }
        this.ddlTaskType.SelectedValue = text;
    }
Esempio n. 5
0
    protected string GetTaskCode(string taskId)
    {
        string result = string.Empty;

        cn.justwin.Domain.Entities.BudContractTask budContractTask = new cn.justwin.Domain.Entities.BudContractTask();
        BudContractTaskService budContractTaskService = new BudContractTaskService();

        budContractTask = budContractTaskService.GetById(taskId);
        if (budContractTask != null)
        {
            result = budContractTask.TaskCode;
        }
        else
        {
            BudConModifyTask byId = this.conModifyTaskSer.GetById(taskId);
            if (byId != null)
            {
                result = byId.ModifyTaskCode;
            }
        }
        return(result);
    }
Esempio n. 6
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);
        BudContractTaskService budContractTaskService = new BudContractTaskService();

        budContractTaskService.DeleteByProject(prjId);
        System.Collections.Generic.IList <cn.justwin.Domain.Entities.BudContractTask> byProject = budContractTaskService.GetByProject(parent.PrjGuid.Value.ToString(), 999);
        for (int i = 0; i < byProject.Count; i++)
        {
            cn.justwin.Domain.Entities.BudContractTask budContractTask = byProject[i];
            budContractTask.PrjId  = byId.PrjGuid.Value.ToString();
            budContractTask.TaskId = budContractTask.TaskId.Substring(0, 9) + str + budContractTask.TaskId.Substring(13);
            if (!string.IsNullOrEmpty(budContractTask.ParentId))
            {
                budContractTask.ParentId = budContractTask.ParentId.Substring(0, 9) + str + budContractTask.ParentId.Substring(13);
            }
            budContractTaskService.Add(budContractTask);
        }
        this.BindGv();
    }
Esempio n. 7
0
    protected void btnSave_Click(object sender, System.EventArgs e)
    {
        string  text   = this.txtQuantity.Text;
        string  value  = this.txtUnitPrice.Text.Trim();
        decimal value2 = System.Convert.ToDecimal(text) * System.Convert.ToDecimal(value);

        if (string.IsNullOrEmpty(text))
        {
            base.RegisterScript("top.ui.alert('工程量必须输入');");
            this.txtQuantity.Focus();
            return;
        }
        if (string.IsNullOrEmpty(value))
        {
            base.RegisterScript("top.ui.alert('综合单价必须输入');");
            this.txtUnitPrice.Focus();
            return;
        }
        string taskCode = this.txtTaskCode.Text.Trim();
        bool   flag     = false;

        if (this.ViewState["oldCode"] != null)
        {
            this.ViewState["oldCode"].ToString();
        }
        else
        {
            string arg_B0_0 = string.Empty;
        }
        if (flag)
        {
            base.RegisterScript("top.ui.alert('清单编码不能重复');");
            this.txtTaskCode.Focus();
            return;
        }
        string taskName = this.txtTaskName.Text.Trim();

        System.DateTime?startDate = null;
        if (!string.IsNullOrEmpty(this.txtStartDate.Text))
        {
            startDate = new System.DateTime?(System.Convert.ToDateTime(this.txtStartDate.Text));
        }
        System.DateTime?endDate = null;
        if (!string.IsNullOrEmpty(this.txtEndDate.Text))
        {
            endDate = new System.DateTime?(System.Convert.ToDateTime(this.txtEndDate.Text));
        }
        string unit               = this.txtUnit.Text.Trim();
        string arg_15D_0          = this.ddlTaskType.SelectedValue;
        string note               = this.txtNote.Text.Trim();
        int?   constructionPeriod = null;

        if (!string.IsNullOrEmpty(this.txtConstructionPeriod.Text.Trim()))
        {
            constructionPeriod = new int?(System.Convert.ToInt32(this.txtConstructionPeriod.Text.Trim()));
        }
        string arg_1B6_0 = this.txtConstructionPeriod.Text;
        BudContractTaskService budContractTaskService = new BudContractTaskService();

        cn.justwin.Domain.Entities.BudContractTask budContractTask;
        if (this.type.ToUpper() == "EDIT")
        {
            budContractTask = budContractTaskService.GetById(this.id);
        }
        else
        {
            budContractTask             = new cn.justwin.Domain.Entities.BudContractTask();
            budContractTask.TaskId      = System.Guid.NewGuid().ToString();
            budContractTask.OrderNumber = cn.justwin.Domain.BudContractTask.GetOrderNumber(this.prjId, this.id);
            if (string.IsNullOrEmpty(this.id))
            {
                budContractTask.ParentId = null;
            }
            else
            {
                budContractTask.ParentId = this.id;
            }
            budContractTask.PrjId     = this.prjId;
            budContractTask.InputUser = base.UserCode;
            budContractTask.InputDate = System.DateTime.Now;
        }
        budContractTask.TaskCode           = taskCode;
        budContractTask.TaskName           = taskName;
        budContractTask.Unit               = unit;
        budContractTask.Quantity           = System.Convert.ToDecimal(text);
        budContractTask.StartDate          = startDate;
        budContractTask.EndDate            = endDate;
        budContractTask.ConstructionPeriod = constructionPeriod;
        budContractTask.Note               = note;
        budContractTask.UnitPrice          = new decimal?(System.Convert.ToDecimal(value));
        budContractTask.Total              = new decimal?(value2);
        budContractTask.TaskType           = "";
        budContractTask.FeatureDescription = this.txtDescription.Text.Trim();
        budContractTask.MainMaterial       = new decimal?(System.Convert.ToDecimal(this.txtMainMaterial.Text.Trim()));
        budContractTask.SubMaterial        = new decimal?(System.Convert.ToDecimal(this.txtSubMaterial.Text.Trim()));
        budContractTask.Labor              = new decimal?(System.Convert.ToDecimal(this.txtLabor.Text.Trim()));
        if (this.type.ToUpper() == "EDIT")
        {
            budContractTaskService.Update(budContractTask);
        }
        else
        {
            budContractTaskService.Add(budContractTask);
        }
        string str  = "resetData();";
        string str2 = "top.ui.winSuccess({parentName:'_BudContractTaskTaskEdit'});";

        base.RegisterScript(str + str2);
    }
Esempio n. 8
0
        public int ConverConTaskList(string[] colArray, string inputUser, List <string> errors)
        {
            int num = 0;
            List <cn.justwin.Domain.Entities.BudContractTask> list = new List <cn.justwin.Domain.Entities.BudContractTask>();
            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   str         = string.Empty;
            string   str2        = string.Empty;
            string   str3        = string.Empty;
            decimal  num2        = 0M;
            decimal  num3        = 0M;
            decimal  num4        = 0M;
            DateTime?nullable    = null;
            DateTime?nullable2   = null;
            string   str4        = string.Empty;
            string   orderNumber = cn.justwin.Domain.BudContractTask.GetOrderNumber(this.prjId, this.taskId);
            string   str6        = string.Empty;
            int      num5        = 0;
            string   str7        = string.Empty;
            decimal  num6        = 0M;
            decimal  num7        = 0M;
            decimal  num8        = 0M;
            string   str8        = string.Empty;

            for (int i = this.startIndex; i < this.taskTable.Rows.Count; i++)
            {
                bool    flag = true;
                DataRow row  = this.taskTable.Rows[i];
                str = (row[this.codeIndex] == null) ? "" : row[this.codeIndex].ToString();
                string item = string.Empty;
                str2 = (row[this.nameIndex] == null) ? "" : row[this.nameIndex].ToString();
                num2 = 0M;
                num3 = 0M;
                num4 = 0M;
                if (this.quantityIndex != -1)
                {
                    try
                    {
                        string str10 = row[this.quantityIndex].ToString().Trim();
                        if (!string.IsNullOrEmpty(str10))
                        {
                            num2 = decimal.Parse(str10);
                        }
                    }
                    catch
                    {
                        item = "在您的Excel中:编码" + str + ",存在非有效的数字,请修改!";
                        errors.Add(item);
                        flag = false;
                    }
                }
                if (this.unitPriceIndex != -1)
                {
                    try
                    {
                        string str11 = row[this.unitPriceIndex].ToString().Trim();
                        if (!string.IsNullOrEmpty(str11))
                        {
                            num3 = decimal.Parse(str11);
                        }
                    }
                    catch
                    {
                        item = "在您的Excel中:编码" + str + ",存在非有效的数字,请修改!";
                        errors.Add(item);
                        flag = false;
                    }
                }
                if (this.totalIndex != -1)
                {
                    try
                    {
                        string str12 = row[this.totalIndex].ToString().Trim();
                        if (!string.IsNullOrEmpty(str12))
                        {
                            num4 = decimal.Parse(str12);
                        }
                    }
                    catch
                    {
                        item = "在您的Excel中:编码" + str + ",存在非有效的数字,请修改!";
                        errors.Add(item);
                        flag = false;
                    }
                }
                if (this.unitIndex != -1)
                {
                    str3 = row[this.unitIndex].ToString();
                }
                if (this.startDateIndex != -1)
                {
                    try
                    {
                        string str13 = row[this.startDateIndex].ToString().Trim();
                        if (!string.IsNullOrEmpty(str13))
                        {
                            nullable = new DateTime?(Convert.ToDateTime(str13));
                        }
                        else
                        {
                            nullable = null;
                        }
                    }
                    catch
                    {
                    }
                }
                if (this.endDateIndex != -1)
                {
                    try
                    {
                        string str14 = row[this.endDateIndex].ToString().Trim();
                        if (!string.IsNullOrEmpty(str14))
                        {
                            nullable2 = new DateTime?(Convert.ToDateTime(str14));
                        }
                        else
                        {
                            nullable2 = null;
                        }
                    }
                    catch
                    {
                    }
                }
                if (this.noteIndex != -1)
                {
                    str4 = row[this.noteIndex].ToString();
                }
                if (this.constructionPeriodIndex != -1)
                {
                    try
                    {
                        num5 = Convert.ToInt32(row[this.constructionPeriodIndex]);
                    }
                    catch
                    {
                    }
                }
                if (this.featureDescriptionIndex != -1)
                {
                    try
                    {
                        str7 = row[this.featureDescriptionIndex].ToString();
                    }
                    catch
                    {
                    }
                }
                if (this.mainMaterialIndex != -1)
                {
                    try
                    {
                        string str15 = row[this.mainMaterialIndex].ToString();
                        if (!string.IsNullOrEmpty(str15))
                        {
                            num6 = decimal.Parse(str15);
                        }
                        else
                        {
                            num6 = decimal.Parse("0.00");
                        }
                    }
                    catch
                    {
                        item = "在您的Excel中:编码" + str + ",存在非有效数字类型,请修改!";
                        errors.Add(item);
                        flag = false;
                    }
                }
                if (this.subMaterialIndex != -1)
                {
                    try
                    {
                        string str16 = row[this.subMaterialIndex].ToString();
                        if (!string.IsNullOrEmpty(str16))
                        {
                            num7 = decimal.Parse(str16);
                        }
                        else
                        {
                            num7 = decimal.Parse("0.00");
                        }
                    }
                    catch
                    {
                        item = "在您的Excel中:编码" + str + ",存在非有效数字类型,请修改!";
                        errors.Add(item);
                        flag = false;
                    }
                }
                if (this.laborIndex != -1)
                {
                    try
                    {
                        string str17 = row[this.laborIndex].ToString();
                        if (!string.IsNullOrEmpty(str17))
                        {
                            num8 = decimal.Parse(str17);
                        }
                        else
                        {
                            num8 = decimal.Parse("0.00");
                        }
                    }
                    catch
                    {
                        item = "在您的Excel中:编码" + str + ",存在非有效数字类型,请修改!";
                        errors.Add(item);
                        flag = false;
                    }
                }
                if (row.Table.Columns.Contains("序号"))
                {
                    str8 = row["序号"].ToString();
                }
                if (!flag)
                {
                    item = "在您的Excel中:编码" + str + ",存在错误数据导致其子节点不能导入!";
                    errors.Add(item);
                    int    num10 = 0;
                    string str18 = orderNumberByLayer[i];
                    for (int j = i + 1; j < orderNumberByLayer.Count; j++)
                    {
                        if (orderNumberByLayer[j].StartsWith(str18))
                        {
                            num10++;
                        }
                    }
                    i += num10;
                }
                else
                {
                    num++;
                    string str19 = Guid.NewGuid().ToString();
                    string str20 = (this.taskId == "") ? null : this.taskId;
                    cn.justwin.Domain.Entities.BudContractTask task = new cn.justwin.Domain.Entities.BudContractTask {
                        TaskId             = str19,
                        TaskCode           = str,
                        TaskName           = str2,
                        Unit               = str3,
                        UnitPrice          = new decimal?(num3),
                        Quantity           = num2,
                        Total              = new decimal?(num4),
                        Note               = str4,
                        ParentId           = str20,
                        PrjId              = this.prjId,
                        OrderNumber        = null,
                        StartDate          = nullable,
                        EndDate            = nullable2,
                        InputDate          = DateTime.Now,
                        InputUser          = inputUser,
                        ConstructionPeriod = new int?(num5),
                        TaskType           = "",
                        FeatureDescription = str7,
                        MainMaterial       = new decimal?(num6),
                        SubMaterial        = new decimal?(num7),
                        Labor              = new decimal?(num8)
                    };
                    string str21 = orderNumberByLayer[i].Substring(3);
                    if (string.IsNullOrEmpty(str21))
                    {
                        if (i > this.startIndex)
                        {
                            orderNumber = cn.justwin.Domain.BudContractTask.GetOrderNumber(this.prjId, this.taskId);
                        }
                        task.OrderNumber = orderNumber;
                    }
                    else
                    {
                        task.OrderNumber = orderNumber + str21;
                    }
                    if (i > 0)
                    {
                        int count = list.Count;
                        if (count > 0)
                        {
                            if ((orderNumberByLayer[i].Length - str6.Length) == 3)
                            {
                                task.ParentId = list[count - 1].TaskId;
                            }
                            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 num13             = list.FindLastIndex(t => t.OrderNumber.Length == (length + differOrderNumber));
                                    task.ParentId = list[num13].ParentId;
                                }
                            }
                        }
                    }
                    str6 = orderNumberByLayer[i];
                    new BudContractTaskService().Add(task);
                    list.Add(task);
                    if (!string.IsNullOrEmpty(str8))
                    {
                        this.AddSerialNoAndTaskId(str8, task.TaskId);
                    }
                    else
                    {
                        this.AddCodeAndTaskId(task.TaskCode, task.TaskId);
                    }
                }
            }
            return(num);
        }