Exemplo n.º 1
0
        /// <summary>
        /// 刷新
        /// </summary>
        public void ReSet()
        {
            try
            {
                //检查卖家最后一次申请状态
                int status = BuyerexportBLL.CheckEndStatus(Users.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)
                {
                    imgbtnExport.ImageUrl     = "~/Win_Image/export.png";
                    ImageButtonCancle.Visible = false;
                }

                DataTable dt = BuyerexportBLL.GetBuyerExportAll(Users.SellerId);
                GridView_Jilv.DataSource = dt;
                GridView_Jilv.DataBind();
            }
            catch (Exception ex)
            {
                ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI);
            }
        }
Exemplo n.º 2
0
        protected void ImageButtonCancle_Click(object sender, ImageClickEventArgs e)
        {
            int status = BuyerexportBLL.CheckEndStatus(sellerId);

            if (status == 2 || status == 1)
            {
                int count = BuyerexportBLL.UpdateExport(sellerId, 0);
                if (count <= 0)
                {
                    ExceptionReporter.WriteLog(new Exception("更新Buyer_export表失败!"), ExceptionPostion.TBApply_Web_UI);
                }
            }

            ReSet();
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
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();
            }
        }