protected void Page_Load(object sender, EventArgs e) { //注册客户端(前端)函数的引用 String cbReference = Page.ClientScript.GetCallbackEventReference(this, "arg", "ReceiveData", "context"); String callbackScript = "function CallServer(arg, context) {\n" + cbReference + ";\n}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "CallServer", callbackScript, true); //获取卖家id sellerId = SellersBLL.GetSellerIdByNick(Users.Nick); //获取没手机号的会员 tbSource = BuyerBLL.GetSellerNoDetailsInfo(sellerId); if (tbSource != null && tbSource.Rows.Count >= 0) { LabelNoNum.Text = tbSource.Rows.Count.ToString(); } //获取上次卖家手工同步数据的时间 string synDate = SellersBLL.GetSellerSynDate(Users.Nick); if (!string.IsNullOrEmpty(synDate)) { lbsynDate.Text = "上次同步成功完成(上次同步时间:" + synDate + ")"; } else { lbsynDate.Text = "您还没有同步过数据!"; } if (!Page.IsPostBack) { } else { if (Request.Form["__EVENTARGUMENT"] == "updatetime") { ClientScript.RegisterStartupScript(this.GetType(), "success", "msgbox('会员资料同步完成!');", true); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { MsgDataBind(); //if (RatingBLL.isBshop(Users.Nick)) //{ // HiddenField1.Value = "【天猫】"; //} //else { // HiddenField1.Value = "【淘宝】"; //} HiddenField1.Value = "【" + SellersBLL.GetSignName(Users.Nick) + "】"; } //this.SmartNavigation = true; this.MaintainScrollPositionOnPostBack = true; lbMsg.Text = ""; }
/// <summary> /// 允许事件单击 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Allow_click(object sender, EventArgs e) { try { string sellerID = ((LinkButton)sender).CommandArgument; if (SellersBLL.DeleteSellersInfo(sellerID)) { Response.Write("<script language='javascript'>alert('操作成功!');</script>"); } else { Response.Write("<script language='javascript'>alert('操作失败!');</script>"); } MsgDataBind(); } catch (Exception ex) { ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI); } }
public void RaiseCallbackEvent(String eventArgument) { if (eventArgument == "progress") { strCallback = "progress," + SellersBLL.GetSyncMem(Users.Nick).ToString(); } else if (eventArgument == "syncmember") { bool br; br = SellersBLL.SetSyncMem(Users.Nick); if (br) { strCallback = "syncmember,success"; Client.CreateSyncEvent(); } else { strCallback = "syncmember,failed"; } } }
protected void btnAdd_Click(object sender, EventArgs e) { string sellerNick = TextBox1.Text.Trim(); if (!SellersBLL.CheckSellerIsExit(sellerNick)) { if (SellersBLL.AddSellerExportAuth(sellerNick)) { Label1.Text = "添加成功!"; } else { Label1.Text = "添加失败!"; } } else { Label1.Text = "已经存在!"; } MsgDataBind(); }
protected void Page_Load(object sender, EventArgs e) { //获取卖家id sellerId = SellersBLL.GetSellerIdByNick(Users.Nick); if (!Page.IsPostBack) { } //防止二次提交 imgbtnExport.Attributes.Add("onclick", "this.disabled=true;" + this.ClientScript.GetPostBackEventReference(imgbtnExport, "")); try { //检查卖家最后一次申请状态 int status = BuyerexportBLL.CheckEndStatus(sellerId); if (status == 2) { imgbtnExport.ImageUrl = "~/Win_Image/exportSucess.png"; ImageButtonCancle.Visible = false; } else if (status == 1) { imgbtnExport.ImageUrl = "~/Win_Image/exporting.png"; ImageButtonCancle.Visible = true; } else if (status == 0) { ImageButtonCancle.Visible = false; imgbtnExport.ImageUrl = "~/Win_Image/export.png"; } DataTable dt = BuyerexportBLL.GetBuyerExportAll(sellerId); GridView_Jilv.DataSource = dt; GridView_Jilv.DataBind(); } catch (Exception ex) { ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI); } }
protected void imgBtnSetSign_Click(object sender, ImageClickEventArgs e) { if (String.IsNullOrEmpty(txtShopSign.Text.Trim())) { lbSignMsg.Text = "自定义签名不能为空!"; return; } Sellers objSell = new Sellers(); objSell.Nick = Users.Nick; objSell.SignShopName = txtShopSign.Text.Trim(); objSell.Cellphone = ""; if (SellersBLL.SetShopName(objSell)) { lbSignMsg.Text = "签名修改成功,物流提醒将使用此签名!"; lbSignMsg.ForeColor = Color.Blue; lbShopSignPre.Text = "【" + SellersBLL.GetSignName(Users.Nick) + "】"; } else { lbSignMsg.Text = "签名保存失败,联系客服!"; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //检查卖家是否为新卖家 var result = SellersBLL.CheckSeller(); if (result == "0") { Response.Redirect("http://container.api.taobao.com/container/transform?appkey=21088197", false); } //ExceptionReporter.WriteLog("result2:" + result, ExceptionPostion.TBApply_Data, ExceptionRank.important); if (!string.IsNullOrEmpty(Users.OrderVersion)) { var checkIsExit = MsgBLL.CheckSellerMsgTransIsExit(Users.Nick); if (String.IsNullOrEmpty(checkIsExit))//卖家第一次订购 { MsgPackage obj = new MsgPackage(); obj.PackageName = "店铺管家短信套餐(淘宝)10条"; obj.Type = "永久有效"; obj.SellerNick = Users.Nick; obj.Price = 0; obj.PerPrice = "0"; obj.Rank = "短信套餐(赠送)"; obj.OrderDate = DateTime.Now; obj.PayStatus = true; MsgBLL.AddMsgPackage(obj); obj.ServiceStatus = true; obj.CanUseStartDate = DateTime.Now; obj.MsgCanUseCount = 10; obj.MsgTotalCount = 10; MsgBLL.AddMsgTrans(obj); } } else { Response.Redirect("http://crm.new9channel.com/relogin.aspx"); } } }
public string SyncMemDele(string strUserName, string strSession, string strTime) { try { Console.WriteLine("开始同步,卖家:" + strUserName); //初始化系统分组 InitGroup(strUserName); //同步系统订单,全部同步 if (string.IsNullOrEmpty(strTime)) { //获取会员数据量 string memberNum = BuyerBLL.GetBuyerCount("1", strUserName); if (memberNum.Equals("0") == true) {//如果会员数量为0则添加一个表 //获取id string seller_id = SellersBLL.GetSellerIdByNick(strUserName); if (string.IsNullOrEmpty(seller_id) == false) {//如果seller_id不为空则创建一个新表 SellersDAL.addBuyer(seller_id); } } BuyerBLL buyerObj = new BuyerBLL(); if (buyerObj.SynicBuyersInformation(strUserName, strSession)) { //将最新同步数据时间更新写入DB Sellers objSeller = new Sellers(); objSeller.Nick = strUserName; SellersBLL.UpdateSellerSynDate(objSeller); SellersBLL.SetSyncProcess(strUserName, 0); } } } catch (Exception err) { ExceptionReporter.WriteLog(err, ExceptionPostion.TBApply_Data); } return(strUserName); }
protected void grdCus_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { string canUseMsg = e.Row.Cells[3].Text.Trim(); if (canUseMsg.Equals("0") || canUseMsg.Equals("-1")) { e.Row.Cells[3].ForeColor = Color.Red; } string nick = e.Row.Cells[0].Text.Trim(); if (!string.IsNullOrEmpty(nick)) { string sydate = SellersBLL.GetSellerSynDate(nick); if (string.IsNullOrEmpty(sydate) == false) { e.Row.Cells[6].Text = sydate; } else { e.Row.Cells[6].Text = "还未同步"; } } string msgStatus = e.Row.Cells[5].Text.Trim(); if (msgStatus.Equals("False")) { e.Row.Cells[5].ForeColor = Color.Red; e.Row.Cells[5].Text = "不可用"; } } } catch (Exception ex) { ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI); } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie cookie = new HttpCookie("user"); cookie.Value = Users.Nick; HttpContext.Current.Response.Cookies.Add(cookie); users.Value = SellersBLL.GetSignName(Users.Nick); if (!Page.IsPostBack) { MsgDataBind(); //if (RatingBLL.isBshop(Users.Nick)) //{ // HiddenField1.Value = "【天猫】"; //} //else { // HiddenField1.Value = "【淘宝】"; //} HiddenField1.Value = "【" + SellersBLL.GetSignName(Users.Nick) + "】"; } //this.SmartNavigation = true; this.MaintainScrollPositionOnPostBack = true; lbMsg.Text = ""; }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; //context.Response.Write("Hello World"); string nick = context.Request.Form["nick"]; string phone = context.Request.Form["phone"]; if (!string.IsNullOrEmpty(phone) && !Utility.IsCellPhone(phone)) { context.Response.Write("0"); context.Response.End(); return; } if (!string.IsNullOrEmpty(nick)) { Sellers objSell = new Sellers(); objSell.Nick = Users.Nick; objSell.SignShopName = nick; objSell.Cellphone = phone; SellersBLL.SetShopName(objSell); context.Response.Write("1"); context.Response.End(); } }
protected void imgImportData_Click(object sender, ImageClickEventArgs e) { //Thread.Sleep(1000000); try { #region 订单交易导入 if (!String.IsNullOrEmpty(fileOrderUpload.PostedFile.FileName)) { //文件扩展名 string fileExtend = ""; string filePath = ""; //文件大小 int fileSize = 0; filePath = fileOrderUpload.PostedFile.FileName.ToLower().Trim(); //取得上传前的文件(存在于客户端)的文件或文件夹的名称 string[] names = filePath.Split('\\'); //取得文件名 string name = names[names.Length - 1]; //获得服务器端的根目录 string serverPath = Server.MapPath("~/SellerReport"); //判断是否有该目录 if (!Directory.Exists(serverPath)) { Directory.CreateDirectory(serverPath); } filePath = serverPath + "\\" + name; var fileImprtPath = serverPath + "\\"; //如果存在,删除文件 if (File.Exists(filePath)) { File.Delete(filePath); } // 上传文件 fileOrderUpload.PostedFile.SaveAs(filePath); //得到扩展名 fileExtend = filePath.Substring(filePath.LastIndexOf(".")); if (fileExtend != ".csv") { lbError.Text = "只支持CSV格式的文件!"; return; } CSVHelper obj = new CSVHelper(fileImprtPath, fileOrderUpload.FileName.ToLower().Trim()); DataTable tb = obj.Read(); //将订单交易信息写入到DB,同时更新买家表信息 if (tb != null && tb.Rows.Count > 0) { Trade o = null; Buyers objBuyer = null; string sellerId = SellersBLL.GetSellerIdByNick(Users.Nick); DataTable tbSource = BuyerBLL.GetSellerNoDetailsInfo(sellerId); foreach (DataRow row in tb.Rows) { try { o = new Trade(); o.Tid = Convert.ToInt64(string.IsNullOrEmpty(row["订单编号"].ToString()) ? "000000" : row["订单编号"].ToString()); o.BuyerNick = row["买家会员名"].ToString(); o.SellerNick = Users.Nick; o.ReceiverAddress = row["收货地址 "].ToString(); o.ReceiverName = row["收货人姓名"].ToString(); o.ReceiverPhone = row["联系电话 "].ToString(); o.ReceiverMobile = row["联系手机"].ToString(); //更新买家信息表数据 objBuyer = new Buyers(); objBuyer.Address = o.ReceiverAddress; if (!String.IsNullOrEmpty(o.ReceiverAddress)) { string[] info = o.ReceiverAddress.Split(new char[] { ' ' }); if (info.Length > 0) { objBuyer.BuyerProvince = info[0].ToString(); } } objBuyer.BuyerNick = o.BuyerNick; objBuyer.CellPhone = o.ReceiverMobile == null ? "" : o.ReceiverMobile.Replace("'", ""); objBuyer.Phone = o.ReceiverPhone == null ? "" : o.ReceiverPhone.Replace("'", ""); objBuyer.Buyer_reallName = String.IsNullOrEmpty(o.ReceiverName) ? "unknown!" : o.ReceiverName; objBuyer.SELLER_ID = Users.Nick; if (SellersBLL.SearchBuyers(tbSource, objBuyer.BuyerNick)) { BuyerBLL.UpdateForHistory(objBuyer, sellerId); } } catch (Exception ex) { //ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI); continue; } } } } #endregion } catch (Exception ex) { ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Data); lbError.Text = "导入报表失败,请联系客服!"; return; } lbError.Text = "导入报表数据成功!"; lbError.ForeColor = Color.Blue; }
//发送短信 void sendMsg(HttpContext context) { string sigNames = SellersBLL.GetSignName(Users.Nick); string sigName = "【" + SellersBLL.GetSignName(Users.Nick) + "】"; string msgContent = Convert.ToString(context.Request.Form["msgContent"]); msgContent = msgContent.Trim(); string data = context.Request.Form["data"]; JObject o = JObject.Parse(data); JArray ja = JArray.Parse(o["members"].ToString()); if (ja != null && ja.Count > 0) { foreach (var member in ja) { string name = member["nick"].ToString(); string phone = member["phone"].ToString(); string content = context.Request.Form["content"]; //控制是否过滤移动号码 string flag = context.Request.Form["falg"]; string signShopName = SellersBLL.GetSignName(Users.Nick); MsgSendHis objHis = null; //string msgContent = "【" + signShopName + "】" + content.Trim() + " 退订回N"; try { BlakList objbk = new BlakList(); objbk.SellerNick = Users.Nick; objbk.BlakName = name; //黑名单 if (!BlcakLstBLL.ChekBlaklist(objbk)) { var cellpone = phone; if (Utility.IsCellPhone(cellpone) && !string.IsNullOrEmpty(cellpone)) { #region 短信发送 if (MsgBLL.CheckSellerMsgStatus()) { objHis = new MsgSendHis(); objHis.TransNumber = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + cellpone;//手机号码 2016 yao c objHis.SellerNick = Users.Nick; objHis.Buyer_nick = name; objHis.CellPhone = cellpone; objHis.SendDate = DateTime.Now; objHis.SendType = "短信促销"; objHis.SendStatus = "0"; objHis.Count = "1"; objHis.MsgContent = msgContent; if (Utility.IsYiDongCellPhoneNo(cellpone)) { objHis.HelpSellerNick = "移动"; } else { objHis.HelpSellerNick = "电信联通"; } if (SmartBLL.AddMsgSendHis(objHis)) { try { //string sendStatus = Mobile.sendMsg(lstCellPhoneNo, msgContent); if (Convert.ToInt32(msgContent.Trim().Length) <= 70) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 1); } else if (Convert.ToInt32(msgContent.Trim().Length) > 70 && Convert.ToInt32(msgContent.Trim().Length) <= 134) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 2); } else if (Convert.ToInt32(msgContent.Trim().Length) > 134 && Convert.ToInt32(msgContent.Trim().Length) <= 195) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 3); } else if (Convert.ToInt32(msgContent.Trim().Length) > 195 && Convert.ToInt32(msgContent.Trim().Length) <= 260) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 4); } string sendStatus = TBSendMSg.SendMsg(cellpone, sigNames, objHis.MsgContent.Trim().Replace(sigName, "")); if (Utility.IsYiDongCellPhoneNo(cellpone)) { //string sendStatus = Mobile.SendMsgHuBeiYD(cellpone, msgContent); //string sendStatus = Mobile.sendMsgJiuFang(cellpone, msgContent, "100057", "c9bf7c4cb27c5527c4d757765514498e");//20160625 yao //string sendStatus = Mobile.SendMsgHubeiYDPost(cellpone, msgContent); //sendStatus = sendStatus.Replace("\r", "").Replace("\n", ""); if (sendStatus.Equals("0")) { sendStatus = "100"; } SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber); } else//电信联通号码全部群发 { //string sendStatus = Mobile.PostDataToMyServer(cellpone, msgContent.Trim()); //IDictionary resultDic = TopUtils.ParseJson(sendStatus); SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber); } } catch (Exception ex) { //ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI); continue; } } } else { //更新短信账户状态 MsgBLL.UpdateMsgTransServiceStatus(Users.Nick, false); context.Response.Write("余额不足"); context.Response.End(); break; } #endregion } } } catch (Exception ex) { continue; } } } }
protected void Page_Load(object sender, EventArgs e) { try { //*判断卖家是否是第一次登陆, //将卖家信息写入DB if (!Page.IsPostBack) { //初始化买家会员级别 DataTable tbbuyerlevel = ShopsBLL.GetBuyerGrade(Users.Nick); if (tbbuyerlevel != null) { lbQianZai.Text = tbbuyerlevel.Rows[0]["grade"].ToString(); lbCommonBuyer.Text = tbbuyerlevel.Rows[1]["grade"].ToString(); lbAdvanceBuyer.Text = tbbuyerlevel.Rows[2]["grade"].ToString(); lbVIP.Text = tbbuyerlevel.Rows[3]["grade"].ToString(); lbTopVIP.Text = tbbuyerlevel.Rows[4]["grade"].ToString(); } else { lbQianZai.Text = "0"; lbCommonBuyer.Text = "0"; lbAdvanceBuyer.Text = "0"; lbVIP.Text = "0"; lbTopVIP.Text = "0"; } //从数据库读取最近30天活跃会员总金额排行榜 grdTopBuyerTradeAmount.DataSource = null; grdTopBuyerTradeAmount.DataBind(); //获取销量最好的前10条宝贝 grdTopSales.DataSource = SellersBLL.GetTop10Sales(Users.Nick); grdTopSales.DataBind(); //获取店铺统计信息 DataTable tbsellerStatic = ShopsBLL.GetShopeInfoStatic(Users.Nick); if (tbsellerStatic != null) { lbTotalSales.Text = "¥" + tbsellerStatic.Rows[0]["Result_Flag"].ToString(); var orderCount = tbsellerStatic.Rows[1]["Result_Flag"].ToString(); lbOrderCount.Text = orderCount.Substring(0, orderCount.Length - 3); var userCount = tbsellerStatic.Rows[2]["Result_Flag"].ToString(); lbUserCount.Text = userCount.Substring(0, userCount.Length - 3); var orderPrice = tbsellerStatic.Rows[3]["Result_Flag"].ToString(); lbPerOrderPirce.Text = "¥" + orderPrice.Substring(0, orderPrice.Length - 3); var newUserOrderCount = tbsellerStatic.Rows[4]["Result_Flag"].ToString(); lbNewUserOrderCount.Text = newUserOrderCount.Substring(0, newUserOrderCount.Length - 3); var newBuyerCount = tbsellerStatic.Rows[4]["Result_Flag"].ToString(); lbNewBuyerCount.Text = newBuyerCount.Substring(0, newBuyerCount.Length - 3); var refundOrderCount = tbsellerStatic.Rows[5]["Result_Flag"].ToString(); lbRefundOrderCount.Text = refundOrderCount.Substring(0, refundOrderCount.Length - 3); var qianzaiBuyerCount = tbsellerStatic.Rows[6]["Result_Flag"].ToString(); QianZaiBuyerCount.Text = qianzaiBuyerCount.Substring(0, qianzaiBuyerCount.Length - 3); var threeMonthsNoLoginCount = tbsellerStatic.Rows[7]["Result_Flag"].ToString(); lb3MonthsNoLoginCount.Text = threeMonthsNoLoginCount.Substring(0, threeMonthsNoLoginCount.Length - 3); var oldBuyerCount = tbsellerStatic.Rows[8]["Result_Flag"].ToString(); if (oldBuyerCount.Length > 0) { lbOldBuyerCount.Text = oldBuyerCount.Substring(0, oldBuyerCount.Length - 3); } else { lbOldBuyerCount.Text = "0"; } } else { lbTotalSales.Text = "0"; lbOrderCount.Text = "0"; lbUserCount.Text = "0"; lbPerOrderPirce.Text = "0"; lbNewUserOrderCount.Text = "0"; lbRefundOrderCount.Text = "0"; lbNewBuyerCount.Text = "0"; QianZaiBuyerCount.Text = "0"; lb3MonthsNoLoginCount.Text = "0"; lbOldBuyerCount.Text = "0"; } //左上角店铺信息初始化 DataTable tbShop = ShopsBLL.GetSellerShopInfo(Users.Nick); if (tbShop != null && tbShop.Rows.Count > 0) { shopImg.ImageUrl = "http://logo.taobao.com/shop-logo" + tbShop.Rows[0]["pic_path"].ToString().Trim(); lbNickName.Text = Users.Nick; string shopName = tbShop.Rows[0]["title"].ToString().Trim(); if (shopName.Length > 10) { shopName = shopName.Substring(0, shopName.Length - 1) + "..."; } lbShopName.Text = shopName; Session["ShopName"] = lbShopName.Text; //订购服务到期时间 //ArticleUserSubscribe userSub = Users.GetDeadLineDate("ts-1811102", Users.Nick); lbUptoDate.Text = ""; //userSub == null ? DateTime.Now.AddMonths(1).ToShortDateString() : Convert.ToDateTime(userSub.Deadline).ToShortDateString(); } DataTable tb = MsgBLL.GetSellerMsgStatus(Users.Nick); if (tb != null && tb.Rows.Count > 0) { lbUnUseMsgCount.Text = tb.Rows[0]["msgCanUseCount"].ToString() + "条"; } else { lbUnUseMsgCount.Text = "0条"; } } } catch (Exception ex) { ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI); } }
// GET: api/Sellers/?email=value public SELLERS Get([FromUri] string email) { return(SellersBLL.GetSeller(email)); }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (string.IsNullOrEmpty(TextBox2.Text)) { Response.Write("<script language='javascript'>alert('请输入发送内容!');</script>"); return; } DataTable trade = null; string sigName = "【" + SellersBLL.GetSignName(Users.Nick) + "】"; string select = drpSType.SelectedValue.ToString(); switch (select) { case "sign_notSure": trade = TradeBLL.GetTradeData(Users.Nick, "taobao_trade_TradeSellerShip"); break; case "sure_notSign": trade = TradeBLL.GetTradeDataNosign(Users.Nick, "taobao_trade_TradeSellerShip"); break; case "sure_notSucce": trade = TradeBLL.GetTradeDataNoSuccess(Users.Nick, "taobao_trade_TradeSellerShip"); break; } if (trade == null || trade.Rows.Count == 0) { Response.Write("<script language='javascript'>alert('无数据!');</script>"); return; } for (int i = 0; i < trade.Rows.Count; i++) { DataTable ds = BuyerBLL.GetBuyerInfo(trade.Rows[i]["buyer_nick"].ToString(), "all", "all", "all", "", "", "", Users.Nick, ""); if (ds == null || ds.Rows.Count == 0) { continue; } string cellPhone = ds.Rows[i]["CellPhone"].ToString(); try { //判断手机 if (Utility.IsCellPhone(cellPhone)) { if (MsgBLL.CheckSellerMsgStatus()) { MsgSendHis objHis = new MsgSendHis(); objHis.TransNumber = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + cellPhone;//手机号码 2016 yao c objHis.SellerNick = Users.Nick; //objHis.SellerNick = "澄腾科技"; objHis.Buyer_nick = "*****"; objHis.CellPhone = cellPhone; objHis.SendDate = DateTime.Now; objHis.SendType = "手工发送"; objHis.SendStatus = "0"; objHis.Count = "1"; //objHis.MsgContent = "【" + SellersBLL.GetSignName(Users.Nick) + "】" + txtContent.Text.Trim();// +"退订回T"; objHis.MsgContent = sigName + TextBox2.Text + " 退订回N"; if (!Utility.IsYiDongCellPhoneNo(cellPhone)) { objHis.HelpSellerNick = "电信联通"; } else { objHis.HelpSellerNick = "移动"; } //if (true) test if (SmartBLL.AddMsgSendHis(objHis)) { try { objHis.MsgContent = objHis.MsgContent.Replace(" ", ""); if (objHis.MsgContent.Length <= 70) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 1); } else if (objHis.MsgContent.Length > 70 && objHis.MsgContent.Length <= 134) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 2); } else if (objHis.MsgContent.Length > 134 && objHis.MsgContent.Length <= 195) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 3); } else if (objHis.MsgContent.Length > 195 && objHis.MsgContent.Length <= 260) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 4); } if (!Utility.IsYiDongCellPhoneNo(cellPhone)) { //string sendStatus = Mobile.SendMsgKeTongDX(cellPhone, objHis.MsgContent); string sendStatus = Mobile.PostDataToMyServer(cellPhone, objHis.MsgContent.Trim());//20160626 yao c IDictionary resultDic = TopUtils.ParseJson(sendStatus); SmartBLL.UpdateSendStatus(resultDic["status"].ToString(), objHis.TransNumber); } else { string sendStatus = Mobile.SendMsgHubeiYDPost(cellPhone, objHis.MsgContent);//\r\n\r\n\r\n\r\n0 sendStatus = sendStatus.Replace("\r", "").Replace("\n", ""); if (sendStatus.Equals("0")) { sendStatus = "100"; } SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber); } } catch (Exception ex) { continue; } } } else { Response.Write("<script language='javascript'>alert('余额不足!');</script>"); return; } } } catch (Exception ex) { continue; } } Response.Write("<script language='javascript'>alert('发送成功!');</script>"); }
protected void Page_Load(object sender, EventArgs e) { lbSignPrv.Text = "【" + SellersBLL.GetSignName(Users.Nick) + "】"; }
// POST: api/Sellers public bool Post([FromBody] SELLERS seller) { return(SellersBLL.InsertSeller(seller)); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; var command = context.Request.Form["command"]; if (!string.IsNullOrEmpty(command)) { switch (command) { #region OpenDefense case "OpenDefense": { DataRow orderDate = SellersBLL.GetSelerOrderDate(Users.Nick); if (orderDate != null) { if (orderDate["OrderVersion"].Equals("体验版")) { context.Response.Write("nopower"); //试用版不能用 context.Response.End(); return; } } if (!ShieldRulesBLL.CheckCloseOrderConfigIsExit(Users.Nick)) { context.Response.Write("noConfig"); //保存拦截条件设置,才能开启差评自动防御! context.Response.End(); } else { DataTable tb = ShieldRulesBLL.GeCloseOrderConfigByNick(Users.Nick); if (tb != null && tb.Rows.Count > 0) { if (tb.Rows[0]["isAutoCloseOrder"].ToString().Equals("1")) { //btnOpen.ImageUrl = "~/images/closed.png"; ShieldRulesBLL.UpdateAutoCloseOrderStatus(Users.Nick, 0); //关闭订单自动拦截时先判断用户是否设置了自动秒评,否则关闭后就会出现问题 if (!ShieldRulesBLL.CheckIsMiaoPingAuto(Users.Nick)) { ITopClient client = TBManager.GetClient(); TmcUserCancelRequest req = new TmcUserCancelRequest(); req.Nick = Users.Nick; TmcUserCancelResponse response = client.Execute(req); if (response.IsSuccess) { } } context.Response.Write("cloedDefens"); //差评自动防御已关闭! context.Response.End(); } else { //btnOpen.ImageUrl = "~/images/open.png"; ShieldRulesBLL.UpdateAutoCloseOrderStatus(Users.Nick, 1); //检查是否开启了主动通知 ITopClient client = TBManager.GetClient(); TmcUserPermitRequest req = new TmcUserPermitRequest(); TmcUserPermitResponse response = client.Execute(req, Users.SessionKey); if (response.IsSuccess) { } context.Response.Write("openDefens"); //差评自动防御已开启! context.Response.End(); } } } } break; #endregion #region ClearDate case "ClearDate": { if (ShieldRulesBLL.UpdateCloseDate(Users.Nick)) { context.Response.Write("1"); //定时间段关闭已清除! context.Response.End(); } } break; #endregion #region closeOrder case "closeOrder": { string orderNo = context.Request.Form["orderNo"]; string reason = context.Request.Form["reason"]; TBTrade objTrade = new TBTrade(); Trade trade = objTrade.CloseOrderByTradeID(Convert.ToInt64(orderNo), reason); if (trade != null) { context.Response.Write("1"); //关闭成功 context.Response.End(); } if (ShieldRulesBLL.UpdateCloseDate(Users.Nick)) { context.Response.Write("0"); //关闭失败 context.Response.End(); } } break; #endregion } } }
// PUT: api/Sellers/5 public bool Put([FromBody] SELLERS seller) { return(SellersBLL.UpdateSeller(seller)); }
//special public IEnumerable <PURCHASEDETAILS> GetOrderDetails(int sellerid) { return(SellersBLL.SellerOrderDetails(sellerid)); }
// DELETE: api/Sellers/5 public bool Delete(int id) { return(SellersBLL.DeleteSeller(id)); }
protected void imgImportData_Click(object sender, ImageClickEventArgs e) { //Thread.Sleep(1000000); try { //ImageButton1.ImageUrl = @"~/Images/importing.png"; #region 订单交易导入 if (!String.IsNullOrEmpty(fileOrderUpload.PostedFile.FileName)) { //文件扩展名 string fileExtend = ""; string filePath = ""; //文件大小 long fileSize = 0; filePath = fileOrderUpload.PostedFile.FileName.ToLower().Trim(); //取得上传前的文件(存在于客户端)的文件或文件夹的名称 string[] names = filePath.Split('\\'); //取得文件名 string name = names[names.Length - 1]; //获得服务器端的根目录 string serverPath = Server.MapPath("~/SellerReport"); //判断是否有该目录 if (!Directory.Exists(serverPath)) { Directory.CreateDirectory(serverPath); } filePath = serverPath + "\\" + name; var fileImprtPath = serverPath + "\\"; //如果存在,删除文件 if (File.Exists(filePath)) { File.Delete(filePath); } // 上传文件 fileOrderUpload.PostedFile.SaveAs(filePath); //得到扩展名 fileExtend = filePath.Substring(filePath.LastIndexOf(".")); if (fileExtend != ".csv") { lbError.Text = "只支持CSV格式的文件!"; lbError.ForeColor = Color.Red; return; } System.IO.FileInfo f = new FileInfo(filePath); fileSize = f.Length; int size = Convert.ToInt32(fileSize) / (1024 * 1024); if (size >= 20) { lbError.Text = "最大可上传文件大小为20M!"; lbError.ForeColor = Color.Red; return; } CSVHelper obj = new CSVHelper(fileImprtPath, fileOrderUpload.FileName.ToLower().Trim()); DataTable tb = obj.Read(); long tick = DateTime.Now.Ticks; Random ran = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32)); //将订单交易信息写入到DB,同时更新买家表信息 if (tb != null && tb.Rows.Count > 0) { Trade o = null; Buyers objBuyer = null; foreach (DataRow row in tb.Rows) { try { o = new Trade(); //o.Tid = Convert.ToInt64(string.IsNullOrEmpty(row["订单编号"].ToString()) ? "000000" : row["订单编号"].ToString()); o.BuyerNick = row["买家会员名"].ToString(); o.SellerNick = Users.Nick; o.ReceiverAddress = row["收货地址 "].ToString(); o.ReceiverName = row["收货人姓名"].ToString(); o.ReceiverPhone = row["联系电话 "].ToString(); o.ReceiverMobile = row["联系手机"].ToString(); //更新买家信息表数据 objBuyer = new Buyers(); objBuyer.Address = o.ReceiverAddress; if (!String.IsNullOrEmpty(o.ReceiverAddress)) { string[] info = o.ReceiverAddress.Split(new char[] { ' ' }); if (info.Length > 0) { objBuyer.BuyerProvince = info[0].ToString(); } } objBuyer.BuyerId = Convert.ToInt64(ran.Next().ToString()); objBuyer.BuyerNick = o.BuyerNick; objBuyer.CellPhone = o.ReceiverMobile == null ? "" : o.ReceiverMobile.Replace("'", ""); objBuyer.Phone = o.ReceiverPhone == null ? "" : o.ReceiverPhone.Replace("'", ""); objBuyer.Buyer_reallName = String.IsNullOrEmpty(o.ReceiverName) ? "unknown!" : o.ReceiverName; objBuyer.SELLER_ID = Users.Nick; objBuyer.UpdateDate = DateTime.Now.ToString(); objBuyer.LastTradeTime = Convert.ToString(row["订单付款时间 "]); objBuyer.TradeAmount = row["买家实际支付金额"].ToString(); objBuyer.ItemNum = Convert.ToInt64(row["宝贝总数量"]); objBuyer.TradeCount = 1L; objBuyer.Grade = 1; objBuyer.Address = o.ReceiverAddress; if (BuyerBLL.CheckBuyerIsExit(objBuyer.BuyerNick, Users.Nick, sellerId)) { BuyerBLL.UpdateForHistory(objBuyer, sellerId); } else { BuyerBLL.AddBuyerBySeller(objBuyer); } } catch (Exception ex) { //ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI); continue; } } //将最新同步数据时间更新写入DB Sellers objSeller = new Sellers(); objSeller.Nick = Users.Nick; SellersBLL.UpdateSellerSynDate(objSeller); } lbError.Text = "导入报表数据成功!"; } else { lbError.Text = "请选择小于20M的CSV格式文件!"; } //ImageButton1.ImageUrl = @"~/Images/import.png"; #endregion } catch (Exception ex) { ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Data); //lbError.Text = "导入报表失败,请联系客服!"; lbError.Text = "导入报表失败,报表内容格式不正确!"; lbError.ForeColor = Color.Red; //ImageButton1.ImageUrl = @"~/Images/import.png"; return; } }
public SELLERS GetAllData(int sellerid) { return(SellersBLL.SellerAllData(sellerid)); }
protected void btnByhand_Click(object sender, ImageClickEventArgs e) { if (!CheckIsOpenMsgAcount()) { return; } string cellPhone = txtCellPhone.Text.Trim(); if (string.IsNullOrEmpty(cellPhone)) { lbMsg2.Text = "请填写手机号码内容!"; txtCellPhone.Focus(); return; } if (!Utility.IsCellPhone(cellPhone)) { lbMsg2.Text = "请填写正确的手机号码内容!"; txtCellPhone.Focus(); return; } if (string.IsNullOrEmpty(txtByHandContent.Text.Trim())) { lbMsg.Text = "提醒内容不能为空!"; txtByHandContent.Focus(); return; } if (MsgBLL.CheckSellerMsgStatus()) { MsgSendHis objHis = new MsgSendHis(); objHis.TransNumber = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + cellPhone;//手机号码 objHis.SellerNick = Users.Nick; objHis.Buyer_nick = "*****"; objHis.CellPhone = cellPhone; objHis.SendDate = DateTime.Now; objHis.SendType = "手工退货提醒发送"; objHis.SendStatus = "0"; objHis.MsgContent = "【" + SellersBLL.GetSignName(Users.Nick) + "】" + txtByHandContent.Text.Trim(); objHis.HelpSellerNick = ""; if (SmartBLL.AddMsgSendHis(objHis)) { try { List <string> lstCellPhoneNo = new List <string>(); lstCellPhoneNo.Add(cellPhone.ToString()); if (objHis.MsgContent.Length <= 70) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 1); } else if (objHis.MsgContent.Length > 70 && objHis.MsgContent.Length <= 134) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 2); } else if (objHis.MsgContent.Length > 134 && objHis.MsgContent.Length <= 195) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 3); } string sendStatus = Mobile.sendMsgReminder(lstCellPhoneNo, objHis.MsgContent); } catch (Exception ex) { ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI); } } lbmsg5.Text = "提醒发送成功"; txtCellPhone.Text = ""; txtCellPhone.Focus(); } }
// GET: api/Sellers/5 public SELLERS Get(int id) { return(SellersBLL.GetSeller(id)); }
protected void btnSave_Click(object sender, ImageClickEventArgs e) { try { //检查输入项的值是否正确 if (String.IsNullOrEmpty(txtAmount.Text.Trim())) { lberror2.Text = "金额不能为空!"; return; } if (!Utility.IsINT(txtAmount.Text.Trim())) { lberror2.Text = "金额必须为正整数!"; return; } MsgSendConfig o = new MsgSendConfig(); o.SellerNick = Users.Nick; o.ShopName = SellersBLL.GetSignName(Users.Nick); string strUnpayType = "0"; string payType = "0"; string shippingType = "0"; string arrivedType = "0"; string signType = "0"; string delayShipType = "0"; string huiZJType = "0"; DataTable tb = MemberNotifyBLL.GetMsgConfigByBuyerSellerNick(o); if (tb != null && tb.Rows.Count > 0) { strUnpayType = tb.Rows[0]["unPayType"].ToString(); payType = tb.Rows[0]["payType"].ToString(); shippingType = tb.Rows[0]["shippingType"].ToString(); arrivedType = tb.Rows[0]["arrivedType"].ToString(); signType = tb.Rows[0]["signType"].ToString(); delayShipType = tb.Rows[0]["delayShippingType"].ToString(); huiZJType = tb.Rows[0]["huiZJType"].ToString(); } #region 催款 string strUnpayMsg = ""; string unpayMsgCus = ""; string isUnpayMsgCus = "0"; if (rdounpayTemp1.Checked) { strUnpayMsg = rdounpayTemp1.Text.Trim(); } if (rdounpayTemp2.Checked) { strUnpayMsg = rdounpayTemp2.Text.Trim(); } if (rdounpayTemp3.Checked) { strUnpayMsg = rdounpayTemp3.Text.Trim(); } if (rdoUnpayCus.Checked) { unpayMsgCus = txtUnpayCusContent.Text.Trim(); isUnpayMsgCus = "1"; } else { unpayMsgCus = ""; isUnpayMsgCus = "0"; } o.UnpayMsg = strUnpayMsg; o.UnPayType = strUnpayType; o.UnpayMsgCus = unpayMsgCus; o.IsUnpayMsgCus = isUnpayMsgCus; #endregion #region 付款 string payMsg = ""; string payMsgCus = ""; string isPayMsgCus = "0"; if (rdoPayType1.Checked) { payMsg = rdoPayType1.Text.Trim(); } if (rdoPayType2.Checked) { payMsg = rdoPayType2.Text.Trim(); } if (rdoPayType3.Checked) { payMsg = rdoPayType3.Text.Trim(); } if (rdoPayTypeCus.Checked) { payMsgCus = txtPayCus.Text.Trim(); isPayMsgCus = "1"; } else { payMsgCus = ""; isPayMsgCus = "0"; } o.PayMsg = payMsg; o.PayType = payType; o.PayMsgCus = payMsgCus; o.IsPayMsgCus = isPayMsgCus; #endregion #region 发货 string shippingNofityMsg = ""; string shippingNofityMsgCus = ""; string isShippingMsgCus = "0"; if (rdoShippingCont1.Checked) { shippingNofityMsg = rdoShippingCont1.Text.Trim(); } if (rdoShippingCont2.Checked) { shippingNofityMsg = rdoShippingCont2.Text.Trim(); } if (rdoShippingCont3.Checked) { shippingNofityMsg = rdoShippingCont3.Text.Trim(); } if (rdoShiping.Checked) { shippingNofityMsgCus = txtShippingContent.Text.Trim(); isShippingMsgCus = "1"; } else { shippingNofityMsgCus = ""; isShippingMsgCus = "0"; } o.ShippingNofityMsg = shippingNofityMsg; o.ShippingType = shippingType; o.ShippingNofityMsgCus = shippingNofityMsgCus; o.IsShippingMsgCus = isShippingMsgCus; #endregion #region 延时发货 string delayShippingNofityMsg = ""; string delayShippingNofityMsgCus = ""; string isDelayShippingMsgCus = "0"; if (rdoDelayShipping.Checked) { delayShippingNofityMsg = rdoDelayShipping.Text.Trim(); } if (rdoDelayShipCus.Checked) { delayShippingNofityMsgCus = txtDelayShippingCus.Text.Trim(); isDelayShippingMsgCus = "1"; } else { delayShippingNofityMsgCus = ""; isDelayShippingMsgCus = "0"; } o.DelayShippingNofityMsg = delayShippingNofityMsg; o.DelayShippingType = delayShipType; o.DelayShippingNofityMsgCus = delayShippingNofityMsgCus; o.IsDelayShippingMsgCus = isDelayShippingMsgCus; #endregion #region 达到 string arrivedNofityMsg = ""; string arrivedNofityMsgCus = ""; string isArrivedMsgCus = "0"; if (RadioButton4.Checked) { arrivedNofityMsg = RadioButton4.Text.Trim(); } if (RadioButton5.Checked) { arrivedNofityMsg = RadioButton5.Text.Trim(); } if (RadioButton6.Checked) { arrivedNofityMsg = RadioButton6.Text.Trim(); } if (RadioButton7.Checked) { arrivedNofityMsgCus = txtArrivedContent.Text.Trim(); isArrivedMsgCus = "1"; } else { arrivedNofityMsgCus = ""; isArrivedMsgCus = "0"; } o.ArrivedNofityMsg = arrivedNofityMsg; o.ArrivedType = arrivedType; o.ArrivedNofityMsgCus = arrivedNofityMsgCus; o.IsArrivedMsgCus = isArrivedMsgCus; #endregion #region 签收 string signNofityMsg = ""; string signNotifyMsgCus = ""; string isSignMsgCus = "0"; if (rdoSign1.Checked) { signNofityMsg = rdoSign1.Text.Trim(); } if (rdoSign2.Checked) { signNofityMsg = rdoSign2.Text.Trim(); } if (rdoSign3.Checked) { signNofityMsg = rdoSign3.Text.Trim(); } if (rdoSignCus.Checked) { signNotifyMsgCus = txtSignCus.Text.Trim(); isSignMsgCus = "1"; } else { signNotifyMsgCus = ""; isSignMsgCus = "0"; } o.SignNofityMsg = signNofityMsg; o.SignType = signType; o.SignNotifyMsgCus = signNotifyMsgCus; o.IsSignMsgCus = isSignMsgCus; #endregion #region 回款 string huiZJNofityMsg = ""; string huiZJNotifyMsgCus = ""; string isHuiZJMsgCus = "0"; if (rdoHuiZJCont.Checked) { huiZJNofityMsg = rdoHuiZJCont.Text.Trim(); } if (rdoHuiZJCus.Checked) { huiZJNotifyMsgCus = txtHuiZJContent.Text.Trim(); isHuiZJMsgCus = "1"; } else { huiZJNotifyMsgCus = ""; isHuiZJMsgCus = "0"; } o.HuiZJNofityMsg = huiZJNofityMsg; o.HuiZJType = huiZJType; o.HuiZJNofityMsgCus = huiZJNotifyMsgCus; o.IsHuiZJMsgCus = isHuiZJMsgCus; #endregion //if (tb != null && tb.Rows.Count > 0) //{ o.Amount = txtAmount.Text.Trim().ToString(); o.BuyerLevel = 0; if (MemberNotifyBLL.UpdateMsgConfig(o)) { lbMsg.Text = "条件保存成功!"; lbMsg.ForeColor = Color.Blue; } else { lbMsg.Text = "条件保存失败,请联系客服"; } //} } catch (Exception ex) { ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI); lbMsg.Text = "条件保存失败,请联系客服"; } }
protected void BindData() { DataTable dt = new DataTable(); DataColumn dc = null; string nick = TextBox4.Text.Trim(); string startDate = txt_StartTime.Value; string endDate = txt_EndTime.Value; string startPay = TextBox2.Text.Trim(); string endDPay = TextBox3.Text.Trim(); try { if (!string.IsNullOrEmpty(startPay)) { Convert.ToInt32(startPay); } if (!string.IsNullOrEmpty(endDPay)) { Convert.ToInt32(endDPay); } } catch (Exception e) { Response.Write("<script language='javascript'>alert('输入正确格式的金额!');</script>"); return; } dc = dt.Columns.Add("reciverName", Type.GetType("System.String")); dc = dt.Columns.Add("cellPhone", Type.GetType("System.String")); if (string.IsNullOrEmpty(nick) == true) { return; } DataTable trade = null; string select = drpSType.SelectedValue.ToString(); switch (select) { case "sign_notSure": trade = TradeBLL.GetTradeData(nick, startDate, endDate, startPay, endDPay, "taobao_trade_TradeSellerShip"); break; case "sure_notSign": trade = TradeBLL.GetTradeDataNosign(nick, startDate, endDate, startPay, endDPay, "taobao_trade_TradeSellerShip"); break; case "sure_notSucce": trade = TradeBLL.GetTradeDataNoSuccess(nick, startDate, endDate, startPay, endDPay, "taobao_trade_TradeSellerShip"); break; } Trade tradeInfo = null; if (trade != null && trade.Rows.Count > 0) { string key = SellersBLL.GetSellerSessionKey(nick); foreach (DataRow row in trade.Rows)//轮训订单 { //获取订单id string tid = row["tid"].ToString(); //调用淘宝接口获取订单详细交易信息 tradeInfo = TBTrade.GetTradeContact(Convert.ToInt64(tid), key); string cellPhone = tradeInfo == null ? "" : tradeInfo.ReceiverMobile; string reciverName = tradeInfo == null ? "" : tradeInfo.ReceiverName; DataRow drow = dt.NewRow(); drow["reciverName"] = reciverName; drow["cellPhone"] = cellPhone; dt.Rows.Add(drow); } } tb_member = dt; grdBuyer.DataSource = trade; grdBuyer.DataBind(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string sigNames = SellersBLL.GetSignName(Users.Nick); string sigName = "【" + SellersBLL.GetSignName(Users.Nick) + "】"; //string sigName = "【澄腾科技01】"; HttpFileCollection files = context.Request.Files; if (files.Count > 0) { HttpPostedFile file = files[0]; string[] noWenmings = new string[] { "傻逼", "草", "靠", "黄片", "尼玛", "你妈", "屌丝", "逗比", "你妹", "装逼", "妈蛋", "逼格", "撕逼" , "滚粗", "蛋疼", "婊砸", "跪舔", "婊", "碧池", "土肥圆", "矮穷挫" }; string content = context.Request.QueryString["msgContent"]; for (int s = 0; s < noWenmings.Length - 1; s++) { if (content.IndexOf(noWenmings[s]) > 0) { context.Response.Write("6"); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } } List <string> phones = new List <string>(); if (!String.IsNullOrEmpty(file.FileName)) { #region 文件上传 //文件扩展名 string fileExtend = ""; string filePath = ""; //文件大小 int fileSize = 0; filePath = file.FileName.ToLower().Trim(); //取得上传前的文件(存在于客户端)的文件或文件夹的名称 string[] names = filePath.Split('\\'); //取得文件名 string name = names[names.Length - 1]; //获得服务器端的根目录 string serverPath = context.Server.MapPath("~/SellerReport"); //判断是否有该目录 if (!Directory.Exists(serverPath)) { Directory.CreateDirectory(serverPath); } filePath = serverPath + "\\" + name; var fileImprtPath = serverPath + "\\"; //如果存在,删除文件 if (File.Exists(filePath)) { File.Delete(filePath); } // 上传文件 file.SaveAs(filePath); //得到扩展名 fileExtend = filePath.Substring(filePath.LastIndexOf(".")); if (fileExtend != ".txt" && fileExtend != ".csv") { context.Response.Write("1"); context.Response.End(); } #endregion // 获得给卖家设置的发送百分之几 int i = 100; DataTable dtPrecent = MsgBLL.GetSellerMsgSendPrecent(Users.Nick); if (dtPrecent == null || dtPrecent.Rows.Count == 0 || dtPrecent.Rows[0]["sendPrecent"] == DBNull.Value) { i = 100; } else { try { i = Convert.ToInt32(dtPrecent.Rows[0]["sendPrecent"]); } catch (Exception es) { i = 100; } } //短信发送开始记录 msgSendingBLL.update(Users.Nick, 1); //CSV格式 if (fileExtend == ".csv") { System.IO.FileInfo f = new FileInfo(filePath); CSVHelper obj = new CSVHelper(serverPath + "\\", name); DataTable tb = obj.Read(); //将订单交易信息写入到DB,同时更新买家表信息 if (tb != null && tb.Rows.Count > 0) { float ftemp = (float)i / 100; //可以发送的短信条数 int cansendCount = Convert.ToInt32(tb.Rows.Count * ftemp); int sendedCount = 1; for (int t = 0; t < tb.Rows.Count; t++) { string cellPhone = tb.Rows[t]["联系手机"].ToString(); if (string.IsNullOrEmpty(cellPhone) == true) { continue; } string num_char = cellPhone.Substring(0, 1); if (Utility.IsINT(num_char) == false) { cellPhone = cellPhone.Substring(1, cellPhone.Length - 1); } if (phones.Contains(cellPhone) || cellPhone == "") { continue; } cellPhone = cellPhone.Replace("\'", ""); phones.Add(cellPhone); try { //判断手机 if (Utility.IsCellPhone(cellPhone.Replace("\'", ""))) { //if(true) if (MsgBLL.CheckSellerMsgStatus()) { MsgSendHis objHis = new MsgSendHis(); objHis.TransNumber = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + cellPhone; //手机号码 2016 yao c objHis.SellerNick = Users.Nick; //objHis.SellerNick = "澄腾科技"; objHis.Buyer_nick = "*****"; objHis.CellPhone = cellPhone; objHis.SendDate = DateTime.Now; objHis.SendType = "手工发送"; objHis.SendStatus = "0"; objHis.Count = "1"; //objHis.MsgContent = "【" + SellersBLL.GetSignName(Users.Nick) + "】" + txtContent.Text.Trim();// +"退订回T"; objHis.MsgContent = sigName + content.Trim() + "退订回N"; if (!Utility.IsYiDongCellPhoneNo(cellPhone)) { objHis.HelpSellerNick = "电信联通"; } else { objHis.HelpSellerNick = "移动"; } //if (true) test if (SmartBLL.AddMsgSendHis(objHis)) { try { objHis.MsgContent = objHis.MsgContent.Replace(" ", ""); if (objHis.MsgContent.Length <= 70) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 1); } else if (objHis.MsgContent.Length > 70 && objHis.MsgContent.Length <= 134) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 2); } else if (objHis.MsgContent.Length > 134 && objHis.MsgContent.Length <= 195) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 3); } else if (objHis.MsgContent.Length > 195 && objHis.MsgContent.Length <= 260) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 4); } //File.AppendAllText(@"D:\log\1.txt", "sendedCount:" + t + " cansendCount:" + cansendCount + "\n"); if (t >= cansendCount) { SmartBLL.UpdateSendStatus("99", objHis.TransNumber); } else { string sendStatus = TBSendMSg.SendMsg(cellPhone, sigNames, objHis.MsgContent.Replace(sigName, "")); //SendMsg(cellPhone, sigName, objHis.MsgContent.Trim()); if (!Utility.IsYiDongCellPhoneNo(cellPhone)) { //string sendStatus = Mobile.PostDataToMyServer(cellPhone, objHis.MsgContent.Trim());//20160626 yao c //IDictionary resultDic = TopUtils.ParseJson(sendStatus); SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber); } else { //string sendStatus = Mobile.SendMsgHubeiYDPost(cellPhone, objHis.MsgContent);//\r\n\r\n\r\n\r\n0 //sendStatus = sendStatus.Replace("\r", "").Replace("\n", ""); if (sendStatus.Equals("0")) { sendStatus = "100"; } SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber); } } } catch (Exception ex) { continue; } } } else { context.Response.Write("3"); //余额不足 //context.Response.End();//使用 Response.End方法,将出现 ThreadAbortException 异常。 HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } } } catch (Exception ex) { continue; } sendedCount++; } } //短信发送成功记录 msgSendingBLL.update(Users.Nick, 2, phones.Count); context.Response.Write("2"); //context.Response.End(); HttpContext.Current.ApplicationInstance.CompleteRequest(); } else if (fileExtend == ".txt") { using (StreamReader Sr = new StreamReader(filePath, true)) { /*读取到的每行内容*/ string cellPhone1 = String.Empty; while (Sr.EndOfStream != true) { cellPhone1 = Sr.ReadLine().Trim(); if (phones.Contains(cellPhone1) || cellPhone1 == "") { continue; } cellPhone1 = cellPhone1.Replace("\'", ""); phones.Add(cellPhone1); } float ftemp = (float)i / 100; //可以发送的短信条数 int cansendCount = Convert.ToInt32(phones.Count * ftemp); int sendedCount = 0; #region 发短信 foreach (string cellPhone in phones) { int j = 0; try { //判断手机 if (Utility.IsCellPhone(cellPhone)) { if (MsgBLL.CheckSellerMsgStatus()) { MsgSendHis objHis = new MsgSendHis(); objHis.TransNumber = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + cellPhone;//手机号码 2016 yao c objHis.SellerNick = Users.Nick; //objHis.SellerNick = "澄腾科技"; objHis.Buyer_nick = "*****"; objHis.CellPhone = cellPhone; objHis.SendDate = DateTime.Now; objHis.SendType = "手工发送"; objHis.SendStatus = "0"; objHis.Count = "1"; objHis.MsgContent = sigName + content.Trim() + " 退订回N"; if (!Utility.IsYiDongCellPhoneNo(cellPhone)) { objHis.HelpSellerNick = "电信联通"; } else { objHis.HelpSellerNick = "移动"; } //if (true) test if (SmartBLL.AddMsgSendHis(objHis)) { try { objHis.MsgContent = objHis.MsgContent.Replace(" ", ""); if (objHis.MsgContent.Length <= 70) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 1); } else if (objHis.MsgContent.Length > 70 && objHis.MsgContent.Length <= 134) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 2); } else if (objHis.MsgContent.Length > 134 && objHis.MsgContent.Length <= 195) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 3); } else if (objHis.MsgContent.Length > 195 && objHis.MsgContent.Length <= 260) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 4); } if (sendedCount >= cansendCount) { SmartBLL.UpdateSendStatus("99", objHis.TransNumber); } else { string sendStatus = TBSendMSg.SendMsg(cellPhone, sigNames, objHis.MsgContent.Replace("退订回N", "").Replace(sigName, "")); if (!Utility.IsYiDongCellPhoneNo(cellPhone)) { //string sendStatus = Mobile.SendMsgKeTongDX(cellPhone, objHis.MsgContent); //string sendStatus = Mobile.PostDataToMyServer(cellPhone, objHis.MsgContent.Trim());//20160626 yao c //IDictionary resultDic = TopUtils.ParseJson(sendStatus); //SmartBLL.UpdateSendStatus(resultDic["status"].ToString(), objHis.TransNumber); SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber); } else { //string sendStatus = Mobile.SendMsgHubeiYDPost(cellPhone, objHis.MsgContent);//\r\n\r\n\r\n\r\n0 //sendStatus = sendStatus.Replace("\r", "").Replace("\n", ""); if (sendStatus.Equals("0")) { sendStatus = "100"; } SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber); } } sendedCount++; j++; //} //else //{ // if (!Utility.IsYiDongCellPhoneNo(cellPhone)) // { // string sendStatus = Mobile.PostDataToMyServer(cellPhone, objHis.MsgContent.Trim(), ""); // } // else // { // Mobile.SendMsgKeTongYD(cellPhone, objHis.MsgContent); // } //} } catch (Exception ex) { continue; } } } else { context.Response.Write("3");//余额不足 //context.Response.End();//使用 Response.End方法,将出现 ThreadAbortException 异常。 HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } } } catch (Exception ex) { continue; } } #endregion //短信发送成功记录 msgSendingBLL.update(Users.Nick, 2, phones.Count); context.Response.Write("2"); //context.Response.End(); HttpContext.Current.ApplicationInstance.CompleteRequest(); } } } else { context.Response.Write("0"); //context.Response.End(); HttpContext.Current.ApplicationInstance.CompleteRequest(); msgSendingBLL.update(Users.Nick, 2, phones.Count); } } }