Example #1
0
        protected void BindPage()
        {
            PAGE_SIZE = Convert.ToInt32(txtInputMaxrow.Text);
            var biz        = new BLL.PaymentBiz();
            var resultPage = txtNumberGvSearch.Text.ToInt();
            var res1       = biz.GenPaymentNumberTable(base.UserProfile.IdCard,
                                                       Convert.ToDateTime(txtStartPaidSubDate.Text),
                                                       Convert.ToDateTime(txtEndPaidSubDate.Text), txtPaidGroup.Text.Replace(" ", ""), "N", resultPage, PAGE_SIZE);

            gvSearch.DataSource = res1.DataResponse;
            gvSearch.DataBind();
        }
Example #2
0
        //log4net

        private void BindDataInGridView()
        {
            txtNumberGvSearch.Text = "1";
            maxBefore = txtInputMaxrow.Text;
            if ((txtInputMaxrow.Text != Convert.ToString(PAGE_SIZE) && txtInputMaxrow.Text != "" && Convert.ToInt32(txtInputMaxrow.Text) != 0))
            {
                txtInputMaxrow.Text = maxBefore;
            }
            else if (txtInputMaxrow.Text == "" || Convert.ToInt32(txtInputMaxrow.Text) == 0)
            {
                txtInputMaxrow.Text = Convert.ToString(PAGE_SIZE);
            }
            PAGE_SIZE = Convert.ToInt32(txtInputMaxrow.Text);
            var biz        = new BLL.PaymentBiz();
            var resultPage = txtNumberGvSearch.Text.ToInt();

            if ((base.UserProfile.MemberType == DTO.RegistrationType.OICFinace.GetEnumValue()) ||
                (base.UserProfile.MemberType == DTO.RegistrationType.OIC.GetEnumValue()) ||
                (base.UserProfile.MemberType == DTO.RegistrationType.OICAgent.GetEnumValue()))
            {
                if (txtStartPaidSubDate.Text != "" && txtEndPaidSubDate.Text != "")
                {
                    var resCount1 = biz.GenPaymentNumberTable(base.UserProfile.IdCard,
                                                              Convert.ToDateTime(txtStartPaidSubDate.Text),
                                                              Convert.ToDateTime(txtEndPaidSubDate.Text), txtPaidGroup.Text.Replace(" ", ""), "Y", resultPage, PAGE_SIZE);
                    DataSet ds = resCount1.DataResponse;
                    if (ds.Tables.Count > 0)
                    {
                        DataTable dt = ds.Tables[0];
                        if (dt.Rows.Count > 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 res1 = biz.GenPaymentNumberTable(base.UserProfile.IdCard,
                                                                 Convert.ToDateTime(txtStartPaidSubDate.Text),
                                                                 Convert.ToDateTime(txtEndPaidSubDate.Text), txtPaidGroup.Text.Replace(" ", ""), "N", resultPage, PAGE_SIZE);
                            gvSearch.Visible    = true;
                            gvSearch.DataSource = res1.DataResponse;
                            gvSearch.DataBind();
                            bludDiv.Visible = true;
                            if (res1.IsError)
                            {
                                this.MasterSite.ModelError.ShowMessageError = Resources.errorGenPayment_002;
                                this.MasterSite.ModelError.ShowModalError();
                            }
                            else
                            {
                                if (TotalPages > 1)
                                {
                                    txtNumberGvSearch.Visible   = true;
                                    lblParaPage.Visible         = true;
                                    txtTotalPage.Visible        = true;
                                    btnNextGvSearch.Visible     = true;
                                    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;
                                }
                                else if (TotalPages == 1)
                                {
                                    txtNumberGvSearch.Visible   = true;
                                    lblParaPage.Visible         = true;
                                    txtTotalPage.Visible        = true;
                                    btnPreviousGvSearch.Visible = false;
                                    btnNextGvSearch.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;
                                }
                                else if (TotalPages == 0)
                                {
                                    txtNumberGvSearch.Visible   = true;
                                    lblParaPage.Visible         = true;
                                    txtTotalPage.Visible        = true;
                                    txtTotalPage.Text           = "1";
                                    btngo.Visible               = true;
                                    lblTotalrecord.Text         = "0";
                                    txtInputMaxrow.Visible      = true;
                                    lblHeadInputMaxrow.Visible  = true;
                                    lblHeadTotal.Visible        = true;
                                    lblTotalrecord.Visible      = true;
                                    lblEndTotal.Visible         = true;
                                    btnPreviousGvSearch.Visible = false;
                                    btnNextGvSearch.Visible     = false;
                                }
                                if ((base.UserProfile.MemberType == DTO.RegistrationType.OIC.GetEnumValue()) ||
                                    (base.UserProfile.MemberType == DTO.RegistrationType.OICAgent.GetEnumValue()))
                                {
                                    btnGenReceiptAll.Visible     = false;
                                    gvSearch.Columns[0].Visible  = false;
                                    gvSearch.Columns[11].Visible = false;
                                }
                                else
                                {
                                    if (gvSearch.Rows.Count > 0)
                                    {
                                        btnGenReceiptAll.Visible    = true;
                                        gvSearch.Columns[0].Visible = true;
                                    }
                                    else
                                    {
                                        btnGenReceiptAll.Visible    = false;
                                        gvSearch.Columns[0].Visible = false;
                                    }

                                    gvSearch.Columns[11].Visible = true;
                                }
                                UpdatePanelSearch.Update();
                            }
                        }
                        else
                        {
                            this.MasterSite.ModelError.ShowMessageError = Resources.errorGenPayment_003;
                            this.MasterSite.ModelError.ShowModalError();
                            btnGenReceiptAll.Visible = false;
                        }
                    }
                    else
                    {
                        this.MasterSite.ModelError.ShowMessageError = Resources.errorGenPayment_003;
                        this.MasterSite.ModelError.ShowModalError();
                        btnGenReceiptAll.Visible = false;
                    }
                }
            }

            UpdatePanelSearch.Update();
        }