Example #1
0
        private void ShowInfo(int _id)
        {
            BLL.CheckRecord   bll   = new BLL.CheckRecord();
            Model.CheckRecord model = bll.GetModel(_id);

            ddlCustomer.SelectedValue = model.CustomerId.ToString();
            GoodsBind(model.CustomerId);
            ddlGoods.SelectedValue        = model.GoodsId.ToString();
            ddlVehicle.SelectedValue      = model.VehicleId.ToString();
            ddlHandlingMode.SelectedValue = model.HandlingModeId.ToString();
            txtCheckTime.Text             = model.CheckTime.ToString("yyyy-MM-dd");
            txtInspectionNumber.Text      = model.InspectionNumber;
            txtCaseNumber.Text            = model.CaseNumber;
            txtCheckResult.Text           = model.CheckResult;
            txtRealName.Text = model.RealName;
            txtLinkTel.Text  = model.LinkTel;
            txtAdmin.Text    = model.Admin;
            txtRemark.Text   = model.Remark;

            BLL.CheckCost checkCostBLL = new BLL.CheckCost();
            DataTable     checkCostDT  = checkCostBLL.GetList(" CheckRecordId = " + _id + "").Tables[0];

            this.rptCostList.DataSource = checkCostDT;
            this.rptCostList.DataBind();
        }
Example #2
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.CheckRecord   bll   = new BLL.CheckRecord();
            Model.CheckRecord model = bll.GetModel(_id);

            model.CustomerId       = int.Parse(ddlCustomer.SelectedValue);
            model.GoodsId          = int.Parse(ddlGoods.SelectedValue);
            model.VehicleId        = int.Parse(ddlVehicle.SelectedValue);
            model.HandlingModeId   = int.Parse(ddlHandlingMode.SelectedValue);
            model.InspectionNumber = txtInspectionNumber.Text;
            model.CaseNumber       = txtCaseNumber.Text;
            model.CheckResult      = txtCheckResult.Text;
            model.RealName         = txtRealName.Text;
            model.LinkTel          = txtLinkTel.Text;
            model.CheckTime        = DateTime.Parse(txtCheckTime.Text);
            model.Admin            = txtAdmin.Text;
            model.Remark           = txtRemark.Text;
            model.Status           = 0;
            model.CreateTime       = DateTime.Now;

            #region 费用
            string[] costName       = Request.Form.GetValues("CostName");
            string[] costCount      = Request.Form.GetValues("CostCount");
            string[] costType       = Request.Form.GetValues("CostType");
            string[] costTotalPrice = Request.Form.GetValues("CostTotalPrice");
            string[] costCustomer   = Request.Form.GetValues("CostCustomer");
            string[] costUnitPrices = Request.Form.GetValues("CostUnitPrice");
            if (costName != null && costCount != null && costType != null && costTotalPrice != null && costCustomer != null && costUnitPrices != null &&
                costName.Length > 0 && costCount.Length > 0 && costType.Length > 0 && costTotalPrice.Length > 0 && costCustomer.Length > 0 && costUnitPrices.Length > 0)
            {
                for (int i = 0; i < costName.Length; i++)
                {
                    decimal count, totalPrice, unitPrice;
                    if (decimal.TryParse(costCount[i], out count) &&
                        decimal.TryParse(costTotalPrice[i], out totalPrice) &&
                        decimal.TryParse(costUnitPrices[i], out unitPrice))
                    {
                        if (costType[i].ToString().Equals("-"))
                        {
                            totalPrice *= -1;
                        }
                        model.AddCheckCost(new CheckCost(costName[i], unitPrice, count, totalPrice, costCustomer[i], ""));
                    }
                }
            }
            #endregion

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改查验记录信息:" + model.Id); //记录日志
                result = true;
            }
            return(result);
        }
Example #3
0
        private bool DoAdd()
        {
            bool result = false;
            Model.CheckRecord model = new Model.CheckRecord();
            BLL.CheckRecord bll = new BLL.CheckRecord();

            model.CustomerId = int.Parse(ddlCustomer.SelectedValue);
            model.GoodsId = int.Parse(ddlGoods.SelectedValue);
            model.VehicleId = int.Parse(ddlVehicle.SelectedValue);
            model.HandlingModeId = int.Parse(ddlHandlingMode.SelectedValue);
            model.InspectionNumber = txtInspectionNumber.Text;
            model.CaseNumber = txtCaseNumber.Text;
            model.CheckResult = txtCheckResult.Text;
            model.RealName = txtRealName.Text;
            model.LinkTel = txtLinkTel.Text;
            model.CheckTime = DateTime.Parse(txtCheckTime.Text);
            model.Admin = txtAdmin.Text;
            model.Remark = txtRemark.Text;
            model.Status = 0;
            model.CreateTime = DateTime.Now;

            #region 费用
            string[] costName = Request.Form.GetValues("CostName");
            string[] costCount = Request.Form.GetValues("CostCount");
            string[] costType = Request.Form.GetValues("CostType");
            string[] costTotalPrice = Request.Form.GetValues("CostTotalPrice");
            string[] costCustomer = Request.Form.GetValues("CostCustomer");
            string[] costUnitPrices = Request.Form.GetValues("CostUnitPrice");
            if (costName != null && costCount != null && costType != null && costTotalPrice != null && costCustomer != null && costUnitPrices != null
                && costName.Length > 0 && costCount.Length > 0 && costType.Length > 0 && costTotalPrice.Length > 0 && costCustomer.Length > 0 && costUnitPrices.Length > 0)
            {
                for (int i = 0; i < costName.Length; i++)
                {
                    decimal count, totalPrice, unitPrice;
                    if (decimal.TryParse(costCount[i], out count)
                        && decimal.TryParse(costTotalPrice[i], out totalPrice)
                        && decimal.TryParse(costUnitPrices[i], out unitPrice))
                    {
                        if (costType[i].ToString().Equals("-"))
                        {
                            totalPrice *= -1;
                        }
                        model.AddCheckCost(new CheckCost(costName[i], unitPrice, count, totalPrice, costCustomer[i], ""));
                    }
                }
            }
            #endregion

            if (bll.Add(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加查验记录:" + model.Id); //记录日志
                result = true;
            }
            return result;
        }