예제 #1
0
        public bool Update(CsParts model)
        {
            var strSql = new StringBuilder();

            strSql.Append("UPDATE CrabShop.dbo.[CsParts] SET ");
            strSql.Append("PartType = @PartType,PartName = @PartName,PartWeight = @PartWeight,PartPrice = @PartPrice,OperationDate = @OperationDate,PartState = @PartState,PartNumber = @PartNumber,PartImage = @PartImage");
            strSql.Append(" WHERE PartId = @PartId");
            return(DbClient.Excute(strSql.ToString(), model) > 0);
        }
예제 #2
0
        public int Add(CsParts model)
        {
            var strSql = new StringBuilder();

            strSql.Append("INSERT INTO CrabShop.dbo.[CsParts] (");
            strSql.Append("PartType,PartName,PartWeight,PartPrice,OperationDate,PartState,PartNumber,PartImage");
            strSql.Append(") VALUES (");
            strSql.Append("@PartType,@PartName,@PartWeight,@PartPrice,@OperationDate,@PartState,@PartNumber,@PartImage);");
            strSql.Append("SELECT @@IDENTITY");
            return(DbClient.ExecuteScalar <int>(strSql.ToString(), model));
        }
예제 #3
0
        public ActionResult SubmitCsParts(CsParts model)
        {
            var sh = new SqlHelper <CsParts>();

            sh.AddUpdate(CsPartsEnum.OperationDate.ToString(), DateTime.Now);
            sh.AddUpdate(CsPartsEnum.PartWeight.ToString(), model.PartWeight);
            sh.AddUpdate(CsPartsEnum.PartPrice.ToString(), model.PartPrice);
            sh.AddUpdate(CsPartsEnum.PartState.ToString(), model.PartState);
            sh.AddWhere(CsPartsEnum.PartId, model.PartId);
            if (sh.Update() > 0)
            {
                return(Json(new ResModel
                {
                    Data = "更新成功",
                    ResStatus = ResStatue.Yes
                }));
            }
            return(Json(new ResModel
            {
                Data = "出现异常, 请稍后再试",
                ResStatus = ResStatue.No
            }));
        }