Example #1
0
        protected void SubmitBtn_Click(object sender, EventArgs e)
        {
            string uname = (string)Session["Logged"];
            string pass  = (string)Session["lPwd"];
            int    aid   = (int)Session["accId"];

            AccountsBLL user = new AccountsBLL();
            AccountsDAL a    = user.retrieveUser(uname, pass);

            BuyerBLL buyer = new BuyerBLL();
            BuyerDAL b     = buyer.retrieveFinPlan(aid);

            string  mainName          = b.MainApplicantName;
            decimal mainSalary        = b.MainApplicantSalary;
            string  coName            = b.CoApplicantName;
            decimal coSalary          = b.CoApplicantSalary;
            decimal totSavings        = b.totalSavings;
            decimal upfrontPayment    = b.upfrontPaymentBudget;
            int     loanServicePeriod = b.loanServicingPeriod;
            string  useCpf            = b.userCpfToService;

            decimal ab1 = decimal.Parse(theTotalSavings.Text);
            decimal ac1 = decimal.Parse(theUpfrontPaymentBudget.Text.Trim());


            decimal asd  = ab1 + ac1;
            decimal asdf = asd - (asd * 0.8m) + (asd * 0.0275m);

            Label1.Text = "Recommended Bufget: S$ " + asdf;
        }
Example #2
0
        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();
                }
            }
        }
        protected void bt_seach_Click(object sender, EventArgs e)
        {
            string buyerNick      = tbx_nick.Text.Trim();;
            string lastTradeDate1 = tbx_trade_start.Value.Trim();
            string lastTradeDate2 = tbx_trade_end.Value.Trim();
            string grade          = ddl_level.SelectedValue.ToString();
            string num1           = tbx_buy_count01.Text.Trim();
            string num2           = tbx_buy_count02.Text.Trim();
            string area           = ddl_province.SelectedValue.ToString();
            string tradeAmount1   = tbx_money01.Text.Trim();
            string tradeAmount2   = tbx_money02.Text.Trim();
            string tradePinNv     = ddl_pinlv.SelectedValue.ToString();
            string buyCount       = tbx_buy_count.Text.Trim();
            string drpDay         = "";

            drpDay = ddl_day.SelectedValue.ToString();
            DataTable ds = BuyerBLL.GetBuyerInfoToMsg(buyerNick, lastTradeDate1, lastTradeDate2, grade, num1, num2,
                                                      area, tradeAmount1, tradeAmount2, Users.Nick, drpDay, tradePinNv, buyCount);

            Session["MsgData"] = ds;
            if (ds != null && ds.Rows.Count > 10000)
            {
                //string msgC = "亲~本次群发会员数为:" + ds.Rows.Count.ToString() + " 个,注意检查短信账户余额!由于数据过大,会员数据不会显示在下面的列表中,请直接群发!";
                gv_member.DataSource = ds.DefaultView;
                gv_member.DataBind();
            }
            else
            {
                //if (ds != null && ds.Rows.Count > 0)
                //{
                //    string msgC = "亲~能发送短信的有效客户数有:" + ds.Rows.Count.ToString() + " 个,注意检查短信账户余额是否足够,以及是否已经同步了店铺所有会员信息!";
                //}
            }
        }
Example #4
0
        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() + "行)";
                }
            }
        }
Example #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         var buyerID = Request.QueryString["buyer_id"].ToString();
         if (!string.IsNullOrEmpty(buyerID))
         {
             Buyers buyer = new Buyers();
             buyer.BuyerId   = Convert.ToInt64(buyerID);
             buyer.SELLER_ID = Users.Nick;
             buyer.BuyerNick = BuyerBLL.GetBuyerNickByID(buyerID);
             DataTable tbBuyerBaseInfo = BuyerBLL.GetBuyerListFromDB(buyer);
             if (tbBuyerBaseInfo != null && tbBuyerBaseInfo.Rows.Count > 0)
             {
                 //会员基本信息
                 lbBuyerNick.Text   = tbBuyerBaseInfo.Rows[0]["buyer_nick"].ToString();
                 lbBuyerLevel.Text  = tbBuyerBaseInfo.Rows[0]["grade"].ToString();
                 lbBuyerStatus.Text = tbBuyerBaseInfo.Rows[0]["status"].ToString();
                 lbTradeAmount.Text = "¥" + tbBuyerBaseInfo.Rows[0]["trade_amount"].ToString();
                 //详细区域
                 txtRealName.Text   = tbBuyerBaseInfo.Rows[0]["buyer_reallName"].ToString();
                 txtCellphone.Text  = tbBuyerBaseInfo.Rows[0]["cellPhone"].ToString();
                 txtPhone.Text      = tbBuyerBaseInfo.Rows[0]["Phone"].ToString();
                 txtQQ.Text         = tbBuyerBaseInfo.Rows[0]["qq"].ToString();
                 dateBirthDay.Value = tbBuyerBaseInfo.Rows[0]["birthDay"].ToString();
                 txtZIPCode.Text    = tbBuyerBaseInfo.Rows[0]["zipCode"].ToString();
                 txtEmail.Text      = tbBuyerBaseInfo.Rows[0]["email"].ToString();
                 lbJifen.Text       = "0";
                 txtAddress.Text    = tbBuyerBaseInfo.Rows[0]["address"].ToString();
                 txtMemo.Text       = tbBuyerBaseInfo.Rows[0]["memo"].ToString();
             }
         }
     }
 }
Example #6
0
 protected void imgbtnExport_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         //高级版以上用户才可以设置
         if (SellersBLL.CheckSellerIsExit(Users.Nick))
         {
             DataTable tb = null;
             if (rdoAllMember.Checked)//全部会员资料导出
             {
                 tb = BuyerBLL.GetExportBuyers(Users.Nick);
             }
             else
             { //部分会员资料导出
                 tb = BuyerBLL.GetExportBuyers(Users.Nick, datePicker.Value, datePickerEnd.Value, drpArea.SelectedValue, txtTradeAmountFrom.Text.Trim(), txtTradeAmountTo.Text.Trim());
             }
             if (tb != null && tb.Rows.Count > 0)
             {
                 DownloadToExcel(tb);
             }
             else
             {
                 Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script type='text/javascript' defer=defer>alert('没有要下载的会员数据!');</script>");
             }
         }
         else
         {
             versionControl.Visible = true;
         }
     }
     catch (Exception ex)
     {
         ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI);
     }
 }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string uname = (string)Session["Logged"];
            string pass  = (string)Session["lPwd"];
            int    aid   = (int)Session["accId"];

            AccountsBLL user = new AccountsBLL();
            AccountsDAL a    = user.retrieveUser(uname, pass);


            string fullname = a.fullName;
            string mobile   = a.mobile;
            string email    = a.email;
            string address  = a.address;


            BuyerBLL buyer = new BuyerBLL();
            BuyerDAL b     = buyer.retrieveFinPlan(aid);

            string  mainName          = b.MainApplicantName;
            decimal mainSalary        = b.MainApplicantSalary;
            string  coName            = b.CoApplicantName;
            decimal coSalary          = b.CoApplicantSalary;
            decimal totSavings        = b.totalSavings;
            decimal upfrontPayment    = b.upfrontPaymentBudget;
            int     loanServicePeriod = b.loanServicingPeriod;
            string  useCpf            = b.userCpfToService;


            UserName.Text = fullname;
            Mobile.Text   = mobile;
            Email.Text    = email;
            Address.Text  = address;

            theMainApplicantName.Text    = mainName;
            theMainApplicantSalary.Text  = mainSalary.ToString();
            theCoApplicantName.Text      = coName;
            theCoApplicantSalary.Text    = coSalary.ToString();
            theTotalSavings.Text         = totSavings.ToString();
            theUpfrontPaymentBudget.Text = upfrontPayment.ToString();
            theLoanServicePeriod.Text    = loanServicePeriod.ToString();



            //Page lastPage = (Page)Context.Handler;
            //string asd = ((TextBox)lastPage.FindControl("loginTextbox")).Text;

            //SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MYDBConnection"].ConnectionString);
            //conn.Open();
            //SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM Accounts WHERE userName ='******'", conn);
            //DataTable dt = new DataTable();
            //sda.Fill(dt);

            //name1 = dt.Rows[0][3].ToString();
            //theName.Text = name1;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                var buyerID = Request.QueryString["buyer_id"].ToString();
                if (!string.IsNullOrEmpty(buyerID))
                {
                    Buyers buyer = new Buyers();
                    buyer.BuyerId   = Convert.ToInt64(buyerID);
                    buyer.BuyerNick = BuyerBLL.GetBuyerNickByID(buyerID);
                    buyer.SELLER_ID = Users.Nick;
                    DataTable tbBuyerBaseInfo = BuyerBLL.GetBuyerListFromDB(buyer);
                    if (tbBuyerBaseInfo != null && tbBuyerBaseInfo.Rows.Count > 0)
                    {
                        //会员基本信息
                        lbBuyerNick.Text         = tbBuyerBaseInfo.Rows[0]["buyer_nick"].ToString();
                        lbBuyerLevel.Text        = tbBuyerBaseInfo.Rows[0]["grade"].ToString();
                        lbBuyerStatus.Text       = tbBuyerBaseInfo.Rows[0]["status"].ToString();
                        lbTradeAmount.Text       = tbBuyerBaseInfo.Rows[0]["trade_amount"].ToString();
                        lbTradeCount.Text        = tbBuyerBaseInfo.Rows[0]["trade_count"].ToString();
                        lbTradeProductCount.Text = tbBuyerBaseInfo.Rows[0]["item_num"].ToString();
                        lbCloseTradeCount.Text   = tbBuyerBaseInfo.Rows[0]["close_trade_count"].ToString();
                        lbCloseTradeAmount.Text  = tbBuyerBaseInfo.Rows[0]["close_trade_amount"].ToString();
                        if (lbCloseTradeAmount.Text != "0.00")
                        {
                            lbCloseTradeAmount.ForeColor = Color.Red;
                        }
                        lbBuyerCredit.Text = tbBuyerBaseInfo.Rows[0]["buyer_credit"].ToString();
                        if (!string.IsNullOrEmpty(lbBuyerCredit.Text))
                        {
                            imgcredit.ImageUrl    = "Images/credit/" + lbBuyerCredit.Text.Trim() + ".png";
                            lbBuyerCredit.Visible = false;
                        }
                        else
                        {
                            lbBuyerCredit.Visible = true;
                            imgcredit.Visible     = false;
                        }

                        lbisRefund.Text = tbBuyerBaseInfo.Rows[0]["hasRefund"].ToString();
                        if (lbisRefund.Text.Equals("是"))
                        {
                            lbisRefund.ForeColor = Color.Red;
                        }
                        lbRealName.Text  = tbBuyerBaseInfo.Rows[0]["buyer_reallName"].ToString();
                        lbCellPhone.Text = tbBuyerBaseInfo.Rows[0]["cellPhone"].ToString();
                        lbQQ.Text        = tbBuyerBaseInfo.Rows[0]["qq"].ToString();
                        lbPhone.Text     = tbBuyerBaseInfo.Rows[0]["Phone"].ToString();
                        lbAddress.Text   = tbBuyerBaseInfo.Rows[0]["address"].ToString();
                        lbZipCode.Text   = tbBuyerBaseInfo.Rows[0]["zipCode"].ToString();
                        lbBirthDay.Text  = tbBuyerBaseInfo.Rows[0]["birthDay"].ToString();
                        lbmemo.Text      = tbBuyerBaseInfo.Rows[0]["memo"].ToString();
                    }
                }
            }
        }
Example #9
0
        /// <summary>
        /// 初始化卖家的买家系统分组;另外功能还需要提供卖家自定义分组。
        /// </summary>
        private void InitGroup(string strNick)
        {
            //同步系统分组功能
            Group obj = new Group();

            obj.Group_name = "新客户";
            obj.SellerNick = strNick;
            obj.Memo       = "";
            obj.OpenStatus = true;
            //如果添加分组成功
            if (!BuyerBLL.CheckGroupIsExit(strNick, "新客户"))
            {
                //BuyerBLL.AddBuyerGroup(obj);
                BuyerBLL.AddGroup(obj);
            }

            Group obj2 = new Group();

            obj2.Group_name = "老客户";
            obj2.SellerNick = strNick;
            obj2.Memo       = "";
            obj2.OpenStatus = true;
            //如果添加分组成功
            if (!BuyerBLL.CheckGroupIsExit(strNick, "老客户"))
            {
                BuyerBLL.AddGroup(obj2);
            }

            Group obj3 = new Group();

            obj3.Group_name = "休眠3个月";
            obj3.SellerNick = strNick;
            obj3.Memo       = "";
            obj3.OpenStatus = true;
            //如果添加分组成功
            if (!BuyerBLL.CheckGroupIsExit(strNick, "休眠3个月"))
            {
                BuyerBLL.AddGroup(obj3);
            }

            Group obj5 = new Group();

            obj5.Group_name = "潜在客户";
            obj5.SellerNick = strNick;
            obj5.Memo       = "";
            obj5.OpenStatus = true;
            //如果添加分组成功
            if (!BuyerBLL.CheckGroupIsExit(strNick, "潜在客户"))
            {
                BuyerBLL.AddGroup(obj5);
            }
        }
Example #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         DataTable tb = BuyerBLL.GetGroupByID(Users.Nick);
         drpGroup.DataSource     = tb;
         drpGroup.DataTextField  = "group_name";
         drpGroup.DataValueField = "group_name";
         drpGroup.DataBind();
         drpGroup.Items.Insert(0, "全部");
         //BindData();
         this.grdBuyer.DataSource = null;
         this.grdBuyer.DataBind();
     }
 }
Example #11
0
        private void FillBuyer()
        {
            string   ocode     = ((SessionUser)Session["SessionUser"]).OCode;
            BuyerBLL _BuyerBll = new BuyerBLL();
            List <Com_Buyer_Setup> _buyerlist = _BuyerBll.GetBuyerName(ocode);

            if (_buyerlist.Count > 0)
            {
                ddlBuyerName.DataSource     = _buyerlist.ToList();
                ddlBuyerName.DataTextField  = "Buyer_Name";
                ddlBuyerName.DataValueField = "Buyer_ID";
                ddlBuyerName.DataBind();
                ddlBuyerName.Items.Insert(0, new ListItem("---Select One---"));
            }
        }
Example #12
0
        private void FillLCNoandOEntry()
        {
            BuyerBLL _BuyerBll = new BuyerBLL();
            string   BuyerType = ddlBuyerType.SelectedValue.ToString();
            List <Com_Buyer_Setup> _buyerlist = _BuyerBll.GetBuyerByType(BuyerType);

            if (_buyerlist.Count > 0)
            {
                ddlBuyerName.DataSource     = _buyerlist.ToList();
                ddlBuyerName.DataTextField  = "Buyer_Name";
                ddlBuyerName.DataValueField = "Buyer_ID";
                ddlBuyerName.DataBind();
                ddlBuyerName.Items.Insert(0, new ListItem("---Select One---"));
            }
        }
Example #13
0
        protected void imgSubmit_Click(object sender, ImageClickEventArgs e)
        {
            //判断输入格式
            if (!String.IsNullOrEmpty(txtCellphone.Text.Trim()) && !Utility.IsCellPhone(txtCellphone.Text.Trim()))
            {
                lbCellPhoneError.Text = "手机号码格式不正确!";
                return;
            }
            if (!String.IsNullOrEmpty(txtPhone.Text.Trim()) && !Utility.IsPhone(txtPhone.Text.Trim()))
            {
                lbPhoneError.Text = "座机号码格式不正确!";
                return;
            }
            if (!String.IsNullOrEmpty(txtQQ.Text.Trim()) && !Utility.IsNumeric(txtQQ.Text.Trim()))
            {
                lbQQError.Text = "QQ号码应该都是数字!";
                return;
            }
            if (!String.IsNullOrEmpty(txtEmail.Text.Trim()) && !Utility.IsEmail(txtEmail.Text.Trim()))
            {
                lbQQError.Text = "Email格式不正确!";
                return;
            }
            if (!String.IsNullOrEmpty(txtZIPCode.Text.Trim()) && !Utility.IsZIPCode(txtZIPCode.Text.Trim()))
            {
                lbZIPError.Text = "邮编格式不正确!";
                return;
            }
            Buyers objBuyer = new Buyers();

            objBuyer.SELLER_ID       = Users.Nick;
            objBuyer.BuyerId         = Convert.ToInt64(Request.QueryString["buyer_id"].ToString());
            objBuyer.Buyer_reallName = txtRealName.Text.Trim();
            objBuyer.CellPhone       = txtCellphone.Text.Trim();
            objBuyer.Phone           = txtPhone.Text.Trim();
            objBuyer.QQ       = txtQQ.Text.Trim();
            objBuyer.birthDay = dateBirthDay.Value.ToString();
            objBuyer.Email    = txtEmail.Text.Trim();
            objBuyer.ZipCode  = txtZIPCode.Text.Trim();
            objBuyer.Address  = txtAddress.Text.Trim();
            objBuyer.Memo     = txtMemo.Text.Trim();
            if (BuyerBLL.UpdateBuyerDetails(objBuyer))
            {
                InitControls();
                lbMsg.Text      = "会员信息修改成功!";
                lbMsg.ForeColor = Color.Blue;
            }
        }
Example #14
0
 protected void gv_seller_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         string nick  = e.Row.Cells[0].Text;
         string count = BuyerBLL.GetBuyerCount("1", nick);
         if (string.IsNullOrEmpty(count))
         {
             count = "0";
         }
         e.Row.Cells[3].Text = count;
         e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#999999'");
         e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
         ((LinkButton)e.Row.Cells[3].FindControl("lbt_qBuerys")).CommandName = e.Row.Cells[0].Text;
     }
 }
Example #15
0
        protected void Button10_Click(object sender, EventArgs e)
        {
            string sellerNick = TextBox2.Text.Trim();
            string session    = txtSession.Text.Trim();

            DateTime startTradeDate = Convert.ToDateTime(DateTime.Now.AddMonths(-3).ToShortDateString());
            DateTime endTradeDate   = Convert.ToDateTime(DateTime.Now.ToShortDateString());

            if (BuyerBLL.SynicOldTrade(session, startTradeDate, endTradeDate, sellerNick))
            {
                if (SellersBLL.SetSyncTradeFlag(sellerNick, 1))
                {
                    lbError.Text      = "订单同步完成!";
                    lbError.ForeColor = Color.Blue;
                }
            }
        }
Example #16
0
        //读取会员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 = "会员同步完成,但出现异常,详情请看日志!";
            }
        }
Example #17
0
        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);
                }
            }
        }
Example #18
0
        private void searchBuyers()
        {
            string buyerNick    = txtNickName.Text.Trim();
            string status       = drpStatus.SelectedValue.ToString();
            string area         = drpArea.SelectedValue.ToString();
            string grade        = drpGrade.SelectedValue.ToString();
            string tradeAmount1 = txtMin.Text.Trim();
            string tradeAmount2 = txtMax.Text.Trim();
            string buyCount     = txtBuyCount.Text.Trim();

            if (!String.IsNullOrEmpty(Request.QueryString["type"]) && drpGroup.SelectedValue.Equals("全部"))
            {
                if (Request.QueryString["type"].ToString().Equals("newCus") && string.IsNullOrEmpty(ViewState["flag"] as string))
                {
                    drpGroup.SelectedValue = "新客户";
                }
            }
            if (!String.IsNullOrEmpty(Request.QueryString["type"]) && drpGroup.SelectedValue.Equals("全部"))
            {
                if (Request.QueryString["type"].ToString().Equals("oldCus") && string.IsNullOrEmpty(ViewState["flag"] as string))
                {
                    drpGroup.SelectedValue = "老客户";
                }
            }
            string group = drpGroup.SelectedItem.Text.ToString();

            DataTable ds = BuyerBLL.GetBuyerInfo(buyerNick, status, area, grade, group, tradeAmount1, tradeAmount2, Users.Nick, buyCount);

            AspNetPager1.RecordCount = ds.DefaultView.Count;

            this.AspNetPager1.CustomInfoHTML = string.Format("当前第{0}/{1}页 共{2}条记录 每页{3}条", new object[] { this.AspNetPager1.CurrentPageIndex, this.AspNetPager1.PageCount, this.AspNetPager1.RecordCount, this.AspNetPager1.PageSize });

            PagedDataSource pds = new PagedDataSource();

            pds.DataSource       = ds.DefaultView;
            pds.AllowPaging      = true;
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            pds.PageSize         = AspNetPager1.PageSize;

            //根据分页情况将数据写入或者更新到数据库
            this.grdBuyer.DataSource = pds;
            this.grdBuyer.DataBind();
        }
Example #19
0
        //protected void SubmitRegistrationBtn_Click(object sender, EventArgs e)
        //{



        //    Random random = new Random();
        //    int generator = random.Next(10000, 99999);

        //    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MYDBConnection"].ConnectionString);
        //    conn.Open();
        //    string sql = "INSERT INTO Accounts (AccountID, userName, password, fullName, mobile, email, address, accType) VALUES ('" + generator + "','" + userNameRegistration.Text + "','" + passwordRegistration.Text + "','" + inputFullName.Text + "','" + inputMobile.Text + "','" + inputEmail.Text + "','" + inputAddress.Text + "','" + accTypeRegistration.Text + "')";
        //    SqlCommand cmd = new SqlCommand(sql, conn);

        //    string sql1 = "INSERT INTO BuyerFinPlan (AccountID, loanServicingPeriod, userCpfToService ) VALUES ('" + generator + "', 5, 'n')";
        //    SqlCommand cmd1 = new SqlCommand(sql1, conn);

        //    cmd.ExecuteNonQuery();
        //    if (accTypeRegistration.Text == "Buyer")
        //    {
        //        cmd1.ExecuteNonQuery();
        //    }
        //    ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('User Registered');window.location='Login.aspx';", true);
        //}


        protected void SubmitRegistrationBtn_Click(object sender, EventArgs e)
        {
            if (userNameRegistration.Text.Length != 0 && passwordRegistration.Text.Length != 0)
            {
                Random random = new Random();
                int    accId  = random.Next(10000, 99999);

                string uName       = userNameRegistration.Text.Trim();
                string pwd         = passwordRegistration.Text.Trim();
                string fullNm      = inputFullName.Text.Trim();
                string mobileNo    = inputMobile.Text.Trim();
                string emailAdd    = inputEmail.Text.Trim();
                string add         = inputAddress.Text.Trim();
                string accountType = accTypeRegistration.Text.Trim();


                int    loanServicePeriod = 5;
                string useCpf            = "n";

                AccountsBLL user  = new AccountsBLL();
                BuyerBLL    buyer = new BuyerBLL();
                if (user.createUser(accId, uName, pwd, fullNm, mobileNo, emailAdd, add, accountType) == true)
                {
                    if (accountType == "Buyer")
                    {
                        buyer.createFinPlan(accId, loanServicePeriod, useCpf);
                        ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('User Registered');window.location='Login.aspx';", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('User Registered');window.location='Login.aspx';", true);
                    }
                }
                else
                {
                }
            }
            else
            {
                Response.Write("<script>alert('Please enter valid Username and Password')</script>");
            }
        }
Example #20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         ControlStatus(false);
         CTCRM.Entity.Grade o = new CTCRM.Entity.Grade();
         o.SellerNick = Users.Nick;
         DataTable tb = BuyerBLL.GetGradeByID(o);
         if (tb != null && tb.Rows.Count > 0)
         {
             txtMin1.Text = tb.Rows[0]["tradeAmontFrom"].ToString();
             txtMax1.Text = tb.Rows[0]["tradeAmountTo"].ToString();
             txtMin2.Text = tb.Rows[1]["tradeAmontFrom"].ToString();
             txtMax2.Text = tb.Rows[1]["tradeAmountTo"].ToString();
             txtMin3.Text = tb.Rows[2]["tradeAmontFrom"].ToString();
             txtMax3.Text = tb.Rows[2]["tradeAmountTo"].ToString();
             txtMin4.Text = tb.Rows[3]["tradeAmontFrom"].ToString();
             txtMax4.Text = tb.Rows[3]["tradeAmountTo"].ToString();
         }
     }
 }
Example #21
0
 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);
 }
Example #22
0
        protected void BindData()
        {
            string buyerNick      = txtNickName.Text.Trim();
            string lastTradeDate1 = datePicker.Value.Trim();
            string lastTradeDate2 = datePickerEnd.Value.Trim();
            string grade          = drpGrade.SelectedValue.ToString();
            string num1           = txtNum1.Text.Trim();
            string num2           = txtNum2.Text.Trim();
            string area           = drpArea.SelectedValue.ToString();
            string tradeAmount1   = txtTradAmount1.Text.Trim();
            string tradeAmount2   = txtTradAmount2.Text.Trim();
            string tradePinNv     = drpTradePinNv.SelectedValue.ToString();
            string buyCount       = txtBuyCount.Text.Trim();
            string drpDay         = "";

            if (cbDays.Checked)
            {
                drpDay = drpSendDays.SelectedValue.ToString();
            }

            DataTable ds = BuyerBLL.GetBuyerInfoToMsg(buyerNick, lastTradeDate1, lastTradeDate2, grade, num1, num2,
                                                      area, tradeAmount1, tradeAmount2, Users.Nick, drpDay, tradePinNv, buyCount);

            Session["MsgData"] = ds;
            if (ds != null && ds.Rows.Count > 10000)
            {
                string msgC = "亲~本次群发会员数为:" + ds.Rows.Count.ToString() + " 个,注意检查短信账户余额!由于数据过大,会员数据不会显示在下面的列表中,请直接群发!";
                lbMsgTip.Text = msgC;
            }
            else
            {
                if (ds != null && ds.Rows.Count > 0)
                {
                    string msgC = "亲~能发送短信的有效客户数有:" + ds.Rows.Count.ToString() + " 个,注意检查短信账户余额是否足够,以及是否已经同步了店铺所有会员信息!";
                    lbMsgTip.Text = msgC;
                }
            }
        }
Example #23
0
        protected void imgSubmit_Click(object sender, ImageClickEventArgs e)
        {
            //判断输入格式
            if (!String.IsNullOrEmpty(txtCellphone.Text.Trim()) && !Utility.IsCellPhone(txtCellphone.Text.Trim()))
            {
                lbCellPhoneError.Text = "手机号码格式不正确!";
                return;
            }
            if (string.IsNullOrEmpty(txtCellphone.Text.Trim()))
            {
                lbCellPhoneError.Text = "手机号码不能为空!";
                return;
            }

            if (!String.IsNullOrEmpty(txtPhone.Text.Trim()) && !Utility.IsPhone(txtPhone.Text.Trim()))
            {
                lbPhoneError.Text = "座机号码格式不正确!";
                return;
            }
            if (!String.IsNullOrEmpty(txtQQ.Text.Trim()) && !Utility.IsNumeric(txtQQ.Text.Trim()))
            {
                lbQQError.Text = "QQ号码应该都是数字!";
                return;
            }
            if (!String.IsNullOrEmpty(txtEmail.Text.Trim()) && !Utility.IsEmail(txtEmail.Text.Trim()))
            {
                lbQQError.Text = "Email格式不正确!";
                return;
            }
            if (!String.IsNullOrEmpty(txtZIPCode.Text.Trim()) && !Utility.IsZIPCode(txtZIPCode.Text.Trim()))
            {
                lbZIPError.Text = "邮编格式不正确!";
                return;
            }

            //相同手机号码只能添加一次
            if (BuyerBLL.CheckTheSameHPNoIsExit(Users.Nick, txtCellphone.Text.Trim()))
            {
                lbMsg.Text      = "手机号码重复,系统已经存在该号码!";
                lbMsg.ForeColor = Color.Red;
                txtCellphone.Focus();
                return;
            }

            Buyers objBuyer = new Buyers();
            long   tick     = DateTime.Now.Ticks;
            Random ran      = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32));

            objBuyer.BuyerId         = Convert.ToInt64(ran.Next().ToString());
            objBuyer.SELLER_ID       = Users.Nick;
            objBuyer.BuyerNick       = txtNick.Text.Trim();
            objBuyer.Buyer_reallName = txtRealName.Text.Trim();
            objBuyer.CellPhone       = txtCellphone.Text.Trim();
            objBuyer.Phone           = txtPhone.Text.Trim();
            objBuyer.QQ            = txtQQ.Text.Trim();
            objBuyer.MSN           = txtMSN.Text.Trim();
            objBuyer.ZipCode       = txtZIPCode.Text.Trim();
            objBuyer.Email         = txtEmail.Text.Trim();
            objBuyer.SinaWeibo     = txtsinaWeibo.Text.Trim();
            objBuyer.QQWeibo       = txtQQWeibo.Text.Trim();
            objBuyer.BuyerProvince = drpArea.SelectedValue.ToString();
            objBuyer.City          = txtCity.Text.Trim();
            objBuyer.birthDay      = datebirthday.Value.ToString();
            objBuyer.BuyerType     = "2";
            try
            {
                if (BuyerBLL.AddBuyerBySeller(objBuyer))
                {
                    lbMsg.Text      = "会员信息添加成功!";
                    lbMsg.ForeColor = Color.Blue;
                    txtCellphone.Focus();
                    txtCellphone.Text = "";
                }
            }
            catch (Exception ex)
            {
                lbMsg.Text = "添加会员失败!";
                ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI);
            }
        }
Example #24
0
        protected void Button9_Click(object sender, EventArgs e)
        {
            string nick = TextBox3.Text.Trim();

            Label11.Text = "店铺有效会员总数为:" + BuyerBLL.GetOldBuyerCount("0", nick) + "个";
        }
Example #25
0
        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;
        }
Example #26
0
        protected void imgModify_Click(object sender, ImageClickEventArgs e)
        {
            if (String.IsNullOrEmpty(txtMin1.Text.Trim()))
            {
                lbError1.Text = "金额不能为空!";
                lbMsg.Text    = "";
                return;
            }
            if (!Utility.IsPositiveINT(txtMin1.Text.Trim()))
            {
                lbError1.Text = "金额必须为整数!";
                lbMsg.Text    = "";
                return;
            }

            if (String.IsNullOrEmpty(txtMax1.Text.Trim()))
            {
                lbError1.Text = "金额不能为空!";
                lbMsg.Text    = "";
                return;
            }
            if (!Utility.IsPositiveINT(txtMax1.Text.Trim()))
            {
                lbError1.Text = "金额必须为整数!";
                lbMsg.Text    = "";
                return;
            }


            if (String.IsNullOrEmpty(txtMin2.Text.Trim()))
            {
                lbError2.Text = "金额不能为空!";
                lbMsg.Text    = "";
                return;
            }
            if (!Utility.IsPositiveINT(txtMin2.Text.Trim()))
            {
                lbError2.Text = "金额必须为整数!";
                lbMsg.Text    = "";
                return;
            }

            if (String.IsNullOrEmpty(txtMax2.Text.Trim()))
            {
                lbError2.Text = "金额不能为空!";
                lbMsg.Text    = "";
                return;
            }
            if (!Utility.IsPositiveINT(txtMax2.Text.Trim()))
            {
                lbError2.Text = "金额必须为整数!";
                lbMsg.Text    = "";
                return;
            }

            if (String.IsNullOrEmpty(txtMin2.Text.Trim()))
            {
                lbError2.Text = "金额不能为空!";
                lbMsg.Text    = "";
                return;
            }
            if (!Utility.IsPositiveINT(txtMin2.Text.Trim()))
            {
                lbError2.Text = "金额必须为整数!";
                lbMsg.Text    = "";
                return;
            }

            if (String.IsNullOrEmpty(txtMax2.Text.Trim()))
            {
                lbError2.Text = "金额不能为空!";
                lbMsg.Text    = "";
                return;
            }
            if (!Utility.IsPositiveINT(txtMax2.Text.Trim()))
            {
                lbError2.Text = "金额必须为整数!";
                lbMsg.Text    = "";
                return;
            }

            if (String.IsNullOrEmpty(txtMin3.Text.Trim()))
            {
                lbError3.Text = "金额不能为空!";
                lbMsg.Text    = "";
                lbMsg.Text    = "";
                return;
            }
            if (!Utility.IsPositiveINT(txtMin3.Text.Trim()))
            {
                lbError3.Text = "金额必须为整数!";
                lbMsg.Text    = "";
                return;
            }

            if (String.IsNullOrEmpty(txtMax3.Text.Trim()))
            {
                lbError3.Text = "金额不能为空!";
                lbMsg.Text    = "";
                return;
            }
            if (!Utility.IsPositiveINT(txtMax3.Text.Trim()))
            {
                lbError3.Text = "金额必须为整数!";
                lbMsg.Text    = "";
                return;
            }

            if (String.IsNullOrEmpty(txtMin4.Text.Trim()))
            {
                lbError4.Text = "金额不能为空!";
                lbMsg.Text    = "";
                return;
            }
            if (!Utility.IsPositiveINT(txtMin4.Text.Trim()))
            {
                lbError4.Text = "金额必须为整数!";
                lbMsg.Text    = "";
                return;
            }

            if (String.IsNullOrEmpty(txtMax4.Text.Trim()))
            {
                lbError4.Text = "金额不能为空!";
                lbMsg.Text    = "";
                return;
            }
            if (!Utility.IsPositiveINT(txtMax4.Text.Trim()))
            {
                lbError4.Text = "金额必须为整数!";
                lbMsg.Text    = "";
                return;
            }
            try
            {
                ControlStatus(true);
                CTCRM.Entity.Grade o = new CTCRM.Entity.Grade();
                o.SellerNick = Users.Nick;
                DataTable tb        = BuyerBLL.GetGradeByID(o);
                bool      showLbMsg = true;
                if (tb != null && tb.Rows.Count > 0)
                {
                    o.Id             = Convert.ToInt32(tb.Rows[0]["id"].ToString());
                    o.TradeAmontFrom = Convert.ToInt32(txtMin1.Text.Trim().ToString());
                    o.TradeAmountTo  = Convert.ToInt32(txtMax1.Text.Trim().ToString());
                    BuyerBLL.UpdateGrade(o);
                    o.Id             = Convert.ToInt32(tb.Rows[1]["id"].ToString());
                    o.TradeAmontFrom = Convert.ToInt32(txtMin2.Text.Trim().ToString());
                    o.TradeAmountTo  = Convert.ToInt32(txtMax2.Text.Trim().ToString());
                    BuyerBLL.UpdateGrade(o);
                    o.Id             = Convert.ToInt32(tb.Rows[2]["id"].ToString());
                    o.TradeAmontFrom = Convert.ToInt32(txtMin3.Text.Trim().ToString());
                    o.TradeAmountTo  = Convert.ToInt32(txtMax3.Text.Trim().ToString());
                    BuyerBLL.UpdateGrade(o);
                    o.Id             = Convert.ToInt32(tb.Rows[3]["id"].ToString());
                    o.TradeAmontFrom = Convert.ToInt32(txtMin4.Text.Trim().ToString());
                    o.TradeAmountTo  = Convert.ToInt32(txtMax4.Text.Trim().ToString());
                    BuyerBLL.UpdateGrade(o);
                    //控制更新提示标签的状态
                    if (Convert.ToInt32(tb.Rows[0]["tradeAmontFrom"].ToString()) == Convert.ToInt32(txtMin1.Text.Trim().ToString()) &&
                        Convert.ToInt32(tb.Rows[0]["tradeAmountTo"].ToString()) == Convert.ToInt32(txtMax1.Text.Trim().ToString()) &&
                        Convert.ToInt32(tb.Rows[1]["tradeAmontFrom"].ToString()) == Convert.ToInt32(txtMin2.Text.Trim().ToString()) &&
                        Convert.ToInt32(tb.Rows[1]["tradeAmountTo"].ToString()) == Convert.ToInt32(txtMax2.Text.Trim().ToString()) &&
                        Convert.ToInt32(tb.Rows[2]["tradeAmontFrom"].ToString()) == Convert.ToInt32(txtMin3.Text.Trim().ToString()) &&
                        Convert.ToInt32(tb.Rows[2]["tradeAmountTo"].ToString()) == Convert.ToInt32(txtMax3.Text.Trim().ToString()) &&
                        Convert.ToInt32(tb.Rows[3]["tradeAmontFrom"].ToString()) == Convert.ToInt32(txtMin4.Text.Trim().ToString()) &&
                        Convert.ToInt32(tb.Rows[3]["tradeAmountTo"].ToString()) == Convert.ToInt32(txtMax4.Text.Trim().ToString())
                        )
                    {
                        showLbMsg = false;
                    }
                }
                if (showLbMsg)
                {
                    lbMsg.Text = "会员级别调整成功!";
                }
                lbMsg.ForeColor = Color.Blue;
                // ControlStatus(false);
                //更新成功后,同步会员的级别
                DataTable tbBuyer = BuyerBLL.GetBuyerInfoBySellerNick(Users.Nick);
                if (tbBuyer != null && tbBuyer.Rows.Count > 0)
                {
                    for (int i = 0; i < tbBuyer.Rows.Count; i++)
                    {
                        var    tradeAmount = tbBuyer.Rows[i]["trade_amount"].ToString();
                        Buyers obj         = new Buyers();
                        obj.BuyerId   = Convert.ToInt64(tbBuyer.Rows[i]["buyer_id"].ToString());
                        obj.SELLER_ID = Users.Nick;
                        if (Convert.ToDecimal(tradeAmount) > Convert.ToInt32(txtMin1.Text.Trim().ToString()) && Convert.ToDecimal(tradeAmount) <= Convert.ToInt32(txtMax1.Text.Trim().ToString()))
                        {
                            obj.Grade = 1;
                        }
                        if (Convert.ToDecimal(tradeAmount) > Convert.ToInt32(txtMin2.Text.Trim().ToString()) && Convert.ToDecimal(tradeAmount) <= Convert.ToInt32(txtMax2.Text.Trim().ToString()))
                        {
                            obj.Grade = 2;
                        }
                        if (Convert.ToDecimal(tradeAmount) > Convert.ToInt32(txtMin3.Text.Trim().ToString()) && Convert.ToDecimal(tradeAmount) <= Convert.ToInt32(txtMax3.Text.Trim().ToString()))
                        {
                            obj.Grade = 3;
                        }
                        if (Convert.ToDecimal(tradeAmount) > Convert.ToInt32(txtMin4.Text.Trim().ToString()) && Convert.ToDecimal(tradeAmount) <= Convert.ToInt32(txtMax4.Text.Trim().ToString()))
                        {
                            obj.Grade = 4;
                        }
                        BuyerBLL.UpdateGrade(obj);
                    }
                }
            }
            catch (Exception ex)
            {
                lbMsg.Text      = "会员级别调整失败!";
                lbMsg.ForeColor = Color.Red;
                ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI);
            }
        }
Example #27
0
        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;
            }
        }
Example #28
0
        void getMember(HttpContext context)
        {
            string buyerNick      = context.Request.Form["nick"];
            string lastTradeDate1 = context.Request.Form["tradeStartTime"];
            string lastTradeDate2 = context.Request.Form["tradeEndTime"];
            string grade          = context.Request.Form["level"];
            string num1           = context.Request.Form["txt_good_count01"];
            string num2           = context.Request.Form["txt_good_count02"];
            string area           = context.Request.Form["area"];
            string tradeAmount1   = context.Request.Form["money01"];
            string tradeAmount2   = context.Request.Form["money02"];
            string tradePinNv     = context.Request.Form["interval"];
            string buyCount       = context.Request.Form["count"];
            string day            = context.Request.Form["day"];
            //bool comment = context.Request.Form["comment"];
            string blaklist = context.Request.Form["blacklist"];

            DataTable dtBlackList = new DataTable();

            if (blaklist.ToLower() == "true")
            {
                dtBlackList = BlcakLstBLL.GetBlaklist(Users.Nick);
            }
            string    drpDay = "";
            DataTable ds     = BuyerBLL.GetBuyerInfoToMsg(buyerNick, lastTradeDate1, lastTradeDate2, grade, num1, num2,
                                                          area, tradeAmount1, tradeAmount2, Users.Nick, drpDay, tradePinNv, buyCount);

            if (ds != null && ds.Rows.Count > 0)
            {
                string json_obj = "{'members':[";
                for (int i = 0; i < ds.Rows.Count; i++)
                {
                    if (dtBlackList != null && dtBlackList.Rows.Count > 0)
                    {
                        DataRow[] dr = dtBlackList.Select("blakName='" + ds.Rows[i]["buyer_nick"] + "'");
                        if (dr.Length > 0 && dr != null)
                        {
                            continue;
                        }
                    }
                    json_obj += "{";
                    json_obj += "'nick':'" + Convert.ToString(ds.Rows[i]["buyer_nick"]) + "',";
                    json_obj += "'phone':'" + Convert.ToString(ds.Rows[i]["cellPhone"]) + "',";
                    json_obj += "'tradeTime':'" + Convert.ToString(ds.Rows[i]["last_trade_time"]) + "',";
                    json_obj += "'tradeAmount':'" + Convert.ToString(ds.Rows[i]["trade_amount"]) + "',";
                    json_obj += "'groupId':'" + Convert.ToString(ds.Rows[i]["group_id"]) + "'";
                    json_obj += "}";
                    if (i != ds.Rows.Count)
                    {
                        json_obj += ",";
                    }
                }
                json_obj += "],'ret':'0'}";
                context.Response.Write(json_obj);
                //context.Response.End();
            }
            else
            {
                //lb_memberNum.Text = "0个会员";
                context.Response.Write("{'ret':'1'}");
            }
        }
        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>");
        }
Example #30
0
        protected void imgbtnExport_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                //高级版以上用户才可以设置
                //SellersBLL.CheckSellerIsExit(Users.Nick)
                int status = BuyerexportBLL.CheckEndStatus(sellerId);
                //申请成功,开始导出
                if (status == 2)
                {
                    //获取导出语句
                    string sql = BuyerexportBLL.GetExportSql(Users.Nick.ToString());
                    //通过SQL获取数据
                    DataTable tb = null;
                    tb = BuyerBLL.GetExportBuyers(sql, 0);
                    try
                    {
                        ExceptionManager exceptionManager = new ExceptionManager();
                        exceptionManager.WriteFileLog("导出", tb.Rows.Count.ToString(), tb.Rows.Count.ToString());
                        if (tb != null && tb.Rows.Count > 0)
                        {
                            DownloadToExcel(tb);
                        }
                        else
                        {
                            Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script type='text/javascript' defer=defer>alert('没有要下载的会员数据!');</script>");
                        }
                        BuyerexportBLL.UpdateExport(sellerId, 0);
                    }
                    catch (Exception ee)
                    {
                        BuyerexportBLL.UpdateExport(sellerId, 0);
                        ExceptionManager exceptionManager = new ExceptionManager();
                        exceptionManager.WriteFileLog("导出错误", ee.Message, ee.Message);
                    }
                    //导出成功,将状态设为结束
                    BuyerexportBLL.UpdateExport(sellerId, 0);
                }
                else if (status == 1)//申请中
                {
                }
                else if (status == 0)//开始申请,生成导出资料的语句
                {
                    //提交申请
                    int i = BuyerexportBLL.InsertExport(sellerId, Users.Nick);
                    if (i <= 0)
                    {
                        ExceptionReporter.WriteLog(new Exception("向Buyer_export表插入数据失败!"), ExceptionPostion.TBApply_Web_UI);
                    }
                    #region 生成导出资料的语句
                    if (sources.SelectedValue == "全部")//全部会员资料导出语句
                    {
                        string query = @"select buyer_nick,ISNULL(buyer_reallName,'unknown') AS buyer_reallName,cellPhone,case grade when 0 then '潜在会员'
                                when 1 then '普通会员' when 2 then '高级会员' when 3 then 'VIP会员' when 4 then '至尊VIP会员' end as grade,
                                province,trade_amount,item_num, CONVERT(varchar(100),last_trade_time, 23) as last_trade_time,address, birthDay
                                from Buyer_" + sellerId + " where SELLER_ID = '" + Users.Nick.ToString() + "'";
                        int    count = BuyerexportBLL.InsertBuyer_ExportSql(Users.Nick.ToString(), query);
                        if (count <= 0)
                        {
                            ExceptionReporter.WriteLog(new Exception("插入全部资料的语句失败!"), ExceptionPostion.TBApply_Web_UI);
                        }
                    }
                    else
                    {
                        //部分会员资料导出语句
                        #region
                        //tb = BuyerBLL.GetExportBuyers(Users.Nick, datePicker.Value, datePickerEnd.Value, drpArea.SelectedValue, txtTradeAmountFrom.Text.Trim(), txtTradeAmountTo.Text.Trim());
                        string query = @"select buyer_nick,ISNULL(buyer_reallName,'unknown') AS buyer_reallName,cellPhone,case grade when 0 then '潜在会员'
                                when 1 then '普通会员' when 2 then '高级会员' when 3 then 'VIP会员' when 4 then '至尊VIP会员' end as grade,
                                province,trade_amount,item_num, CONVERT(varchar(100),last_trade_time, 23) as last_trade_time,address, birthDay
                                from Buyer_" + sellerId + " where SELLER_ID = '" + Users.Nick.ToString() + "' ";

                        if (!string.IsNullOrEmpty(datePicker.Value.ToString()))
                        {
                            query += " AND last_trade_time >= '" + datePicker.Value.ToString() + "'";
                        }
                        if (!string.IsNullOrEmpty(datePickerEnd.Value.ToString()))
                        {
                            query += " AND last_trade_time <=  '" + datePickerEnd.Value.ToString() + "'";
                        }
                        if (!drpArea.SelectedValue.Equals("all"))
                        {
                            query += " AND province like '" + drpArea.SelectedValue + "%'";
                        }
                        if (!string.IsNullOrEmpty(txtTradeAmountFrom.Text.Trim()))
                        {
                            query += " AND trade_amount >=  " + txtTradeAmountFrom.Text.Trim();
                        }
                        if (!string.IsNullOrEmpty(txtTradeAmountTo.Text.Trim()))
                        {
                            query += " AND trade_amount <=  " + txtTradeAmountTo.Text.Trim();
                        }
                        if (!drpMember.SelectedValue.Equals("all"))
                        {
                            query += " AND grade =" + drpMember.SelectedValue;
                        }
                        if (!string.IsNullOrEmpty(jiaoyiStart.Text.Trim()))
                        {
                            query += " AND trade_count >=  " + jiaoyiStart.Text.Trim();
                        }
                        if (!string.IsNullOrEmpty(jiaoyiEnd.Text.Trim()))
                        {
                            query += " AND trade_count <=  " + jiaoyiEnd.Text.Trim();
                        }
                        if (!string.IsNullOrEmpty(countStart.Text.Trim()))
                        {
                            query += " AND item_num >=  " + countStart.Text.Trim();
                        }
                        if (!string.IsNullOrEmpty(countEnd.Text.Trim()))
                        {
                            query += " AND item_num <=  " + countEnd.Text.Trim();
                        }
                        query += " order by last_trade_time desc";
                        #endregion

                        int count = BuyerexportBLL.InsertBuyer_ExportSql(Users.Nick.ToString(), query);
                        if (count <= 0)
                        {
                            ExceptionReporter.WriteLog(new Exception("插入部分资料的语句失败!"), ExceptionPostion.TBApply_Web_UI);
                        }
                    }
                    #endregion
                }

                ReSet();
            }
            catch (Exception ex)
            {
                ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI);
                ReSet();
            }
        }