Example #1
0
 protected void SearchBT_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(快遞時間TB.Text))
     {
         Session["提單日期"] = 快遞時間TB.Text;
         SelectPanel_ModalPopupExtender.Show();
     }
     else
     {
         DbInit(0);
     }
 }
Example #2
0
 protected void SearchBT_Click(object sender, EventArgs e)
 {
     Session.Remove("提單日期");
     Session.Remove("快遞部門");
     if (!string.IsNullOrEmpty(DateRangeTB.Text))
     {
         Session["提單日期"] = DateRangeTB.Text;
         Session["快遞部門"] = 寄件人DDL.SelectedValue;
         SelectPanel_ModalPopupExtender.Show();
     }
     else
     {
         DbInit(0);
     }
 }
Example #3
0
        protected void DbInit(int iid = 0)
        {
            DataTable dt = new DataTable(), dt2 = new DataTable();

            if (iid == 0)
            {
                using (SqlConnection Conn = new SqlConnection(strConnectString))
                {
                    SqlDataAdapter myAdapter = new SqlDataAdapter(selectsql(iid).ToString(), Conn);
                    myAdapter.Fill(dt2);    //---- 這時候執行SQL指令。取出資料,放進 DataSet。
                }
                if (dt2.Rows.Count > 1)
                {
                    GridView1.DataSource = dt2;
                    GridView1.DataBind();
                    SelectPanel_ModalPopupExtender.Show();
                }
                else if (dt2.Rows.Count == 1)
                {
                    GridView1.DataSource = null;
                    GridView1.DataBind();
                    iid = int.Parse(dt2.Rows[0]["id"].ToString());
                }
            }
            if (iid > 0)
            {
                using (SqlConnection Conn = new SqlConnection(strConnectString))
                {
                    SqlDataAdapter myAdapter = new SqlDataAdapter(selectsql(iid).ToString(), Conn);
                    myAdapter.Fill(dt);    //---- 這時候執行SQL指令。取出資料,放進 DataSet。
                }
            }
            if (dt.Rows.Count > 0)
            {
                ReportViewer1.Visible        = true;
                ReportViewer1.ProcessingMode = ProcessingMode.Local;
                ReportDataSource source = new ReportDataSource("INVOICE", dt);
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(source);
                ReportViewer1.DataBind();
                ReportViewer1.LocalReport.Refresh();
            }
            else if (iid == 0 && dt.Rows.Count == 0)
            {
                F_ErrorShow("搜尋不到資料");
            }
        }
Example #4
0
 protected void SearchBT_Click(object sender, EventArgs e)
 {
     MsgLB.Text = "";
     if (!string.IsNullOrEmpty(快遞時間TB.Text.Trim()))
     {
         DateTime 快遞時間 = Convert.ToDateTime(快遞時間TB.Text.Trim());
         string   快遞單號 = (string.IsNullOrEmpty(快遞單號TB.Text.Trim())) ? "" : 快遞單號TB.Text.Trim();
         //var c = db.快遞單.Where(p => p.提單日期.Month == 快遞時間.Month && p.提單日期.Year == 快遞時間.Year && p.提單日期.Day == 快遞時間.Day);
         var c = db.快遞單.Where(p => p.提單日期 == 快遞時間 && p.IsDeleted == false);
         if (快遞單號.Length > 0)
         {
             c = c.Where(p => p.提單號碼.Contains(快遞單號));
         }
         if (c.Count() > 1)
         {
             Session["提單日期"] = 快遞時間TB.Text.Trim();
             SelectPanel_ModalPopupExtender.Show();
         }
         else
         {
             if (c.Count() > 0)
             {
                 foreach (var item in c)
                 {
                     if (F_確認檢貨(item.id))
                     {
                         MsgLB.Text = "快遞單櫃台已檢貨";
                     }
                     HeadDB(item.id);
                 }
                 Show(true);
             }
             else
             {
                 MessageLB.Text = "日期沒有快遞單,請櫃台新增快遞單資料";
                 AlertPanel_ModalPopupExtender.Show();
             }
         }
     }
 }