Пример #1
0
 protected void btnExportExcel_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         int total = lblTotalrecord.Text == "" ? 0 : lblTotalrecord.Text.ToInt();
         if (total > base.EXCEL_SIZE_Key)
         {
             this.MasterSite.ModelError.ShowMessageError = SysMessage.ExcelSizeError;
             this.MasterSite.ModelError.ShowModalError();
             UpdatePanelSearch.Update();
         }
         else
         {
             ExportBiz export = new ExportBiz();
             var       biz    = new BLL.PaymentBiz();
             string    IdParameter;
             if (base.UserProfile.MemberType == 1)
             {
                 IdParameter = base.UserProfile.Id;
             }
             else
             {
                 IdParameter = base.UserProfile.CompCode;
             }
             Dictionary <string, string> columns = new Dictionary <string, string>();
             columns.Add("ลำดับ", "RUN_NO");
             columns.Add("ใบสั่งจ่ายย่อย", "HEAD_REQUEST_NO");
             columns.Add("ประเภทใบสั่งจ่าย", "PETITION_TYPE_NAME");
             columns.Add("จำนวนคน", "PERSON_NO");
             columns.Add("จำนวนเงิน", "SUBPAYMENT_AMOUNT");
             columns.Add("วันที่จ่ายย่อย", "SUBPAYMENT_DATE");
             var res = biz.GetGroupPayment(IdParameter, Convert.ToDateTime(txtStartPaidSubDate.Text), Convert.ToDateTime(txtEndPaidSubDate.Text), Convert.ToString(base.UserProfile.MemberType), txtID.Text, 1, base.EXCEL_SIZE_Key, "N");
             export.CreateExcel(res.DataResponse, columns);
         }
     }
     catch { }
 }
Пример #2
0
        protected void BindPage()
        {
            PAGE_SIZE = Convert.ToInt32(txtInputMaxrow.Text);
            var    biz        = new BLL.PaymentBiz();
            var    resultPage = txtNumberGvSearch.Text.ToInt();
            string IdParameter;

            if (base.UserProfile.MemberType == 1)
            {
                IdParameter = base.UserProfile.Id;
            }
            else
            {
                IdParameter = base.UserProfile.CompCode;
            }
            var res = biz.GetGroupPayment(IdParameter, Convert.ToDateTime(txtStartPaidSubDate.Text), Convert.ToDateTime(txtEndPaidSubDate.Text), Convert.ToString(base.UserProfile.MemberType), txtID.Text, resultPage, PAGE_SIZE, "N");


            gvPaymentAssimilate.Visible    = true;
            gvPaymentAssimilate.DataSource = res.DataResponse;
            gvPaymentAssimilate.DataBind();

            boxresult.Visible = true;
        }
Пример #3
0
        private void GetDataInGridView()
        {
            PAGE_SIZE = Convert.ToInt32(txtInputMaxrow.Text);
            txtNumberGvSearch.Text = "1";
            var    biz        = new BLL.PaymentBiz();
            var    resultPage = txtNumberGvSearch.Text.ToInt();
            string IdParameter;

            if (base.UserProfile.MemberType == 1)
            {
                IdParameter = base.UserProfile.Id;
            }
            else
            {
                IdParameter = base.UserProfile.CompCode;
            }
            if (txtCompany.Text == "")
            {
                txtID.Text = "";
            }
            var       resCount     = biz.GetGroupPayment(IdParameter, Convert.ToDateTime(txtStartPaidSubDate.Text), Convert.ToDateTime(txtEndPaidSubDate.Text), Convert.ToString(base.UserProfile.MemberType), txtID.Text, resultPage, PAGE_SIZE, "Y");
            DataSet   ds           = resCount.DataResponse;
            DataTable dt           = ds.Tables[0];
            DataRow   dr           = dt.Rows[0];
            int       rowcount     = Convert.ToInt32(dr["rowcount"].ToString());
            double    dblPageCount = (double)((decimal)rowcount / PAGE_SIZE);

            TotalPages        = (int)Math.Ceiling(dblPageCount);
            txtTotalPage.Text = Convert.ToString(TotalPages);

            var    res   = biz.GetGroupPayment(IdParameter, Convert.ToDateTime(txtStartPaidSubDate.Text), Convert.ToDateTime(txtEndPaidSubDate.Text), Convert.ToString(base.UserProfile.MemberType), txtID.Text, resultPage, PAGE_SIZE, "N");
            string date1 = txtStartPaidSubDate.Text;
            string date2 = txtEndPaidSubDate.Text;

            gvPaymentAssimilate.Visible    = true;
            gvPaymentAssimilate.DataSource = res.DataResponse;
            gvPaymentAssimilate.DataBind();
            if (res.IsError)
            {
                this.MasterSite.ModelError.ShowMessageError = res.ErrorMsg;
                this.MasterSite.ModelError.ShowModalError();
            }
            else
            {
                if (gvPaymentAssimilate.Rows.Count == 0)
                {
                    btnOk.Visible             = false;
                    txtNumberGvSearch.Visible = true;
                    lblParaPage.Visible       = true;
                    txtTotalPage.Visible      = true;

                    btngo.Visible              = true;
                    lblTotalrecord.Text        = "0";
                    txtInputMaxrow.Visible     = true;
                    lblHeadInputMaxrow.Visible = true;
                    lblHeadTotal.Visible       = true;
                    lblTotalrecord.Visible     = true;
                    lblEndTotal.Visible        = true;
                    txtTotalPage.Text          = "1";
                    CheckBox Chall = (CheckBox)gvPaymentAssimilate.HeaderRow.FindControl("checkall");
                    Chall.Visible = false;
                }
                else
                {
                    CheckBox Chall = (CheckBox)gvPaymentAssimilate.HeaderRow.FindControl("checkall");
                    Chall.Visible          = true;
                    btnOk.Visible          = true;
                    btnExportExcel.Visible = true;
                }


                boxresult.Visible = true;
                UpdatePanelSearch.Update();
                if (TotalPages > 1)
                {
                    txtNumberGvSearch.Visible   = true;
                    lblParaPage.Visible         = true;
                    txtTotalPage.Visible        = true;
                    btnNextGvSearch.Visible     = true;
                    btnPreviousGvSearch.Visible = false;
                    btngo.Visible              = true;
                    txtInputMaxrow.Visible     = true;
                    lblHeadInputMaxrow.Visible = true;
                    lblHeadTotal.Visible       = true;
                    lblTotalrecord.Visible     = true;
                    lblEndTotal.Visible        = true;
                    lblTotalrecord.Text        = dr["rowcount"].ToString();
                }
                else if (TotalPages == 1)
                {
                    txtNumberGvSearch.Visible   = true;
                    lblParaPage.Visible         = true;
                    txtTotalPage.Visible        = true;
                    btnNextGvSearch.Visible     = false;
                    btnPreviousGvSearch.Visible = false;
                    btngo.Visible              = true;
                    lblTotalrecord.Text        = dr["rowcount"].ToString();
                    txtInputMaxrow.Visible     = true;
                    lblHeadInputMaxrow.Visible = true;
                    lblHeadTotal.Visible       = true;
                    lblTotalrecord.Visible     = true;
                    lblEndTotal.Visible        = true;
                }
                Detaill.Visible = true;
            }
            if (base.UserProfile.MemberType == DTO.RegistrationType.OIC.ToInt() || base.UserProfile.MemberType == DTO.RegistrationType.OICAgent.ToInt())
            {
                btnOk.Visible = false;
                gvPaymentAssimilate.Columns[0].Visible = false;
            }
        }