Пример #1
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                ProductCheck MasterEntity = (ProductCheck)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM Att_ProductCheck WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID);
                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(Sql);
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(Sql);
                }

                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E);
            }
        }
Пример #2
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private ProductCheck EntityGet()
        {
            ProductCheck entity = new ProductCheck();

            entity.ID = HTDataID;
            return(entity);
        }
Пример #3
0
 private void metroTileProductCheckAdd_Click(object sender, EventArgs e)
 {
     try
     {
         if (String.IsNullOrEmpty(metroTextBoxQuantity.Text))
         {
             throw new Exception("Поля не должны быть пустыми");
         }
         using (ApplicationDbContext context = new ApplicationDbContext())
         {
             ProductCheck productCheck = new ProductCheck()
             {
                 CheckId   = CheckId,
                 ProductId = Convert.ToInt32(metroComboBoxProduct.SelectedValue),
                 Quantity  = Convert.ToInt32(metroTextBoxQuantity.Text),
             };
             context.ProductChecks.Add(productCheck);
             context.SaveChanges();
             var     productchecks = context.ProductChecks.Include(c => c.Check).Include(p => p.Product).Where(c => c.CheckId == CheckId).ToList();
             var     check         = context.Checks.SingleOrDefault(c => c.CheckId == CheckId);
             decimal checkAmount   = productchecks.Sum(s => s.Quantity * s.Product.ProductCost);
             check.Amount = checkAmount;
             context.Entry(check).State = EntityState.Modified;
             context.SaveChanges();
         }
         MessageBox.Show("Запись успешно изменена!", "Compuhter");
         this.Close();
     }
     catch (Exception gg)
     {
         MessageBox.Show(gg.Message, "Ошибка");
     }
 }
Пример #4
0
 /// <summary>
 /// 新增(传入事务处理)
 /// </summary>
 /// <param name="p_BE">要新增的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         ProductCheck entity = (ProductCheck)p_BE;
         string       sql    = "SELECT FormNo FROM Att_ProductCheck WHERE FormNo=" + SysString.ToDBString(entity.FormNo);
         DataTable    dt     = sqlTrans.Fill(sql);
         if (dt.Rows.Count > 0)
         {
             throw new BaseException("单号已存在,请重新生成");
         }
         ProductCheckCtl control = new ProductCheckCtl(sqlTrans);
         entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Att_ProductCheck, sqlTrans);
         control.AddNew(entity);
         FormNoControlRule rulest = new FormNoControlRule();
         rulest.RAddSort((int)FormNoControlEnum.成品检验单号, sqlTrans);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Пример #5
0
 /// <summary>
 /// 保存(传入事务处理)
 /// </summary>
 /// <param name="p_Entity"></param>
 /// <param name="p_BE"></param>
 /// <param name="sqlTrans"></param>
 public void RSave(ProductCheck p_Entity, BaseEntity[] p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         string sql = "DELETE FROM Att_ProductCheckDts WHERE MainID=" + p_Entity.ID.ToString();
         sql += " AND ID NOT IN" + string.Format("({0})", GetIDExist(p_BE));
         sqlTrans.ExecuteNonQuery(sql);//删除原单据里应该删除的明细数据,即数据库里有但是UI里已经删除的数据
         for (int i = 0; i < p_BE.Length; i++)
         {
             ProductCheckDts entitydts = (ProductCheckDts)p_BE[i];
             if (entitydts.ID != 0)//ID不为0说明数据库中已经存在
             {
                 this.RUpdate(entitydts, sqlTrans);
             }
             else
             {
                 entitydts.MainID = p_Entity.ID;
                 this.RAdd(entitydts, sqlTrans);
             }
         }
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Пример #6
0
        /// <summary>
        /// 删除
        /// </summary>
        public override void EntityDelete()
        {
            ProductCheckRule rule   = new ProductCheckRule();
            ProductCheck     entity = EntityGet();

            rule.RDelete(entity);
        }
        public async Task <IActionResult> PutProductCheck(int id, ProductCheck productCheck)
        {
            if (id != productCheck.ProductId)
            {
                return(BadRequest());
            }

            if (productCheck.ImageFile != null)
            {
                DeleteImage(productCheck.ImageName);
                productCheck.ImageName = await SaveImage(productCheck.ImageFile);
            }
            _context.Entry(productCheck).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProductCheckExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #8
0
        /// <summary>
        /// 修改
        /// </summary>
        public override void EntityUpdate()
        {
            ProductCheckRule rule   = new ProductCheckRule();
            ProductCheck     entity = EntityGet();

            ProductCheckDts[] entitydts = EntityDtsGet();
            entity.SubmitFlag = this.HTSubmitFlagUpdateGet();
            rule.RUpdate(entity, entitydts);
        }
        public async Task <ActionResult <ProductCheck> > PostProductCheck([FromForm] ProductCheck productCheck)
        {
            productCheck.ImageName = await SaveImage(productCheck.ImageFile);

            _context.ProductCheckTable.Add(productCheck);
            await _context.SaveChangesAsync();

            return(StatusCode(201));
        }
Пример #10
0
        /// <summary>
        /// 新增
        /// </summary>
        public override int EntityAdd()
        {
            ProductCheckRule rule   = new ProductCheckRule();
            ProductCheck     entity = EntityGet();

            ProductCheckDts[] entitydts = EntityDtsGet();

            entity.SubmitFlag = this.HTSubmitFlagInsertGet();
            rule.RAdd(entity, entitydts);
            return(entity.ID);
        }
Пример #11
0
        /// <summary>
        /// 检验字段值是否已存在
        /// </summary>
        /// <param name="p_TableName">表名</param>
        /// <param name="p_FieldName">字段名</param>
        /// <param name="p_FieldValue">字段值</param>
        /// <param name="p_KeyField">主键(只考虑主键为ID的情况)</param>
        /// <param name="p_KeyValue">主键值</param>
        /// <param name="p_sqlTrans"></param>
        /// <returns></returns>
        private bool CheckFieldValueIsExist(BaseEntity p_BE, string p_FieldName, string p_FieldValue, IDBTransAccess p_sqlTrans)
        {
            ProductCheck entity = (ProductCheck)p_BE;
            bool         ret    = false;
            string       sql    = string.Format(" SELECT {0} FROM {1} WHERE 1=1 AND {0}={2} AND {3}<>{4}", p_FieldName, ProductCheck.TableName, SysString.ToDBString(p_FieldValue), "ID", entity.ID);
            DataTable    dt     = p_sqlTrans.Fill(sql);

            if (dt.Rows.Count != 0)
            {
                ret = true;
            }

            return(ret);
        }
Пример #12
0
        public async Task <IActionResult> EditProduct(ProductCheck check, int productId)
        {
            if (checkLogStatus() == false)
            {
                return(RedirectToAction("LoginPage", "User"));
            }
            else
            {
                Product thisProduct = _context.Products.Where(a => a.ProductId == productId).SingleOrDefault();
                if (ModelState.IsValid)
                {
                    thisProduct.Title       = check.Title;
                    thisProduct.Description = check.Description;
                    thisProduct.Price       = check.Price;
                    thisProduct.Condition   = check.Condition;
                    thisProduct.Status      = check.Status;
                    var uploadDestination = Path.Combine(_hostingEnvironment.WebRootPath, "uploaded_images");
                    if (check.Image != null)
                    {
                        var filepath = Path.Combine(uploadDestination, check.Image.FileName);
                        using (var fileStream = new FileStream(filepath, FileMode.Create))
                        {
                            await check.Image.CopyToAsync(fileStream);

                            thisProduct.Picture = "/uploaded_images/" + check.Image.FileName;
                        }
                    }
                    TempData["complete"] = "true";
                    _context.SaveChanges();
                    return(RedirectToAction("ProductPageEdit"));
                }
                else
                {
                    if (checkUserStatus() == false)
                    {
                        TempData["Error"] = "Inputed data incorrect";
                        return(View("ProductPageEdit"));
                    }
                    else
                    {
                        TempData["Error"] = "Inputed data incorrect";
                        return(View("AdminProductPageEdit"));
                    }
                }
            }
        }
Пример #13
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="p_BE">要修改的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RUpdate(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         ProductCheck    entity  = (ProductCheck)p_BE;
         ProductCheckCtl control = new ProductCheckCtl(sqlTrans);
         control.Update(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Пример #14
0
        public async Task <IActionResult> productAdd(ProductCheck check)
        {
            int?id = HttpContext.Session.GetInt32("userId");

            if (id == null)
            {
                return(RedirectToAction("LoginPage", "User"));
            }
            else
            {
                if (ModelState.IsValid)
                {
                    User    exists     = _context.Users.Where(u => u.UserId == id).SingleOrDefault();
                    Product newProduct = new Product
                    {
                        Title       = check.Title,
                        Description = check.Description,
                        Price       = check.Price,
                        UserId      = (int)id,
                        CreatedAt   = DateTime.Now,
                        Condition   = check.Condition,
                        Status      = "Active"
                    };
                    var uploadDestination = Path.Combine(_hostingEnvironment.WebRootPath, "uploaded_images");
                    if (check.Image != null)
                    {
                        var filepath = Path.Combine(uploadDestination, check.Image.FileName);
                        using (var fileStream = new FileStream(filepath, FileMode.Create))
                        {
                            await check.Image.CopyToAsync(fileStream);

                            newProduct.Picture = "/uploaded_images/" + check.Image.FileName;
                        }
                    }
                    _context.Add(newProduct);
                    _context.SaveChanges();
                }
                else
                {
                    TempData["error"] = "Not added. Error";
                }
                return(RedirectToAction("Homepage"));
            }
        }
Пример #15
0
        /// <summary>
        /// 设置
        /// </summary>
        public override void EntitySet()
        {
            ProductCheck entity = new ProductCheck();

            entity.ID = HTDataID;
            bool findFlag = entity.SelectByID();

            txtFormNo.Text         = entity.FormNo.ToString();
            drpShopID.EditValue    = entity.ShopID;
            txtFormDate.DateTime   = entity.FormDate;
            drpCheckOPID.EditValue = entity.CheckOPID;
            txtBuyFormNo.Text      = entity.BuyFormNo.ToString();
            drpVendorID.EditValue  = entity.VendorID;
            txtRemark.Text         = entity.Remark.ToString();
            HTDataSubmitFlag       = entity.SubmitFlag;
            HTDataDelFlag          = entity.DelFlag;
            if (!findFlag)
            {
            }

            BindGridDts();
        }
Пример #16
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private ProductCheck EntityGet()
        {
            ProductCheck entity = new ProductCheck();

            entity.ID = HTDataID;
            entity.SelectByID();

            entity.FormNo     = txtFormNo.Text.Trim();
            entity.MakeOPID   = FParamConfig.LoginID;
            entity.MakeOPName = FParamConfig.LoginName;
            entity.MakeDate   = DateTime.Now.Date;
            entity.CheckOPID  = SysConvert.ToString(drpCheckOPID.EditValue);
            entity.ShopID     = SysConvert.ToString(drpShopID.EditValue);
            entity.FormDate   = txtFormDate.DateTime.Date;
            entity.CheOPID    = SysConvert.ToString(drpCheckOPID.EditValue);
            entity.BuyFormNo  = txtBuyFormNo.Text.Trim();
            entity.VendorID   = SysConvert.ToString(drpVendorID.EditValue);
            entity.Remark     = txtRemark.Text.Trim();


            return(entity);
        }
Пример #17
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_BE">要删除的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                ProductCheck    entity  = (ProductCheck)p_BE;
                ProductCheckCtl control = new ProductCheckCtl(sqlTrans);


                string sql = "DELETE FROM Att_ProductCheckDts WHERE MainID=" + entity.ID.ToString();
                sqlTrans.ExecuteNonQuery(sql);//删除原单据明细数据

                control.Delete(entity);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
        public void Execute()
        {
            StateCheck   stateCheck   = new StateCheck();
            ProductCheck ProductCheck = new ProductCheck();
            OrderManager manager      = OrderManagerFactory.Create();

            Console.Clear();
            Console.WriteLine("Add Order");
            Console.WriteLine("=================================");
            Console.WriteLine();
            bool   future = false;
            string ProductType;
            string ValidateProduct;
            Order  Statecheck;
            Order  newOrder = new Order();
            // DateTime LineDate = DateTime.Today;
            DateTime LineDate;

            do
            {
                LineDate = ConsoleIO.GetRequiredDateFromUser("LineDate: ");
                if (LineDate >= DateTime.Today)
                {
                    future = true;
                }
                else
                {
                    Console.WriteLine("Please enter a date in the future");
                }
            } while (future == false);
            newOrder.Date         = LineDate;
            newOrder.CustomerName = ConsoleIO.GetRequiredStringFromUser("Name: ");
            do
            {
                string State = ConsoleIO.GetRequiredStringFromUser("State: ");
                Statecheck = stateCheck.CheckForGivenString(State);
            } while (Statecheck.State == "0");
            newOrder.State = Statecheck.State;

            decimal TaxRate = Statecheck.TaxRate;

            newOrder.TaxRate = TaxRate;
            Console.WriteLine("=================================");
            ProductCheck.MakeAListOfDataForDisplay();
            Console.WriteLine("=================================");
            do
            {
                ProductType     = ConsoleIO.GetRequiredStringFromUser("ProductType: ");
                ValidateProduct = ProductCheck.CheckForGivenString(ProductType).ProductType;
            } while (ValidateProduct == "0");
            newOrder.ProductType = ValidateProduct;

            decimal Area = ConsoleIO.GetRequiredAreaFromUser("Area ");

            newOrder.Area = Area;
            decimal CostPerSquareFoot = ProductCheck.CheckForGivenString(ProductType).CostPerSquareFoot;

            newOrder.CostPerSquareFoot = CostPerSquareFoot;
            decimal LaborCostPerSquareFoot = ProductCheck.CheckForGivenString(ProductType).LaborCostPerSquareFoot;

            newOrder.LaborCostPerSquareFoot = LaborCostPerSquareFoot;
            decimal MaterialCost = Area * CostPerSquareFoot;

            newOrder.MaterialCost = MaterialCost;
            decimal LaborCost = Area * LaborCostPerSquareFoot;

            newOrder.LaborCost = LaborCost;
            decimal tax = (MaterialCost + LaborCost) * (TaxRate / 100);

            newOrder.Tax   = tax;
            newOrder.Total = (MaterialCost + LaborCost + tax);

            Console.WriteLine("=================================");
            ConsoleIO.DisplayNewOrder(newOrder);
            Console.WriteLine("=================================");



            if (ConsoleIO.GetYesNoAnswerFromUser("Add the following information") == "Y")
            {
                AddOrderResponse response = manager.AddOrder(newOrder, LineDate);
                response.Sucess = true;
                Console.WriteLine("Order Added!");
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("Add Cancelled");
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey();
            }
        }
Пример #19
0
 /// <summary>
 /// 检查将要操作的数据是否符合业务规则
 /// </summary>
 /// <param name="p_BE"></param>
 private void CheckCorrect(BaseEntity p_BE)
 {
     ProductCheck entity = (ProductCheck)p_BE;
 }
Пример #20
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                ProductCheck MasterEntity = (ProductCheck)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO Att_ProductCheck(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("ID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ",");
                MasterField.Append("FormNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FormNo) + ",");
                MasterField.Append("MakeOPID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MakeOPID) + ",");
                MasterField.Append("MakeOPName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MakeOPName) + ",");
                MasterField.Append("MakeDate" + ",");
                if (MasterEntity.MakeDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.MakeDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("CheckOPID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.CheckOPID) + ",");
                MasterField.Append("CheckDate" + ",");
                if (MasterEntity.CheckDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.CheckDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("SubmitFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SubmitFlag) + ",");
                MasterField.Append("DelFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DelFlag) + ",");
                MasterField.Append("ShopID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ShopID) + ",");
                MasterField.Append("FormDate" + ",");
                if (MasterEntity.FormDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.FormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("CheOPID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.CheOPID) + ",");
                MasterField.Append("BuyFormNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.BuyFormNo) + ",");
                MasterField.Append("VendorID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VendorID) + ",");
                MasterField.Append("Remark" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ",");
                MasterField.Append("WHRelFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.WHRelFlag) + ",");
                MasterField.Append("WHFormNo" + ")");
                MasterValue.Append(SysString.ToDBString(MasterEntity.WHFormNo) + ")");



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBInsert), E);
            }
        }
Пример #21
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Update(BaseEntity p_Entity)
        {
            try
            {
                ProductCheck MasterEntity = (ProductCheck)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE Att_ProductCheck SET ");
                UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ",");
                UpdateBuilder.Append(" FormNo=" + SysString.ToDBString(MasterEntity.FormNo) + ",");
                UpdateBuilder.Append(" MakeOPID=" + SysString.ToDBString(MasterEntity.MakeOPID) + ",");
                UpdateBuilder.Append(" MakeOPName=" + SysString.ToDBString(MasterEntity.MakeOPName) + ",");

                if (MasterEntity.MakeDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" MakeDate=" + SysString.ToDBString(MasterEntity.MakeDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" MakeDate=null,");
                }

                UpdateBuilder.Append(" CheckOPID=" + SysString.ToDBString(MasterEntity.CheckOPID) + ",");

                if (MasterEntity.CheckDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" CheckDate=" + SysString.ToDBString(MasterEntity.CheckDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" CheckDate=null,");
                }

                UpdateBuilder.Append(" SubmitFlag=" + SysString.ToDBString(MasterEntity.SubmitFlag) + ",");
                UpdateBuilder.Append(" DelFlag=" + SysString.ToDBString(MasterEntity.DelFlag) + ",");
                UpdateBuilder.Append(" ShopID=" + SysString.ToDBString(MasterEntity.ShopID) + ",");

                if (MasterEntity.FormDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" FormDate=" + SysString.ToDBString(MasterEntity.FormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" FormDate=null,");
                }

                UpdateBuilder.Append(" CheOPID=" + SysString.ToDBString(MasterEntity.CheOPID) + ",");
                UpdateBuilder.Append(" BuyFormNo=" + SysString.ToDBString(MasterEntity.BuyFormNo) + ",");
                UpdateBuilder.Append(" VendorID=" + SysString.ToDBString(MasterEntity.VendorID) + ",");
                UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ",");
                UpdateBuilder.Append(" WHRelFlag=" + SysString.ToDBString(MasterEntity.WHRelFlag) + ",");
                UpdateBuilder.Append(" WHFormNo=" + SysString.ToDBString(MasterEntity.WHFormNo));

                UpdateBuilder.Append(" WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID));



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBUpdate), E);
            }
        }
        public void Execute()
        {
            string       ProductType;
            Order        ValidateProduct;
            ProductCheck ProductCheck = new ProductCheck();
            StateCheck   stateCheck   = new StateCheck();
            OrderManager manager      = OrderManagerFactory.Create();

            Console.Clear();
            Console.WriteLine("Edit an Order");
            Console.WriteLine("=================================");
            Console.WriteLine();
            Order    Statecheck;
            Order    newOrder    = new Order();
            DateTime LineDate    = Convert.ToDateTime(ConsoleIO.GetRequiredStringFromUser("LineDate: "));
            int      OrderNumber = ConsoleIO.GetRequiredIntFromUser("OrderNumber: ");

            newOrder.CustomerName = ConsoleIO.GetRequiredStringFromUserForEdit("Name: ");
            do
            {
                string State = ConsoleIO.GetRequiredStringFromUserForEdit("State:");
                Statecheck = stateCheck.CheckForGivenString(State);
            } while (Statecheck.State == "0");
            newOrder.State   = Statecheck.State;
            newOrder.TaxRate = Statecheck.TaxRate;
            Console.WriteLine("=================================");
            ProductCheck.MakeAListOfDataForDisplay();
            Console.WriteLine("=================================");
            do
            {
                ProductType     = ConsoleIO.GetRequiredStringFromUserForEdit("ProductType: ");
                ValidateProduct = ProductCheck.CheckForGivenString(ProductType);
            } while (ValidateProduct.ProductType == "0");
            newOrder.ProductType            = ValidateProduct.ProductType;
            newOrder.CostPerSquareFoot      = ValidateProduct.CostPerSquareFoot;
            newOrder.LaborCostPerSquareFoot = ValidateProduct.LaborCostPerSquareFoot;

            newOrder.Area = ConsoleIO.GetRequiredDecimalFromUserForEdit("Area ");



            EditOrderResponse response = manager.EditOrder(newOrder, LineDate, OrderNumber);


            if (response.Order.Area == 1)
            {
                if (ConsoleIO.GetYesNoAnswerFromUser("Add the following information") == "Y")
                {
                    manager.EditOrder(newOrder, LineDate, OrderNumber);
                    Console.WriteLine("Order Added!");
                    Console.WriteLine("Press any key to continue...");
                    Console.ReadKey();
                }
                else
                {
                    Console.WriteLine("Add Cancelled");
                    Console.WriteLine("Press any key to continue...");
                    Console.ReadKey();
                }
            }

            if (response.Order.Area == -1)
            {
                Console.WriteLine("The ordernumber entered does not exist ");
                Console.WriteLine("Press any key to continue... ");
                Console.ReadKey();
            }

            if (response.Order.Area == -2)
            {
                Console.WriteLine("We do not have a file for that date, try making one ");
                Console.WriteLine("Press any key to continue... ");
                Console.ReadKey();
            }
        }