/// <summary> /// 获得购物车中商品数量 /// </summary> /// <param name="sid">用户sid</param> /// <returns></returns> public int GetCartProductCount(string sid) { DbParameter[] parms = { GenerateInParam("@sid", SqlDbType.Char, 16, sid) }; return(TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.StoredProcedure, string.Format("{0}getcartproductcountbysid", RDBSHelper.RDBSTablePre), parms), -2)); }
/// <summary> /// 根据店铺名称得到店铺id /// </summary> /// <param name="storeName">店铺名称</param> /// <returns></returns> public int GetStoreIdByName(string storeName) { DbParameter[] parms = { GenerateInParam("@name", SqlDbType.NChar, 60, storeName) }; return(TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.StoredProcedure, string.Format("{0}getstoreidbyname", RDBSHelper.RDBSTablePre), parms))); }
/// <summary> /// 后台根据店铺名称得到店铺id /// </summary> /// <param name="storeName">店铺名称</param> /// <returns></returns> public int AdminGetStoreIdByName(string storeName) { DbParameter[] parms = { GenerateInParam("@name", SqlDbType.NChar, 60, storeName) }; string commandText = string.Format("SELECT [storeid] FROM [{0}stores] WHERE [name]=@name", RDBSHelper.RDBSTablePre); return(TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms))); }
/// <summary> /// 获得店铺数量通过店铺等级id /// </summary> /// <param name="storeRid">店铺等级id</param> /// <returns></returns> public int GetStoreCountByStoreRid(int storeRid) { DbParameter[] parms = { GenerateInParam("@storerid", SqlDbType.SmallInt, 2, storeRid) }; string commandText = string.Format("SELECT COUNT([storeid]) FROM [{0}stores] WHERE [storerid]=@storerid", RDBSHelper.RDBSTablePre); return(TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms))); }
/// <summary> /// 根据手机获取UserID /// </summary> /// <param name="mobile"></param> /// <returns></returns> public int GetUserIDByMobile(string mobile) { DbParameter[] parms = { GenerateInParam("@Mobile", SqlDbType.NVarChar, 50, mobile) }; string commandText = string.Format("SELECT UserID FROM [{0}User] WHERE [Mobile]=@Mobile", RDBSHelper.RDBSTablePre); return(TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms), -1)); }
public int GetTableCount(string strsql) { try { return(Convert.ToInt32(RDBSHelper.ExecuteScalar(CommandType.Text, strsql, null))); } catch { return(0); } }
/// <summary> /// 获得用户未评价订单列表 /// </summary> /// <param name="uid">用户id</param> /// <param name="startAddTime">添加开始时间</param> /// <param name="endAddTime">添加结束时间</param> /// <returns></returns> public int GetUserUnReviewOrderCount(int uid, string startAddTime, string endAddTime) { DbParameter[] parms = { GenerateInParam("@uid", SqlDbType.Int, 4, uid), GenerateInParam("@startaddtime", SqlDbType.VarChar, 30, startAddTime.Length > 0? TypeHelper.StringToDateTime(startAddTime).ToString("yyyy-MM-dd HH:mm:ss") : ""), GenerateInParam("@endaddtime", SqlDbType.VarChar, 30, endAddTime.Length > 0? TypeHelper.StringToDateTime(endAddTime).ToString("yyyy-MM-dd HH:mm:ss") : "") }; return(TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.StoredProcedure, string.Format("{0}getuserunreviewordercount", RDBSHelper.RDBSTablePre), parms))); }
/// <summary> /// 是否存在商品关键词 /// </summary> /// <param name="pid">商品id</param> /// <param name="keyword">关键词</param> /// <returns></returns> public bool IsExistProductKeyword(int pid, string keyword) { DbParameter[] parms = { GenerateInParam("@keyword", SqlDbType.NChar, 40, keyword), GenerateInParam("@pid", SqlDbType.Int, 4, pid) }; string commandText = string.Format("SELECT [pid] FROM [{0}productkeywords] WHERE [keyword]=@keyword AND [pid]=@pid ", RDBSHelper.RDBSTablePre); return(TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms)) > 0); }
/// <summary> /// 创建店铺配送模板 /// </summary> /// <param name="storeShipTemplateInfo">店铺配送模板信息</param> public int CreateStoreShipTemplate(StoreShipTemplateInfo storeShipTemplateInfo) { DbParameter[] parms = { GenerateInParam("@storeid", SqlDbType.Int, 4, storeShipTemplateInfo.StoreId), GenerateInParam("@free", SqlDbType.TinyInt, 1, storeShipTemplateInfo.Free), GenerateInParam("@type", SqlDbType.TinyInt, 1, storeShipTemplateInfo.Type), GenerateInParam("@title", SqlDbType.NChar, 100, storeShipTemplateInfo.Title) }; string commandText = string.Format("INSERT INTO [{0}storeshiptemplates]([storeid],[free],[type],[title]) VALUES(@storeid,@free,@type,@title);SELECT SCOPE_IDENTITY();", RDBSHelper.RDBSTablePre); return(TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms))); }
/// <summary> /// 更新用户转账记录 /// </summary> /// <param name="rmt"></param> /// <returns></returns> public string UpdateUserRemit(MD_Remit rmt) { DbParameter[] parms = { GenerateInParam("@remitid", SqlDbType.VarChar, 15, rmt.Remitid), GenerateInParam("@remark", SqlDbType.VarChar, 200, rmt.Remark), GenerateInParam("@chargeremark", SqlDbType.VarChar, 200, rmt.ChargeRemark), GenerateInParam("@realmoney", SqlDbType.Int, 4, rmt.RealMoney), GenerateInParam("@status", SqlDbType.Int, 4, rmt.Status), GenerateInParam("@updateuid", SqlDbType.Int, 4, rmt.Updateuid), }; string commandText = string.Format(@" begin try if exists(select 1 from owzx_userremit where remitid=@remitid ) begin update a set a.status = @status ,a.remark = @remark ,a.realmoney=@realmoney,a.chargeremark=@chargeremark ,a.updateuid = @updateuid ,a.updatetime = convert(varchar(25),getdate(),120) from owzx_userremit a where a.remitid=@remitid --添加账变记录 if(@status=2) begin INSERT INTO [owzx_accountchange]([uid] ,[changemoney],[remark]) select uid ,@realmoney,'充值' from owzx_userremit where remitid=@remitid update a set a.totalmoney=isnull(a.totalmoney,0)+@realmoney from owzx_users a join owzx_userremit b on a.uid=b.uid and b.remitid=@remitid insert into owzx_message([uid],[title],[body]) select uid ,'充值'+cast(@realmoney as varchar(20))+'元到账通知','您充值的'+cast(@realmoney as varchar(20))+'元已经到账,请注意查收' from owzx_userremit where remitid=@remitid end end select '更新成功' state end try begin catch select ERROR_MESSAGE() state end catch "); return(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms).ToString()); }
/// <summary> /// 创建产品分类 /// </summary> /// <param name="model"></param> /// <returns></returns> public int CreateProductClass(ProductClassInfo model) { DbParameter[] parms = { GenerateInParam("@ProductClassName", SqlDbType.NVarChar, 50, model.ProductClassName), GenerateInParam("@ParentProductClassID", SqlDbType.Int, 4, model.ParentProductClassID), GenerateInParam("@DisplayOrder", SqlDbType.Int, 4, model.DisplayOrder) }; string commandText = string.Format("INSERT INTO [{0}ProductClass](ProductClassName,ParentProductClassID,DisplayOrder) VALUES(@ProductClassName,@ParentProductClassID,@DisplayOrder);SELECT SCOPE_IDENTITY()", RDBSHelper.RDBSTablePre); //RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms); return(TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms), -1)); }
/// <summary> /// 后台获得店铺数量 /// </summary> /// <param name="condition">条件</param> /// <returns></returns> public int AdminGetStoreCount(string condition) { string commandText; if (string.IsNullOrWhiteSpace(condition)) { commandText = string.Format("SELECT COUNT(storeid) FROM [{0}stores]", RDBSHelper.RDBSTablePre); } else { commandText = string.Format("SELECT COUNT(storeid) FROM [{0}stores] WHERE {1}", RDBSHelper.RDBSTablePre, condition); } return(TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText))); }
/// <summary> /// 获得订单退款数量 /// </summary> /// <param name="condition">条件</param> /// <returns></returns> public int GetOrderRefundCount(string condition) { string commandText; if (string.IsNullOrWhiteSpace(condition)) { commandText = string.Format("SELECT COUNT(refundid) FROM [{0}orderrefunds]", RDBSHelper.RDBSTablePre); } else { commandText = string.Format("SELECT COUNT(refundid) FROM [{0}orderrefunds] WHERE {1}", RDBSHelper.RDBSTablePre, condition); } return(TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText), 0)); }
/// <summary> /// 更新绑定银行卡信息 /// </summary> /// <param name="drawa"></param> /// <returns></returns> public string UpdateDrawCardInfo(MD_DrawAccount drawa) { DbParameter[] parms = { GenerateInParam("@drawaccid", SqlDbType.Int, 4, drawa.Drawaccid), GenerateInParam("@uid", SqlDbType.Int, 4, drawa.Uid), GenerateInParam("@username", SqlDbType.VarChar, 20, drawa.Username), GenerateInParam("@card", SqlDbType.VarChar, 20, drawa.Card), GenerateInParam("@cardnum", SqlDbType.VarChar, 20, drawa.Cardnum), GenerateInParam("@cardaddress", SqlDbType.VarChar, 50, drawa.Cardaddress) }; string commandText = string.Format(@" begin try if(@drawaccid>0 and exists(select 1 from owzx_userdrawaccount a join owzx_users b on a.uid=b.uid and b.uid=@uid where drawaccid=@drawaccid) ) begin update a set a.username=@username, a.card=@card, a.cardnum=@cardnum, a.cardaddress=@cardaddress from owzx_userdrawaccount a where drawaccid=@drawaccid end else begin if exists(select 1 from owzx_userdrawaccount where uid=@uid) begin insert into owzx_userdrawaccount([uid],[username],[card],[cardnum],[cardaddress],drawpwd) select top 1 @uid,@username,@card,@cardnum,@cardaddress,drawpwd from owzx_userdrawaccount where uid=@uid end end select '更新成功' end try begin catch select ERROR_MESSAGE() state end catch "); return RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms).ToString(); }
public int CreateJob(JobInfo model) { DbParameter[] parms = { GenerateInParam("@JobTitle", SqlDbType.NVarChar, 50, model.JobTitle), GenerateInParam("@PubDate", SqlDbType.DateTime, 8, model.PubDate), GenerateInParam("@EndDate", SqlDbType.DateTime, 8, model.EndDate), GenerateInParam("@Number", SqlDbType.Int, 4, model.Number), GenerateInParam("@State", SqlDbType.Int, 4, model.State), GenerateInParam("@Body", SqlDbType.NText, 0, model.Body), GenerateInParam("@City", SqlDbType.NVarChar, 50, model.City) }; string commandText = string.Format("insert into {0}Jobs (JobTitle,PubDate,EndDate,Number,State,Body,City) values (@JobTitle,@PubDate,@EndDate,@Number,@State,@Body,@City) ;select @@IDENTITY;", RDBSHelper.RDBSTablePre); return(TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms), -1)); }
/// <summary> /// 创建店铺分类 /// </summary> public int CreateStoreClass(StoreClassInfo storeClassInfo) { DbParameter[] parms = { GenerateInParam("@storeid", SqlDbType.Int, 4, storeClassInfo.StoreId), GenerateInParam("@displayorder", SqlDbType.Int, 4, storeClassInfo.DisplayOrder), GenerateInParam("@name", SqlDbType.NChar, 60, storeClassInfo.Name), GenerateInParam("@parentid", SqlDbType.Int, 4, storeClassInfo.ParentId), GenerateInParam("@layer", SqlDbType.TinyInt, 1, storeClassInfo.Layer), GenerateInParam("@haschild", SqlDbType.TinyInt, 1, storeClassInfo.HasChild), GenerateInParam("@path", SqlDbType.Char, 100, storeClassInfo.Path) }; string commandText = string.Format("INSERT INTO [{0}storeclasses]([storeid],[displayorder],[name],[parentid],[layer],[haschild],[path]) VALUES(@storeid,@displayorder,@name,@parentid,@layer,@haschild,@path);SELECT SCOPE_IDENTITY()", RDBSHelper.RDBSTablePre); return(TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms), -1)); }
/// <summary> /// 创建新用户 /// </summary> /// <param name="userInfo"></param> /// <returns></returns> public int CreateUser(UserInfo userInfo) { DbParameter[] parms = { GenerateInParam("@username", SqlDbType.NChar, 20, userInfo.UserName), GenerateInParam("@email", SqlDbType.Char, 50, userInfo.Email), GenerateInParam("@mobile", SqlDbType.Char, 15, userInfo.Mobile), GenerateInParam("@password", SqlDbType.Char, 32, userInfo.Password), GenerateInParam("@nickname", SqlDbType.NChar, 20, userInfo.NickName), GenerateInParam("@userrankid", SqlDbType.TinyInt, 1, userInfo.UserRankID), GenerateInParam("@admingroupid", SqlDbType.TinyInt, 1, userInfo.AdminGroupID), GenerateInParam("@avatar", SqlDbType.Char, 40, userInfo.Avatar), GenerateInParam("@rankcredits", SqlDbType.Int, 4, userInfo.RankCredits), GenerateInParam("@verifyemail", SqlDbType.TinyInt, 1, userInfo.VerifyEmail), GenerateInParam("@verifymobile", SqlDbType.TinyInt, 1, userInfo.VerifyMobile), GenerateInParam("@state", SqlDbType.TinyInt, 1, userInfo.State), GenerateInParam("@salt", SqlDbType.NChar, 6, userInfo.Salt) }; string commandText = string.Format("insert into {0}User(UserName,Email,Mobile,Password,NickName,UserRankID,AdminGroupID,Avatar,RankCredits,VerifyEmail,VerifyMobile,State,Salt) values (@UserName,@Email,@Mobile,@Password,@NickName,@UserRankID,@AdminGroupID,@Avatar,@RankCredits,@VerifyEmail,@VerifyMobile,@State,@Salt) ;select @@IDENTITY;", RDBSHelper.RDBSTablePre); int userid = TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms), -1); DbParameter[] parms1 = { GenerateInParam("@userid", SqlDbType.Int, 4, userid), GenerateInParam("@realname", SqlDbType.NVarChar, 10, userInfo.RealName), GenerateInParam("@birthday", SqlDbType.DateTime, 8, userInfo.Birthday), GenerateInParam("@gender", SqlDbType.TinyInt, 1, userInfo.Gender), GenerateInParam("@idcard", SqlDbType.VarChar, 18, userInfo.IdCard), GenerateInParam("@regionid", SqlDbType.SmallInt, 2, userInfo.RegionId), GenerateInParam("@address", SqlDbType.NVarChar, 150, userInfo.Address), //GenerateInParam("@regtime",SqlDbType.DateTime,8,userInfo.RegTime), GenerateInParam("@regip", SqlDbType.Char, 15, userInfo.RegIP), //GenerateInParam("@lasttime",SqlDbType.DateTime,8,userInfo.LastTime), GenerateInParam("@lastip", SqlDbType.Char, 15, userInfo.LastIP), GenerateInParam("@Body", SqlDbType.NText, 0, userInfo.Body) }; string commandText1 = string.Format("insert into {0}UserDetails(UserID,RealName,Birthday,Gender,IDCard,RegionID,Address,RegTime,[RegIp],LastTime,LastIp,Body) values (@UserID,@RealName,@Birthday,@Gender,@IDCard,@RegionID,@Address,getdate(),@RegIp,getdate(),@LastIp,@Body) ", RDBSHelper.RDBSTablePre); TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText1, parms1), -1); return(userid); }
/// <summary> /// 是否设置提现密码 /// </summary> /// <param name="account"></param> /// <returns></returns> public string ValidateDrawPwd(string account) { DbParameter[] parms = { GenerateInParam("@account", SqlDbType.VarChar, 15, account) }; string sql = string.Format(@" if exists(select 1 from owzx_userdrawaccount a join owzx_users b on a.uid=b.uid and rtrim(b.mobile)=@account and isnull(a.drawpwd,'')!='' ) begin select '成功' end else begin select '失败' end "); return RDBSHelper.ExecuteScalar(CommandType.Text, sql, parms).ToString(); }
/// <summary> /// 删除过期的验证码 /// </summary> /// <param name="id"></param> /// <returns></returns> public string DeleteSMSCode() { string commandText = string.Format(@" begin try if exists(select 1 from owzx_usersmscode where DATEDIFF(minute,expiretime,getdate())>10) begin delete from owzx_usersmscode where DATEDIFF(minute,expiretime,getdate())>10 select '删除成功' state end end try begin catch select ERROR_MESSAGE() state end catch "); return(RDBSHelper.ExecuteScalar(commandText).ToString()); }
/// <summary> /// 是否设置提现密码 /// </summary> /// <param name="account"></param> /// <returns></returns> public string ValidateDrawPwdByUid(int uid) { DbParameter[] parms = { GenerateInParam("@uid", SqlDbType.Int, 4, uid) }; string sql = string.Format(@" if exists(select 1 from owzx_userdrawaccount a join owzx_users b on a.uid=b.uid and b.uid=@uid and isnull(a.drawpwd,'')!='' ) begin select '成功' end else begin select '失败' end "); return RDBSHelper.ExecuteScalar(CommandType.Text, sql, parms).ToString(); }
/// <summary> /// 更新用户回水 /// </summary> /// <param name="back"></param> /// <returns></returns> public string UpdateUserBack(MD_UserBack back) { DbParameter[] parms = { GenerateInParam("@backid", SqlDbType.Int, 4, back.Backid), GenerateInParam("@money", SqlDbType.Decimal, 10, back.Money), GenerateInParam("@status", SqlDbType.Int, 4, back.Status), GenerateInParam("@updateuid", SqlDbType.Int, 4, back.Updateuid) }; string commandText = string.Format(@" begin try begin tran t1 if exists(select 1 from owzx_userback where backid=@backid) begin UPDATE owzx_userback SET money = @money,status=@status,updateuid=@updateuid,updatetime=convert(varchar(25),getdate(),120) where backid=@backid if(@status=2) begin INSERT INTO owzx_accountchange([uid],[changemoney],[remark],accounted) select (select uid from owzx_userback where backid=@backid),@money,'回水', (select isnull(totalmoney,0) from owzx_users a where a.uid=(select uid from owzx_userback where backid=@backid)) end select '修改成功' state commit tran t1 end else begin select '记录已被删除' state commit tran t1 end end try begin catch rollback tran t1 select ERROR_MESSAGE() state end catch "); return(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms).ToString()); }
public int CreateShop(ShopInfo model) { DbParameter[] parms = { GenerateInParam("@ShopName", SqlDbType.NVarChar, 50, model.ShopName), GenerateInParam("@Address", SqlDbType.NVarChar, 200, model.Address), GenerateInParam("@Tel", SqlDbType.NVarChar, 200, model.Tel), GenerateInParam("@Fax", SqlDbType.NVarChar, 200, model.Fax), GenerateInParam("@ShopImg", SqlDbType.NVarChar, 200, model.ShopImg), GenerateInParam("@Position", SqlDbType.NVarChar, 50, model.Position), GenerateInParam("@Body", SqlDbType.NText, 0, model.Body), GenerateInParam("@Area", SqlDbType.NVarChar, 50, model.Area), GenerateInParam("@Type", SqlDbType.NVarChar, 50, model.Type), GenerateInParam("@OrderID", SqlDbType.Int, 4, model.OrderID), GenerateInParam("@Remark", SqlDbType.NVarChar, 200, model.Remark) }; string commandText = string.Format("insert into {0}Shops(ShopName,Address,Tel,Fax,ShopImg,Position,Body,Area,Type,OrderID,Remark) values (@ShopName,@Address,@Tel,@Fax,@ShopImg,@Position,@Body,@Area,@Type,@OrderID,@Remark) ;select @@IDENTITY;", RDBSHelper.RDBSTablePre); return(TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms), -1)); }
/// <summary> /// 删除提现记录 /// </summary> /// <param name="id"></param> /// <returns></returns> public string DeleteDraw(string id) { string commandText = string.Format(@" begin try if exists(select 1 from [{0}userdraw] where [drawid] in ({1})) begin delete from [{0}userdraw] where [drawid] in ({1}) select '删除成功' state end else begin select '提现记录已被删除' state end end try begin catch select ERROR_MESSAGE() state end catch ", RDBSHelper.RDBSTablePre, id); return RDBSHelper.ExecuteScalar(commandText).ToString(); }
/// <summary> /// 删除提现账号 /// </summary> /// <param name="account"></param> /// <returns></returns> public string DeleteDrawAccount(string account) { string commandText = string.Format(@" begin try if exists(select 1 from [{0}userdrawaccount] a join {0}users b on a.uid=b.uid where b.mobile='{1}') begin delete a from [{0}userdrawaccount] a join {0}users b on a.uid=b.uid where b.mobile='{1}' select '删除成功' state end else begin select '提现记录已被删除' state end end try begin catch select ERROR_MESSAGE() state end catch ", RDBSHelper.RDBSTablePre, account); return RDBSHelper.ExecuteScalar(commandText).ToString(); }
public bool Add(LogInfo log) { DbParameter[] parms = { GenerateInParam("@CreateTime", SqlDbType.DateTime, 8, log.CreateTime), GenerateInParam("@UserName", SqlDbType.NVarChar, 50, log.UserName), GenerateInParam("@Title", SqlDbType.NVarChar, 255, log.Title), GenerateInParam("@Content", SqlDbType.NVarChar, 255, log.Content), GenerateInParam("@ip", SqlDbType.NVarChar, 50, log.Ip), }; string commandText = string.Format("insert into {0}log (CreateTime,UserName,Title,Content,ip) values (@CreateTime,@UserName,@Title,@Content,@ip) ;select @@IDENTITY;", RDBSHelper.RDBSTablePre); if (TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms), -1) > 0) { return(true); } else { return(false); }; }
/// <summary> /// 添加系统设置 /// </summary> /// <param name="set"></param> /// <returns></returns> public string AddSet(MD_SysSet set) { DbParameter[] parms = { GenerateInParam("@parentid", SqlDbType.Int, 4, set.Parentid), GenerateInParam("@name", SqlDbType.VarChar, 50, set.Name), GenerateInParam("@invalue", SqlDbType.VarChar, 50, set.InValue) }; string commandText = string.Format(@" begin try INSERT INTO owzx_sys_set([parentid],[name],[invalue]) VALUES (@parentid,@name,@invalue) select '添加成功' state end try begin catch select ERROR_MESSAGE() state end catch "); return(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms).ToString()); }
/// <summary> /// 删除系统设置 /// </summary> /// <param name="id"></param> /// <returns></returns> public string DeleteSet(string id) { string commandText = string.Format(@" begin try if exists(select 1 from owzx_sys_set where setid in ({0})) begin delete from owzx_sys_set where setid in ({0}) select '删除成功' state end else begin select '记录已被删除' state end end try begin catch select ERROR_MESSAGE() state end catch ", id); return(RDBSHelper.ExecuteScalar(commandText).ToString()); }
public int CreateProductFeedbacks(ProductFeedbacksInfo model) { DbParameter[] parms = { GenerateInParam("@CityName", SqlDbType.NVarChar, 50, model.CityName), GenerateInParam("@ProductName", SqlDbType.NVarChar, 50, model.ProductName), GenerateInParam("@ProductModel", SqlDbType.NVarChar, 50, model.ProductModel), GenerateInParam("@CustomerName", SqlDbType.NVarChar, 50, model.CustomerName), GenerateInParam("@Contact", SqlDbType.NVarChar, 50, model.Contact), GenerateInParam("@Address", SqlDbType.NVarChar, 250, model.Address), GenerateInParam("@Body", SqlDbType.NText, 0, model.Body), GenerateInParam("@State", SqlDbType.Int, 4, model.State), GenerateInParam("@CreateTime", SqlDbType.DateTime, 8, model.CreateTime), GenerateInParam("@WeChatName", SqlDbType.NVarChar, 250, model.WeChatName), GenerateInParam("@WeChatOpenId", SqlDbType.NVarChar, 50, model.WeChatOpenId), GenerateInParam("@Imgs", SqlDbType.NVarChar, 1000, model.Imgs) }; string commandText = string.Format("insert into {0}ProductFeedbacks(CityName,ProductName,ProductModel,CustomerName,Contact,Address,Body,CreateTime,State,WeChatName,weChatOpenId,imgs) values (@CityName,@ProductName,@ProductModel,@CustomerName,@Contact,@Address,@Body,@CreateTime,@State,@WeChatName,@weChatOpenId,@imgs) ;select @@IDENTITY;", RDBSHelper.RDBSTablePre); return(TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms), -1)); }
/// <summary> /// 删除充值记录 /// </summary> /// <param name="id"></param> /// <returns></returns> public string DeleteRecharge(string id) { string commandText = string.Format(@" begin try if exists(select 1 from [{0}rechargeinfo] where [id] in ({1})) begin delete from [{0}rechargeinfo] where [id] in ({1}) select '删除成功' state end else begin select '充值记录已被删除' state end end try begin catch select ERROR_MESSAGE() state end catch ", RDBSHelper.RDBSTablePre, id); return(RDBSHelper.ExecuteScalar(commandText).ToString()); }
/// <summary> /// 更新提现密码 /// </summary> /// <param name="drawa"></param> /// <returns></returns> public string UpdateDrawPWD(MD_DrawAccount drawa) { DbParameter[] parms = { GenerateInParam("@account", SqlDbType.VarChar, 15, drawa.Account), GenerateInParam("@drawpwd", SqlDbType.VarChar, 50, drawa.Drawpwd) }; string commandText = string.Format(@" begin try if exists(select 1 from owzx_userdrawaccount a join owzx_users b on a.uid=b.uid and rtrim(b.mobile)=@account) begin update a set a.drawpwd=@drawpwd from owzx_userdrawaccount a join owzx_users b on a.uid=b.uid and b.mobile=@account end else begin insert into owzx_userdrawaccount([uid],drawpwd) select uid,@drawpwd from owzx_users where mobile=@account end select '更新成功' end try begin catch select ERROR_MESSAGE() state end catch "); return(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms).ToString()); }