protected void btnpayupdate_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            paymentManager objpay = new paymentManager();
            objpay.paymentid  = Convert.ToInt32(hidPaymentId.Value);
            objpay.orderid    = Convert.ToInt32(txtPopOrderno.Text.Trim());
            objpay.payammount = Convert.ToDecimal(txtPopAmmount.Text.Trim());
            objpay.paynotes   = Convert.ToString(txtPopNots.Text.Trim());
            objpay.paystatus  = Convert.ToInt32(1);

            if (hidCustid.Value != "0")
            {
                objpay.customerid = Convert.ToInt32(hidCustid.Value);
            }
            else
            {
                objpay.contactName = Convert.ToString(txtPOPCustomer.Text);
                int Custid = objpay.GetCustomerIdByCustomerName();
                objpay.customerid = Convert.ToInt32(Custid);
            }
            objpay.UpdatePayment();
            BindPayment();
        }
    }
    protected void imgbtnDelete_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            paymentManager objpay = new paymentManager();
            try
            {
                int      con = 0;
                CheckBox chk = new CheckBox();
                for (int i = 0; i < gvAdmin.Rows.Count; i++)
                {
                    chk = (CheckBox)(gvAdmin.Rows[i].FindControl("chkDelete"));
                    if (chk.Checked == true)
                    {
                        con += 1;
                        objpay.paymentid = Convert.ToInt32(gvAdmin.DataKeys[gvAdmin.Rows[i].RowIndex].Value.ToString());
                        objpay.DeletePaymentRecord();
                    }
                }
                BindPayment();

                lblmsg.Visible = true;
                lblmsgs.Text   = "Payment details deleted successfully";
            }
            catch (Exception ex) { throw ex; }
            finally { objpay = null; }
        }
    }
Beispiel #3
0
    public List <string> SearchKeywordPayment(string SearchKey)
    {
        paymentManager objpay = new paymentManager();

        objpay.SearchKey = Convert.ToString(SearchKey);
        List <string> MPN = new List <string>();
        DataTable     dt  = new DataTable();

        dt = objpay.SearchKeywordPayment();
        if (dt.Rows.Count > 0)
        {
            foreach (DataRow dr in dt.Rows)
            {
                MPN.Add(Server.HtmlDecode(dr["SearchKey"].ToString()));
            }
        }
        else
        {
            MPN.Add("No record found");
        }
        return(MPN);
    }
Beispiel #4
0
    public List <paymentManager> BindPaymentData(string id)
    {
        paymentManager objProduct = new paymentManager();

        objProduct.paymentid = Convert.ToInt32(id);
        List <paymentManager> lmp = new List <paymentManager>();
        DataTable             dt  = new DataTable();

        dt = objProduct.GetSinglePaymentRecord();
        if (dt.Rows.Count > 0)
        {
            foreach (DataRow dr in dt.Rows)
            {
                paymentManager PMS = new paymentManager();
                PMS.paymentid   = Convert.ToInt32(dr["paymentid"].ToString());
                PMS.orderid     = Convert.ToInt32(dr["orderid"].ToString());
                PMS.payammount  = Convert.ToDecimal(dr["payammount"].ToString());
                PMS.paynotes    = dr["paynotes"].ToString();
                PMS.contactName = dr["contactName"].ToString();
                lmp.Add(PMS);
            }
        }
        return(lmp);
    }
    //// get month
    //public void getMonth()
    //{
    //    var currentMonth = DateTime.Today.Month;
    //    for (int i = 1; i <= 12; i++)
    //    {
    //        chkMonth.Items.Add(i.ToString());
    //    }
    //}

    //Bind order
    private void BindPayment(string search = "")
    {
        this.Form.DefaultButton = imgbtnSearch.UniqueID;

        paymentManager objPay  = new paymentManager();
        DataTable      dtorder = new DataTable();

        try
        {
            if (txtsearch.Text != "")
            {
                objPay.commonsearch = txtsearch.Text.Trim();
            }
            //else if (Request.QueryString["orderid"] != null)
            //{
            //    objPay.commonsearch = Convert.ToInt32(Request.QueryString["orderid"]);
            //}
            else
            {
                objPay.commonsearch = "";
            }

            //year filter
            if (chk2015.Checked == true && chk2016.Checked == true)
            {
                objPay.firstyear = Convert.ToInt32(PervYear.InnerText); objPay.lastyear = Convert.ToInt32(currYear.InnerText);
            }
            else if (chk2015.Checked == true)
            {
                objPay.firstyear = Convert.ToInt32(PervYear.InnerText);
            }
            else if (chk2016.Checked == true)
            {
                objPay.firstyear = Convert.ToInt32(currYear.InnerText);
            }
            else
            {
                objPay.firstyear = 0; objPay.lastyear = 0;
            }


            // month filter
            string strMonth = string.Empty;

            if (chk1.Checked == true)
            {
                strMonth += 1 + ",";
            }
            if (chk2.Checked == true)
            {
                strMonth += 2 + ",";
            }
            if (chk3.Checked == true)
            {
                strMonth += 3 + ",";
            }
            if (chk4.Checked == true)
            {
                strMonth += 4 + ",";
            }
            if (chk5.Checked == true)
            {
                strMonth += 5 + ",";
            }
            if (chk6.Checked == true)
            {
                strMonth += 6 + ",";
            }
            if (chk7.Checked == true)
            {
                strMonth += 7 + ",";
            }
            if (chk8.Checked == true)
            {
                strMonth += 8 + ",";
            }
            if (chk9.Checked == true)
            {
                strMonth += 9 + ",";
            }
            if (chk10.Checked == true)
            {
                strMonth += 10 + ",";
            }
            if (chk11.Checked == true)
            {
                strMonth += 11 + ",";
            }
            if (chk12.Checked == true)
            {
                strMonth += 12 + ",";
            }

            if (strMonth != "")
            {
                strMonth = strMonth.TrimEnd(',');
                var strTemp = strMonth.Split(',');
                for (int i = 0; i < strTemp.Count(); i++)
                {
                    if (strTemp.Count() >= 2)
                    {
                        endmonth = Convert.ToInt32(strTemp[i]);
                    }

                    if (i == 0)
                    {
                        startmonth = Convert.ToInt32(strTemp[i]);
                    }
                }
            }
            if (startmonth != 0)
            {
                objPay.startmonth = startmonth;
            }
            else
            {
                objPay.startmonth = startmonth;
            }
            if (endmonth != 0)
            {
                objPay.endmonth = endmonth;
            }
            else
            {
                objPay.endmonth = endmonth;
            }


            if (pageNo == 0)
            {
                pageNo = 1;
            }
            objPay.pageNo         = pageNo;
            objPay.pageSize       = pageSize;
            objPay.SortExpression = SortExpression;
            querystring           = "&pageSize=" + ddlpageSize.SelectedValue + "&key=" + txtsearch.Text;
            dtorder   = objPay.SearchItem();
            totalrecs = objPay.TotalRecord;
            if (pageNo == 1)
            {
                objPay.pageNo = 1;
                pageNo        = 1;
            }
            else if (pageNo == 0)
            {
                objPay.pageNo = 1;
                pageNo        = 1;
            }
            else
            {
                objPay.pageNo = (pageNo - 1) * pageSize;
            }
            objPay.pageSize = pageSize;
            totalpages      = totalrecs / pageSize;
            if ((totalrecs % pageSize) > 0 && (totalrecs > pageSize))
            {
                totalpages += 1;
            }
            gvAdmin.DataSource = dtorder;
            gvAdmin.DataBind();
            if (dtorder.Rows.Count > 0)
            {
                int startRowOnPage = (gvAdmin.PageIndex * gvAdmin.PageSize) + 1;
                int lastRowOnPage  = startRowOnPage + gvAdmin.Rows.Count - 1;
                int totalRows      = totalrecs;
                ltrcountrecord.Text = "<div class=\"countdiv\">Showing " + startRowOnPage.ToString() + " to " + lastRowOnPage + " of " + totalRows + " entries</div>";
            }
            String strpaging = CommonFunctions.AdminPagingv2(totalpages, pageNo, querystring, "viewpayment.aspx");
            ltrpaggingbottom.Text = strpaging;
            //Ltrup.Text = strpaging;
            //LoadDropDownList();
        }
        catch (Exception ex) { throw ex; }
        finally { dtorder.Dispose(); objPay = null; }
    }