예제 #1
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            //DataTable tb = MsgBLL.GetSellerMsgSendHis(txtTitle.Text.Trim(), txt_StartTime.Value, txt_EndTime.Value, drpSendType.SelectedValue,"",txtPhone.Text.Trim(),"");
            int hours1 = 0;
            int min1   = 0;
            int sec1   = 0;
            int hours2 = 0;
            int min2   = 0;
            int sec2   = 0;

            try
            {
                hours1 = string.IsNullOrEmpty(tbHours1.Text.Trim()) ? 0 : Convert.ToInt32(tbHours1.Text.Trim());
                min1   = string.IsNullOrEmpty(tbMin1.Text.Trim()) ? 0 : Convert.ToInt32(tbMin1.Text.Trim());
                sec1   = string.IsNullOrEmpty(tbSecond1.Text.Trim()) ? 0 : Convert.ToInt32(tbSecond1.Text.Trim());
                hours2 = string.IsNullOrEmpty(tbHours2.Text.Trim()) ? 0 : Convert.ToInt32(tbHours2.Text.Trim());
                min2   = string.IsNullOrEmpty(tbMin2.Text.Trim()) ? 0 : Convert.ToInt32(tbMin2.Text.Trim());
                sec2   = string.IsNullOrEmpty(tbSecond2.Text.Trim()) ? 0 : Convert.ToInt32(tbSecond2.Text.Trim());
                if (hours1 > 23 || min1 > 59 || sec1 > 59 || min2 > 59 || sec2 > 59 || hours2 > 23)
                {
                    Response.Write("<script language='javascript'>alert('请正确填写时分秒');</script>");
                    return;
                }
            }
            catch (Exception eaa)
            {
                Response.Write("<script language='javascript'>alert('请正确填写时分秒');</script>");
                return;
            }
            string startTime;

            if (string.IsNullOrEmpty(txt_StartTime.Value))
            {
                startTime = txt_StartTime.Value;
            }
            else
            {
                startTime = txt_StartTime.Value + " " + hours1 + ":" + min1 + ":" + sec1;
            }
            string endTime;

            if (string.IsNullOrEmpty(txt_EndTime.Value))
            {
                endTime = txt_EndTime.Value;
            }
            else
            {
                endTime = txt_EndTime.Value + " " + hours2 + ":" + min2 + ":" + sec2;
            }
            DataTable tb = MsgBLL.GetSellerMsgSendHis(txtTitle.Text.Trim(), startTime,
                                                      endTime, drpSendType.SelectedValue, "", txtPhone.Text.Trim(), drpStaus.SelectedValue);

            if (tb != null)
            {
                DownloadToExcel(tb);
            }
        }
예제 #2
0
 protected void gd_All_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Show")
     {
         IsAll.Value = "0";
         int    idx   = Convert.ToInt16(e.CommandArgument.ToString());
         string buyer = dtMsgCount.Rows[idx]["sellerNick"].ToString();
         Buyer.Value = buyer;
         DataTable tb = MsgBLL.GetSellerMsgSendHis(buyer, "",
                                                   "", "---全部---", "", "", "---全部---");
         grdCus.DataSource = tb;
         grdCus.DataBind();
     }
 }
예제 #3
0
        private void MsgDataBind()
        {
            int hours1 = 0;
            int min1   = 0;
            int sec1   = 0;
            int hours2 = 0;
            int min2   = 0;
            int sec2   = 0;

            try
            {
                hours1 = string.IsNullOrEmpty(tbHours1.Text.Trim())? 0: Convert.ToInt32(tbHours1.Text.Trim());
                min1   = string.IsNullOrEmpty(tbMin1.Text.Trim())? 0: Convert.ToInt32(tbMin1.Text.Trim());
                sec1   = string.IsNullOrEmpty(tbSecond1.Text.Trim())? 0: Convert.ToInt32(tbSecond1.Text.Trim());
                hours2 = string.IsNullOrEmpty(tbHours2.Text.Trim())? 0: Convert.ToInt32(tbHours2.Text.Trim());
                min2   = string.IsNullOrEmpty(tbMin2.Text.Trim())? 0: Convert.ToInt32(tbMin2.Text.Trim());
                sec2   = string.IsNullOrEmpty(tbSecond2.Text.Trim())? 0: Convert.ToInt32(tbSecond2.Text.Trim());
                if (hours1 > 23 || min1 > 59 || sec1 > 59 || min2 > 59 || sec2 > 59 || hours2 > 23)
                {
                    Response.Write("<script language='javascript'>alert('请正确填写时分秒');</script>");
                    return;
                }
            }
            catch (Exception e)
            {
                Response.Write("<script language='javascript'>alert('请正确填写时分秒');</script>");
                return;
            }
            string startTime;

            if (string.IsNullOrEmpty(txt_StartTime.Value))
            {
                startTime = txt_StartTime.Value;
            }
            else
            {
                startTime = txt_StartTime.Value + " " + hours1 + ":" + min1 + ":" + sec1;
            }
            string endTime;

            if (string.IsNullOrEmpty(txt_EndTime.Value))
            {
                endTime = txt_EndTime.Value;
            }
            else
            {
                endTime = txt_EndTime.Value + " " + hours2 + ":" + min2 + ":" + sec2;
            }
            if (string.IsNullOrEmpty(txt_StartTime.Value) && string.IsNullOrEmpty(txt_EndTime.Value))
            {
                startTime = DateTime.Now.Date.ToString();
            }
            if (IsAll.Value == "1")
            {
                DataTable tb = MsgBLL.GetSellerMsgSendHis(txtTitle.Text.Trim(), startTime,
                                                          endTime, drpSendType.SelectedValue, "", txtPhone.Text.Trim(), drpStaus.SelectedValue);
                grdCus.DataSource = tb;
                grdCus.DataBind();
            }
            else
            {
                DataTable tb = MsgBLL.GetSellerMsgSendHis(Buyer.Value, "",
                                                          "", "---全部---", "", "", "---全部---");
                grdCus.DataSource = tb;
                grdCus.DataBind();
            }
        }