protected void bt_all_Click(object sender, EventArgs e) { int j = 0; if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { try { string seller = Convert.ToString(dt.Rows[i]["sellerNick"]); string seller_id = SellersBLL.GetSellerIdByNick(seller); if (!string.IsNullOrEmpty(seller_id)) { long count = Convert.ToInt32(BuyerBLL.GetBuyerCount("1", seller)); if (count > 0) { } else { SellersDAL sellerdl = new SellersDAL(); sellerdl.addBuyerData(seller_id); j++; } } } catch { continue; } lb_num.Text = j.ToString(); } } }
void loadMember() { string start = string.Empty; string end = string.Empty; start = txt_StartTime.Value; end = txt_EndTime.Value; if (start == "") { //查近三个月 end = DateTime.Now.Date.ToShortDateString(); start = DateTime.Now.Date.AddMonths(-3).ToShortDateString(); } //开始查找数据 tb_member = null; gv_buyer.DataSource = null; gv_buyer.DataBind(); lb_buyerCount.Text = ""; string nick_id = SellersBLL.GetSellerIdByNick(tb_nick.Text); if (!string.IsNullOrEmpty(nick_id)) { tb_member = BuyerBLL.GetExportBuyers(tb_nick.Text, start, end, nick_id); if (tb_member != null && tb_member.Rows.Count > 0) { gv_buyer.DataSource = tb_member.DefaultView; gv_buyer.DataBind(); lb_buyerCount.Text = "(总计:" + tb_member.Rows.Count.ToString() + "行)"; } } }
//读取会员api protected void Button2_Click(object sender, EventArgs e) { string sellerNick = TextBox2.Text.Trim(); string session = txtSession.Text.Trim(); //如果没有会员,则尝试建立会员列表 20160704 yao string memberNum = BuyerBLL.GetBuyerCount("1", sellerNick); if (memberNum.Equals("0") == true) { if (string.IsNullOrEmpty(sellerNick) == true) { lbError.Text = "请输入昵称!"; return; } ; string seller_id = SellersBLL.GetSellerIdByNick(sellerNick); if (string.IsNullOrEmpty(seller_id) == false) { SellersDAL sellerdl = new SellersDAL(); sellerdl.addBuyerData(seller_id); } } try { //下载淘宝数据到本地 //初始化系统分组 InitGroup(sellerNick); BuyerBLL buyerObj = new BuyerBLL(); if (buyerObj.SynicBuyersInformation(sellerNick, session)) { //将最新同步数据时间更新写入DB Sellers objSeller = new Sellers(); objSeller.Nick = sellerNick; SellersBLL.UpdateSellerSynDate(objSeller); } lbError.Text = "会员同步完成!"; lbError.ForeColor = Color.Blue; } catch (Exception err) { ExceptionReporter.WriteLog(err, ExceptionPostion.TBApply_Data); lbError.Text = "会员同步完成,但出现异常,详情请看日志!"; } }
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) { //获取卖家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); } }
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 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; }