public bool Exists(int primaryKey) { var strSql = "SELECT COUNT(1) FROM CrabShop.dbo.[CsParts] WHERE 1 = @primaryKey"; var parameters = new { primaryKey }; return(DbClient.Excute(strSql, parameters) > 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); }
public bool Update(CsSystemUsers model) { var strSql = new StringBuilder(); strSql.Append("UPDATE CrabShop.dbo.[CsSystemUsers] SET "); strSql.Append("SysUserName = @SysUserName,SysUserPassword = @SysUserPassword,SysUserType = @SysUserType,SysUserState = @SysUserState,SysUserDate = @SysUserDate,DeleteDate = @DeleteDate,DeleteDescribe = @DeleteDescribe"); strSql.Append(" WHERE SysUserId = @SysUserId"); return(DbClient.Excute(strSql.ToString(), model) > 0); }
public bool Update(CsPrice model) { var strSql = new StringBuilder(); strSql.Append("UPDATE CrabShop.dbo.[CsPrice] SET "); strSql.Append("PriceNumber = @PriceNumber,ProductId = @ProductId,PriceDate = @PriceDate"); strSql.Append(" WHERE PriceId = @PriceId"); return(DbClient.Excute(strSql.ToString(), model) > 0); }
public bool Update(CsPackage model) { var strSql = new StringBuilder(); strSql.Append("UPDATE CrabShop.dbo.[CsPackage] SET "); strSql.Append("PackageType = @PackageType,PackageName = @PackageName,PackageNumber = @PackageNumber,PackageImage = @PackageImage,PackageWeight = @PackageWeight,PackagePrice = @PackagePrice,PackageState = @PackageState,OperationDate = @OperationDate,PackageStock = @PackageStock"); strSql.Append(" WHERE PackageId = @PackageId"); return(DbClient.Excute(strSql.ToString(), model) > 0); }
public bool Update(CsOrder model) { var strSql = new StringBuilder(); strSql.Append("UPDATE CrabShop.dbo.[CsOrder] SET "); strSql.Append("OrderNumber = @OrderNumber,UserId = @UserId,TotalMoney = @TotalMoney,DiscountMoney = @DiscountMoney,ActualMoney = @ActualMoney,OrderDate = @OrderDate,OrderState = @OrderState,OrderAddress = @OrderAddress,SendAddress = @SendAddress,OrderDelivery = @OrderDelivery,CargoNumber = @CargoNumber,OrderCopies = @OrderCopies,TotalWeight = @TotalWeight,BillWeight = @BillWeight,RowStatus = @RowStatus,DeleteDate = @DeleteDate,DeleteDescribe = @DeleteDescribe,PrepaymentId = @PrepaymentId,ExpressMoney = @ExpressMoney,ServiceMoney = @ServiceMoney,IsInvoice = @IsInvoice,OrderRemarks = @OrderRemarks"); strSql.Append(" WHERE OrderId = @OrderId"); return(DbClient.Excute(strSql.ToString(), model) > 0); }
public bool Update(CsOrderDetail model) { var strSql = new StringBuilder(); strSql.Append("UPDATE CrabShop.dbo.[CsOrderDetail] SET "); strSql.Append("OrderId = @OrderId,ProductId = @ProductId,UnitPrice = @UnitPrice,ProductNumber = @ProductNumber,TotalPrice = @TotalPrice,ChoseType = @ChoseType"); strSql.Append(" WHERE DetailId = @DetailId"); return(DbClient.Excute(strSql.ToString(), model) > 0); }
public bool Update(CsRebate model) { var strSql = new StringBuilder(); strSql.Append("UPDATE CrabShop.dbo.[CsRebate] SET "); strSql.Append("UserId = @UserId,RebateMoney = @RebateMoney,RebateWeight = @RebateWeight,RebateTime = @RebateTime"); strSql.Append(" WHERE RebateId = @RebateId"); return(DbClient.Excute(strSql.ToString(), model) > 0); }
public bool Update(CsSend model) { var strSql = new StringBuilder(); strSql.Append("UPDATE CrabShop.dbo.[CsSend] SET "); strSql.Append("CompanyName = @CompanyName,SendPerson = @SendPerson,ConSex = @ConSex,TelPhone = @TelPhone,SendAddress = @SendAddress,UserId = @UserId,IsDefault = @IsDefault"); strSql.Append(" WHERE SendId = @SendId"); return(DbClient.Excute(strSql.ToString(), model) > 0); }
public bool Update(CsAddress model) { var strSql = new StringBuilder(); strSql.Append("UPDATE CrabShop.dbo.[CsAddress] SET "); strSql.Append("UserId = @UserId,CompanyName = @CompanyName,Consignee = @Consignee,Mobile = @Mobile,Details = @Details,TelPhone = @TelPhone,ConSex = @ConSex,IsDefault = @IsDefault,AddressState = @AddressState"); strSql.Append(" WHERE AddressId = @AddressId"); return(DbClient.Excute(strSql.ToString(), model) > 0); }
public bool Update(CsCart model) { var strSql = new StringBuilder(); strSql.Append("UPDATE CrabShop.dbo.[CsCart] SET "); strSql.Append("OpenId = @OpenId,ProductId = @ProductId,ProductNumber = @ProductNumber,ChoseType = @ChoseType"); strSql.Append(" WHERE CartId = @CartId"); return(DbClient.Excute(strSql.ToString(), model) > 0); }
public bool Update(CsDistrict model) { var strSql = new StringBuilder(); strSql.Append("UPDATE CrabShop.dbo.[CsDistrict] SET "); strSql.Append("Name = @Name,ParentId = @ParentId,Code = @Code,Sort = @Sort,FirstPrice = @FirstPrice,FllowPrice = @FllowPrice"); strSql.Append(" WHERE Id = @Id"); return(DbClient.Excute(strSql.ToString(), model) > 0); }
public bool Update(CsUsers model) { var strSql = new StringBuilder(); strSql.Append("UPDATE CrabShop.dbo.[CsUsers] SET "); strSql.Append("UserName = @UserName,UserPhone = @UserPhone,UserSex = @UserSex,UserState = @UserState,OpenId = @OpenId,Remarks = @Remarks,UserBalance = @UserBalance,TotalWight = @TotalWight"); strSql.Append(" WHERE UserId = @UserId"); return(DbClient.Excute(strSql.ToString(), model) > 0); }
public bool Update(CsMenus model) { var strSql = new StringBuilder(); strSql.Append("UPDATE CrabShop.dbo.[CsMenus] SET "); strSql.Append("MenuName = @MenuName,MenuUrl = @MenuUrl,MenuIcon = @MenuIcon,MenuParId = @MenuParId,MenuState = @MenuState,Remarks = @Remarks,MenuOrder = @MenuOrder"); strSql.Append(" WHERE MenuId = @MenuId"); return(DbClient.Excute(strSql.ToString(), model) > 0); }
/// <summary> /// 修改用户默认收货地址 /// </summary> /// <param name="address"></param> /// <returns></returns> public int ChooseAddress(CsAddress address) { StringBuilder strSql = new StringBuilder(); strSql.Append($"update CsAddress set IsDefault=2 where UserId={address.UserId} and IsDefault=1;"); strSql.Append($"update CsAddress set IsDefault=1 where AddressId={address.AddressId}"); int number = DbClient.Excute(strSql.ToString()); return(number); }
public object Add(CsCsDistrict model) { var strSql = new StringBuilder(); strSql.Append("INSERT INTO CrabShop.dbo.[CsCsDistrict] ("); strSql.Append("id,name,parent_id,code,sort"); strSql.Append(") VALUES ("); strSql.Append("@id,@name,@parent_id,@code,@sort);"); return(DbClient.Excute(strSql.ToString(), model)); }
public bool Update(Dictionary <CsPartsEnum, object> updates, string where) { var strSql = new StringBuilder(); strSql.Append("UPDATE CrabShop.dbo.[CsParts] SET "); var para = new DynamicParameters(); foreach (var update in updates) { strSql.Append($" {update.Key} = @{update.Key},"); para.Add(update.Key.ToString(), update.Value); } strSql.Remove(strSql.Length - 1, 1); strSql.Append($" WHERE 1=1 {where}"); return(DbClient.Excute(strSql.ToString(), para) > 0); }
/// <summary> /// 支付完成,修改订单状态,生成扣除库存与修改用户购买重量 /// </summary> /// <param name="orderId"></param> /// <returns></returns> public int FinshOrder(int orderId, int userId, decimal totalWeight, int orderCopies) { int number = 0;//实际操作影响行数 try { //第一步骤:修改订单状态为支付完成但未配货 string strSql1 = $"update CsOrder set OrderState=2 where OrderId={orderId}"; number = DbClient.Excute(strSql1); //第二步骤:修改螃蟹库存 CsOrderDetailDal orderDetailDal = new CsOrderDetailDal(); //查询出本次订单中购买螃蟹列表 List <CsOrderDetail> DetailList = orderDetailDal.GetModelList(" and OrderId=" + orderId + " and ChoseType=1"); if (DetailList.Count > 0) { foreach (CsOrderDetail OrderDetail in DetailList) { string strSql2 = $"update CsProducts set ProductStock=ProductStock-{OrderDetail.ProductNumber} where ProductId={OrderDetail.ProductId}"; DbClient.Excute(strSql2); } } //第三步,修改用户的购买累计重量 decimal total = totalWeight * orderCopies; string strSql3 = $"update CsUsers set TotalWight=TotalWight+{total} where UserId={userId}"; DbClient.Excute(strSql3); if (number > 0) { return(number); } else { return(0); } } catch (Exception ex) { LogHelper.Log(ex.Message, "完成支付出错"); return(0); } }
public int DeleteByWhere(string where) => DbClient.Excute($"DELETE FROM CrabShop.dbo.[CsParts] WHERE 1 = 1 {where}");
public bool Delete(int primaryKey) { var strSql = "DELETE FROM CrabShop.dbo.[CsParts] WHERE PartId = @primaryKey"; return(DbClient.Excute(strSql, new { primaryKey }) > 0); }
/// <summary> /// 根据订单编号,修改与支付编号 /// </summary> /// <param name="orderId"></param> /// <param name="prepaymentid"></param> /// <returns></returns> public int UpdatePrepaymentId(int orderId, string prepaymentid) { string strSql = $"update CsOrder set PrepaymentId='{prepaymentid}' where OrderId={orderId}"; return(DbClient.Excute(strSql)); }
/// <summary> /// 根据订单编号,修改订单状态 /// </summary> /// <param name="orderid"></param> /// <param name="orderState"></param> /// <returns></returns> public int UpdateOrderState(int orderid, int orderState) { string strSql = $"update CsOrder set OrderState={orderState} where OrderId={orderid}"; return(DbClient.Excute(strSql)); }