public int UpdateExpressAddress(int oid, int accId, string expressCompany, string expressCode) { StringBuilder strSql = new StringBuilder(); strSql.Append("select ReceivingAddressId from [i200].[dbo].[T_OrderInfo] where oid=@oid and accId=@accId;"); int receiveId = DapperHelper.ExecuteScalar <int>(strSql.ToString(), new { oid = oid, accId = accId }); strSql.Clear(); strSql.Append( "update [i200].[dbo].[T_Receiving_Address] set ExpressCompany=@expressCompany,ExpressCode=@expressCode where AddressId=@addressId;"); try { int reVal = HelperForFrontend.Execute(strSql.ToString(), new { expressCompany = expressCompany, expressCode = expressCode, addressId = receiveId }); return(reVal); } catch (Exception ex) { Logger.Error("更新实物商品物流信息出错!", ex); return(0); } }
/// <summary> /// 更新 发票信息 /// </summary> /// <param name="id"></param> /// <param name="invoiceNum"></param> /// <param name="remark"></param> /// <returns></returns> public bool UpdateInvoiceNumber(int id, string invoiceNum, string remark, string express, int operId) { bool status = false; StringBuilder strSql = new StringBuilder(); strSql.Append(" update T_Order_Invoice set "); strSql.Append(" invoiceNo=@invoiceNo,invoiceRemark=@invoiceRemark,invoiceOperatorId=@invoiceOperatorId,invoiceExpress=@express,invoiceOPeratorTime=GETDATE(),invoiceStatus=1 "); strSql.Append(" where id=@id"); try { int result = HelperForFrontend.Execute(strSql.ToString(), new { id = id, invoiceNo = invoiceNum, invoiceRemark = remark, invoiceOperatorId = operId, express = express }); if (result > 0) { status = true; } } catch (Exception ex) { status = false; } return(status); }
/// <summary> /// 短信退款处理 /// </summary> /// <param name="accid"></param> /// <param name="oper"></param> /// <param name="model"></param> /// <returns></returns> public bool SmsDrawback(int accid, int oper, OrderProjectItem model) { StringBuilder strSql = new StringBuilder(); strSql.Append("declare @dx int;" + "set @dx=0;" + "" + "select @dx=dxunity from [i200].[dbo].[T_Business] where accountid=@accid; " + "if @dx>=@quantity " + "update [i200].[dbo].[T_Business] set dxunity=dxunity-@quantity where accountid=@accid " + "else " + "update [i200].[dbo].[T_Business] set dxunity=0 where accountid=@accid ;"); try { int reVal = HelperForFrontend.Execute(strSql.ToString(), new { quantity = model.itemQuantity, accid = accid }); if (reVal > 0) { AddDrawbackRec(model.oid, accid, model.itemName, oper, 2, 0, model.itemQuantity, ""); return(true);//短信条数重置成功 } else { Logger.Info("短信退款重置没有找到对应记录!" + DateTime.Now + "-" + accid); return(false); } } catch (Exception ex) { Logger.Error("短信退款重置(更新Business表)出错!", ex); return(false); } }
public string AddCommonSms(string maxCate, string minCate, string smscontent) { StringBuilder strSql = new StringBuilder(); strSql.Append("declare @ranking varchar(10);if not exists( select id from i200.dbo.T_Common_Sms where sms_class='" + minCate + "') select @ranking='99';select @ranking=sms_ranking from i200.dbo.T_Common_Sms where sms_class='" + minCate + "';INSERT INTO i200.dbo.T_Common_Sms(sms_maxclass, sms_class, sms_content, sms_time, sms_ranking) VALUES ('" + maxCate + "','" + minCate + "','" + smscontent + "','" + System.DateTime.Now + "',@ranking)"); try { int reVal = HelperForFrontend.Execute(strSql.ToString()); if (reVal > 0) { return("1"); } else { return("0"); } } catch (Exception ex) { return("0"); } }
public int Add(AlipayUserInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("if(not exists(select accId from T_PaymentInfo where accId=@accId)) " + "begin " + "INSERT INTO T_PaymentInfo(accId, InfoStatus, alipayAccount, alipayPID, alipayKey, StoreName, StoreIndustry, StoreAdress, RealName, Phone, TelNumber, Email, Remark) " + "VALUES (@accId,0,@aliAccount,@aliPid,@aliKey,@accName,'','','',@phoneNumber,'','',''); " + "end " + "if(not exists(select accId from t_App_Au where accid=@accId and appkey=10)) " + "begin " + "INSERT INTO t_App_Au(accid, appkey, appName, stattime, endtime, aa_time, aa_remark, aa_ShortUrl, aa_Status) " + "VALUES (@accId,10,'支付宝收款',GETDATE(),'2015-12-31',GETDATE(),'','',1); " + "end "); try { return(HelperForFrontend.Execute(strSql.ToString(), new { accId = model.AccId, aliAccount = model.AliAccount, aliPid = model.AliPid, aliKey = model.AliKey, accName = model.AccName, phoneNumber = model.PhoneNum })); } catch (Exception ex) { Logger.Error("添加用户支付宝收款信息失败", ex); return(0); } }
public string ChangeRanking(string maxName, string minName, int rank) { StringBuilder strSql = new StringBuilder(); strSql.Append( "update [i200].[dbo].[T_Common_Sms] set sms_ranking=@rank where sms_maxclass=@maxName and sms_class=@minName;"); try { int reVal = HelperForFrontend.Execute(strSql.ToString(), new { rank = rank, maxName = maxName, minName = minName }); if (reVal > 0) { return("1"); } else { return("0"); } } catch (Exception ex) { return("0"); } }
public string UpdateCommonSmsContent(int smsid, string maxCate, string minCate, string smscontent) { StringBuilder strSql = new StringBuilder(); strSql.Append( "update i200.dbo.T_Common_Sms set sms_maxclass=@maxCate,sms_class=@minCate,sms_content=@content where id=@id;"); string result = "0"; try { int reVal = HelperForFrontend.Execute(strSql.ToString(), new { maxCate = maxCate, minCate = minCate, content = smscontent, id = smsid }); if (reVal > 0) { result = "1"; } } catch (Exception ex) { result = "0"; } return(result); }
/// <summary> /// 更新订单状态 /// </summary> /// <param name="returnMoney"></param> /// <param name="oid"></param> /// <param name="accId"></param> /// <returns></returns> public bool UpdateOrderStatus(decimal returnMoney, int oid, int accId) { StringBuilder strSql = new StringBuilder(); strSql.Append( "update [i200].[dbo].[T_OrderInfo] set orderStatus=-2,returnMoney=@money where oid=@oid and accId=@accId; "); try { int reVal = HelperForFrontend.Execute(strSql.ToString(), new { money = returnMoney, oid = oid, accId = accId }); if (reVal > 0) { return(true); } else { Logger.Info("没有找到订单记录!" + oid); return(false); } } catch (Exception ex) { Logger.Error("退款更新订单状态出错!", ex); return(false); } }
/// <summary> /// 高级版退款处理 /// </summary> /// <param name="accid"></param> /// <param name="oper"></param> /// <param name="model"></param> /// <returns></returns> public bool AdvanceDrawback(int accid, int oper, OrderProjectItem model) { //DateTime nowDate = DateTime.Now; bool status = false; StringBuilder strSql = new StringBuilder(); strSql.Append("update [i200].[dbo].[T_Business] set endtime=DATEADD(MONTH,@quantity,endtime) where accountid=@accid;"); try { int reVal = HelperForFrontend.Execute(strSql.ToString(), new { quantity = -model.itemQuantity, accid = accid }); if (reVal > 0) { AddDrawbackRec(model.oid, accid, model.itemName, oper, 2, 0, model.itemQuantity, ""); return(true);//高级版退款成功 } else { Logger.Info("高级版退款没有找到对应记录!" + DateTime.Now + "-" + accid); return(false); } } catch (Exception ex) { Logger.Error("高级版退款(更新Business表)出错!", ex); return(false); } }
/// <summary> /// 初始化一个店铺信息 /// </summary> /// <param name="accid"></param> public void InitializeUserInfor(int accid) { StringBuilder strSql = new StringBuilder(); strSql.Append(" if(NOT exists(select ID from tb_user_infor where UserId=@accid)) "); strSql.Append(" begin"); strSql.Append(" insert into tb_user_infor(UserId) values(@accid); "); strSql.Append(" end "); HelperForFrontend.Execute(strSql.ToString(), new { accid = accid }); }
/// <summary> /// 生成优惠券 /// </summary> /// <param name="groupId"></param> /// <param name="couponCode"></param> /// <param name="couponValue"></param> /// <param name="endTime"></param> /// <returns></returns> public int CreateCouponGroup(int groupId, string couponCode, int couponValue, DateTime endTime) { StringBuilder strSql = new StringBuilder(); strSql.Append("INSERT INTO T_Order_CouponList(groupId, couponId, couponValue, couponStatus, createDate, endDate, toAccId)"); strSql.Append(" VALUES (@couponInfoId,@couponCode,@couponValue,0,GETDATE(),@endDate,0)"); int rt = HelperForFrontend.Execute(strSql.ToString(), new { couponInfoId = groupId, couponCode = couponCode, couponValue = couponValue, endDate = endTime }); return(rt); }
public int DeleteOrder(int oid) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from i200.dbo.T_Orderinfo where oid=@oid;"); try { return(HelperForFrontend.Execute(strSql.ToString(), new { oid = oid })); } catch (Exception ex) { Logger.Error("删除订单出错", ex); return(0); } }
/// <summary> /// 短信审核 /// </summary> /// <param name="notifyId">短信Id</param> /// <param name="reviewInfo">审核状态</param> /// <param name="channelInfo">是否调整通道</param> /// <param name="editChannel">短信通道Json</param> /// <param name="operatorId">操作人员Id</param> /// <param name="reviewDesc">审核描述</param> /// <returns></returns> public int SetReviewSms(int notifyId, int reviewInfo, int channelInfo, string editChannel, int operatorId, string reviewDesc) { int result = 0; int reviewStatus = 2; var channelEx = string.Empty; int smschannel = 0; int smsStatus = 0; string smsChannelSql = ""; if (reviewInfo == 1 || reviewInfo == 2 || reviewInfo == 3) { reviewStatus = reviewInfo; if (reviewInfo == 3) { smsStatus = 3; } } if (channelInfo != 0) { channelEx = editChannel; smschannel = -10; smsChannelSql = " ,smsChannel=@smsChannel"; } var strSql = new StringBuilder(); strSql.Append(" UPDATE T_Sms_Notify"); strSql.Append(" SET priority =@priority, ChannelEx =@ChannelEx, Review =@Review, ReviewOperator =@ReviewOperator, ReviewDate =@ReviewDate, ReviewDesc =@ReviewDesc, smsStatus=@smsStatus"); strSql.Append(smsChannelSql); strSql.Append(" where Review=1 and id=@id;"); result = HelperForFrontend.Execute(strSql.ToString(), new { id = notifyId, priority = 2, ChannelEx = channelEx, Review = reviewStatus, ReviewOperator = operatorId, ReviewDate = DateTime.Now, ReviewDesc = reviewDesc, smsChannel = smschannel, smsStatus = smsStatus }); return(result); }
/// <summary> /// 更新模板 /// </summary> /// <param name="accid"></param> /// <param name="val"></param> /// <returns></returns> public bool UpdateHtmlTemes(int accid, int val) { StringBuilder strSql = new StringBuilder(); strSql.Append("update tb_user_infor set htmlThemes=@htmlthemes where userId=@accid;"); int rows = HelperForFrontend.Execute(strSql.ToString(), new { htmlthemes = val, accid = accid }); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 移除授权 /// </summary> /// <param name="accid"></param> /// <returns></returns> public bool RemoveApp(int key, int accid) { StringBuilder sqlStr = new StringBuilder(); sqlStr.Append("delete t_App_Au where appkey=@appkey and accid=@accid;"); int rows = HelperForFrontend.Execute(sqlStr.ToString(), new { appkey = key, accid = accid }); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 删除短信 /// </summary> /// <param name="smsId"></param> /// <returns></returns> public int DeleteSms(string smsId) { int result = 0; StringBuilder strSql = new StringBuilder(); strSql.Append("DELETE FROM T_Common_Sms where id='" + smsId + "'"); try { result = HelperForFrontend.Execute(strSql.ToString()); } catch (Exception ex) { } return(result > 0 ? 1 : 0); }
/// <summary> /// 删除分类 /// </summary> /// <param name="classMax"></param> /// <param name="classMin"></param> /// <returns></returns> public int ClassDelete(string classMax, string classMin) { int result = 0; StringBuilder strSql = new StringBuilder(); strSql.Append( "delete [T_Common_Sms] where sms_maxclass='" + classMax + "' and [sms_class]='" + classMin + "'"); try { result = HelperForFrontend.Execute(strSql.ToString()); } catch (Exception ex) { } return(result > 0 ? 1 : 0); }
/// <summary> /// 删除一条数据 /// </summary> public bool Delete(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from T_Task_Journal "); strSql.Append(" where id=@id"); int rNum = HelperForFrontend.Execute(strSql.ToString(), new { id = id }); if (rNum > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新提现记录表中状态 /// </summary> /// <param name="withdrawalRecordId"></param> /// <param name="status"></param> /// <param name="operatorIP"></param> /// <param name="operatorUserId"></param> /// <returns></returns> public bool UpdateWithdrawalStatus(int withdrawalRecordId, int status, string operatorIP, int operatorUserId) { StringBuilder strSql = new StringBuilder(); strSql.Append(" update T_WithdrawalRecord "); strSql.Append(" set status=@status "); switch (status) { case 1: strSql.Append(" ,certTime=@datetime "); break; case 2: strSql.Append(" ,transferTime=@datetime "); break; case 5: strSql.Append(" ,certTime=@datetime "); break; } strSql.Append(" where id=@withdrawalRecordId; "); strSql.Append(" insert into T_WithdrawalRecord_Log "); strSql.Append(" select accId,@withdrawalRecordId,withdrawalInfoId,withdrawalAmount,balanceAmount,totalAmount,status,@operatorIP,@operatorUserId,@datetime "); strSql.Append(" from T_WithdrawalRecord "); strSql.Append(" where id=@withdrawalRecordId "); DateTime datetime = DateTime.Now; int rows = HelperForFrontend.Execute(strSql.ToString(), new { withdrawalRecordId = withdrawalRecordId, status = status, operatorIP = operatorIP, operatorUserId = operatorUserId, datetime = datetime }); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 短信分类隐藏 /// </summary> /// <param name="classMax"></param> /// <param name="classMin"></param> /// <param name="hidden"></param> /// <returns></returns> public int HideSms(string classMax, string classMin, string hidden) { int result = 0; StringBuilder strSql = new StringBuilder(); strSql.Append( "update [T_Common_Sms] set [HiddenType]='" + hidden + "' where sms_maxclass='" + classMax + "' and [sms_class]='" + classMin + "'"); try { result = HelperForFrontend.Execute(strSql.ToString()); } catch (Exception ex) { } return(result > 0 ? 1 : 0); }
/// <summary> /// 更新状态 /// </summary> /// <param name="id"></param> /// <param name="auditCon"></param> /// <returns></returns> public bool TaskAuditOk(int id, string auditCon) { StringBuilder strSql = new StringBuilder(); strSql.Append("update T_Task_Journal set t_status=2,t_source=ISNULL(t_source,'')+@source where id=@id and t_status=0;"); int r = HelperForFrontend.Execute(strSql.ToString(), new { id = id, source = auditCon }); if (r > 0) { return(true); } else { return(false); } }
public string UpdateStatusForSuccessStep(int status, int id) { string sResult = string.Empty; StringBuilder strSql = new StringBuilder(); strSql.Append(" update T_AlipayInfo set status = @status where id=@id "); try { sResult = HelperForFrontend.Execute(strSql.ToString(), new { id = @id, status = @status }).ToString(); } catch (Exception ex) { sResult = "error"; } return(sResult); }
/// <summary> /// 修改排序 /// </summary> /// <param name="classMax"></param> /// <param name="classMin"></param> /// <param name="order"></param> /// <returns></returns> public int EditOrder(string classMax, string classMin, string order) { int result = 0; StringBuilder strSql = new StringBuilder(); strSql.Append( "update [T_Common_Sms] set [sms_ranking]='" + Convert.ToInt32(order).ToString() + "' where sms_maxclass='" + classMax + "' and [sms_class]='" + classMin + "'"); try { result = HelperForFrontend.Execute(strSql.ToString()); } catch (Exception ex) { } return(result > 0 ? 1 : 0); }
/// <summary> /// 更新短信 /// </summary> /// <param name="classMax"></param> /// <param name="classMin"></param> /// <param name="content"></param> /// <param name="smsId"></param> /// <returns></returns> public int UpdateSms(string classMax, string classMin, string content, string smsId) { int result = 0; StringBuilder strSql = new StringBuilder(); strSql.Append( "declare @ranking nvarchar(50);select @ranking='99';select @ranking=sms_ranking from T_Common_Sms where sms_class='" + classMin + "';UPDATE T_Common_Sms SET sms_maxclass ='" + classMax + "', sms_class ='" + classMin + "', sms_content ='" + content + "',sms_ranking=@ranking where id='" + smsId + "'"); try { result = HelperForFrontend.Execute(strSql.ToString()); } catch (Exception ex) { } return(result > 0 ? 1 : 0); }
/// <summary> /// 更新订单发票信息 /// </summary> /// <param name="accId"></param> /// <param name="orderId"></param> /// <param name="invoiceId"></param> /// <returns></returns> public bool SetInvoiceId(int accId, int orderId, int invoiceId) { bool bResult = false; var strSql = new StringBuilder(); strSql.Append(" update T_OrderInfo set invoiceId=@invoiceId"); strSql.Append(" where accId=@accId and oid=@oid;"); int iResult = HelperForFrontend.Execute(strSql.ToString(), new { accId = accId, oid = orderId, invoiceId = invoiceId }); if (iResult > 0) { bResult = true; } return(bResult); }
/// <summary> /// 保存短信通告信息 /// </summary> /// <param name="noticeType">通告类型</param> /// <param name="noticeId">Id</param> /// <param name="flagEdit">修改标记</param> /// <param name="display">显示设置</param> /// <param name="noticeText">通告内容</param> /// <returns></returns> public int SaveNoticeText(int noticeType, int noticeId, int flagEdit, int display, string noticeText, string opName, string opIp) { int iResult = -1; var strSql = new StringBuilder(); if (flagEdit == 1) { //新增通告信息 strSql.Append(" INSERT INTO T_NoticeText(nType, nDisplay, nTitle, nContent, nTime, nOperatorName, nOperatorIp)"); strSql.Append(" VALUES (@nType,@nDisplay,@nTitle,@nContent,@nTime,@nOperatorName,@nOperatorIp)"); } else { //更新信息 strSql.Append(" UPDATE T_NoticeText"); strSql.Append(" SET nDisplay = @nDisplay, nContent = @nContent"); strSql.Append(" where id= @noticeId"); } int rowAffected = HelperForFrontend.Execute(strSql.ToString(), new { noticeId = noticeId, nType = noticeType, nDisplay = display, nTitle = "", nContent = noticeText, nTime = DateTime.Now, nOperatorName = opName, nOperatorIp = opIp }); if (rowAffected > 0) { iResult = 1; } return(iResult); }
public bool UpdateEvaluation(int evaluationid, int status) { StringBuilder strSql = new StringBuilder(); strSql.Append(" update T_Product_Evaluation "); strSql.Append(" set isDisplay=@status "); strSql.Append(" where id=@evaluationid "); int rows = HelperForFrontend.Execute(strSql.ToString(), new { evaluationid = evaluationid, status = status }); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新线下订单 /// </summary> /// <param name="oid">订单号</param> /// <param name="confirmMoney">支付金额</param> /// <param name="confirmRemark">备注</param> /// <param name="confirmOpid">操作ID</param> /// <param name="confirmOpIp">操作IP</param> /// <param name="confirmOpTime">操作时间</param> /// <returns></returns> public bool SetConfirmInfo(int oid, decimal confirmMoney, string confirmRemark, int confirmOpid, string confirmOpIp, DateTime confirmOpTime) { bool status = false; StringBuilder strSql = new StringBuilder(); strSql.Append("update T_OrderInfo set " + "confirmMoney=@confirmMoney," + "confirmRemark=@confirmRemark," + "confirmOpId=@confirmOpId," + "confirmOpIp=@confirmOpIp," + "confirmOpTime=@confirmOpTime," + "orderStatus=1," + "transactionDate=getdate() where oid=@oid"); try { int result = HelperForFrontend.Execute(strSql.ToString(), new { oid = oid, confirmMoney = confirmMoney, confirmRemark = confirmRemark, confirmOpId = confirmOpid, confirmOpIp = confirmOpIp, confirmOpTime = confirmOpTime }); if (result > 0) { status = true; } } catch (Exception ex) { status = false; } return(status); }
/// <summary> /// 短信通道测试 /// </summary> /// <param name="strContent">短信内容</param> /// <param name="phoneNum">手机号码</param> /// <param name="userCnt">号码个数</param> /// <param name="channelId">通道ID</param> /// <returns></returns> public string GetChannelTest(string strContent, string phoneNum, int userCnt, int channelId, int smsFlag) { string sResult = "0"; StringBuilder strSql = new StringBuilder(); strSql.Append( " INSERT INTO T_Sms_Notify(accID, userList, userCnt, smsContent, smsType, useBalance, priority, succeedCnt, failCnt, skipCnt, smsStatus, submitTime, [RegularTime],smsChannel, PhoneList, isFree)"); strSql.Append( " VALUES (0,'',@userCnt,@content,99,0,0,0,0,0,0,GETDATE(),'1900-1-1',@channelID,@phoneNum,1)"); if (smsFlag == 1) { //添加时间和通道Id strContent = DateTime.Now.ToString("HH:mm") + "-" + channelId.ToString() + strContent; } try { int result = HelperForFrontend.Execute(strSql.ToString(), new { content = strContent, channelID = channelId, phoneNum = phoneNum.TrimEnd(','), userCnt = userCnt }); if (result > 0) { sResult = "ok"; } } catch (Exception) { sResult = "0"; } return(sResult); }
/// <summary> /// 更新短信内容 /// </summary> /// <param name="smsId"></param> /// <param name="smsContent"></param> /// <returns></returns> public bool UpdateSmsContent(int smsId, string smsContent) { bool status = false; StringBuilder strSql = new StringBuilder(); strSql.Append("update T_Sms_Notify set smsContent=@smsContent where id=@id;"); try { int result = HelperForFrontend.Execute(strSql.ToString(), new { id = smsId, smsContent = smsContent }); if (result > 0) { status = true; } } catch (Exception ex) { status = false; } return(status); }