Exemplo n.º 1
0
    //Bind admin users
    private void BindAdminUsers(string search = "")
    {
        this.Form.DefaultButton = imgbtnSearch.UniqueID;

        AdminManager objuser = new AdminManager();
        DataTable    dtadmin = new DataTable();

        try
        {
            objuser.firstname = txtsearch.Text.Trim();

            if (pageNo == 0)
            {
                pageNo = 1;
            }
            objuser.pageNo         = pageNo;
            objuser.pageSize       = pageSize;
            objuser.SortExpression = SortExpression;
            //querystring = "&key=" + txtsearch.Text;
            querystring = "&pageSize=" + ddlpageSize.SelectedValue + "&key=" + txtsearch.Text;
            dtadmin     = objuser.SearchItem();
            totalrecs   = objuser.TotalRecord;
            if (pageNo == 1)
            {
                objuser.pageNo = 1;
                pageNo         = 1;
            }
            else if (pageNo == 0)
            {
                objuser.pageNo = 1;
                pageNo         = 1;
            }
            else
            {
                objuser.pageNo = (pageNo - 1) * pageSize;
            }
            objuser.pageSize = pageSize;
            totalpages       = totalrecs / pageSize;
            if ((totalrecs % pageSize) > 0 && (totalrecs > pageSize))
            {
                totalpages += 1;
            }
            gvAdmin.DataSource = dtadmin;
            gvAdmin.DataBind();
            if (dtadmin.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, "viewadmin.aspx");
            ltrpaggingbottom.Text = strpaging;
            //Ltrup.Text = strpaging;
            LoadDropDownList();
        }
        catch (Exception ex) { throw ex; }
        finally { dtadmin.Dispose(); objuser = null; }
    }
Exemplo n.º 2
0
    // bind order
    private void GetOrderDetails()
    {
        orderManager objorder = new orderManager();
        DataTable    dtorder  = new DataTable();

        try
        {
            if (rbtCOD.Checked == true)
            {
                lblDelivertType.Text = "Cash on Delivery";
            }
            if (rbtCredit.Checked == true)
            {
                lblDelivertType.Text = "Credit";
            }

            //if (hidorderid.Value != "0")
            if (Request.QueryString["orderid"] != null)
            {
                objorder.orderid = Convert.ToInt32(Request.QueryString["orderid"]);
            }
            //else if (Session["OrderId"] != null)
            //{
            //    objorder.orderid = Convert.ToInt32(Session["OrderId"]);
            //}
            else
            {
                objorder.orderid = Convert.ToInt32(0);
            }

            if (pageNo == 0)
            {
                pageNo = 1;
            }
            objorder.pageNo         = pageNo;
            objorder.pageSize       = pageSize;
            objorder.SortExpression = SortExpression;

            dtorder   = objorder.SearchOrderetaild();
            totalrecs = objorder.TotalRecord;
            if (pageNo == 1)
            {
                objorder.pageNo = 1;
                pageNo          = 1;
            }
            else if (pageNo == 0)
            {
                objorder.pageNo = 1;
                pageNo          = 1;
            }
            else
            {
                objorder.pageNo = (pageNo - 1) * pageSize;
            }
            objorder.pageSize = pageSize;
            totalpages        = totalrecs / pageSize;
            if ((totalrecs % pageSize) > 0 && (totalrecs > pageSize))
            {
                totalpages += 1;
            }
            gvAdmin.DataSource = dtorder;
            gvAdmin.DataBind();
            if (dtorder.Rows.Count > 0)
            {
                if (rbtCredit.Checked == true)
                {
                    decimal CreditLimit = 0;

                    CreditLimit = objorder.Getcreditlimitamountbycustomer(Convert.ToString(dtorder.Rows[0]["orderid"]));
                    if (CreditLimit != 0)
                    {
                        //lbltotal.Visible = true;
                        //lblcreaditamount.Visible = true;

                        // lbltotal.Text=Convert.ToString(dtorder.Rows[0]["TotalNetPrice"]);
                        //lblcreaditamount.Text=CreditLimit.ToString("0.00");

                        lblTotalPayAmmount.Text = Convert.ToString(Convert.ToDecimal(dtorder.Rows[0]["TotalNetPrice"]) - CreditLimit) + " SAR";
                    }
                }
                else
                {
                    //lbltotal.Visible = false;
                    //lblcreaditamount.Visible = false;
                    lblTotalPayAmmount.Text = Convert.ToString(dtorder.Rows[0]["TotalNetPrice"]) + " SAR";
                }
                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, "add_order.aspx");
            ltrpaggingbottom.Text = strpaging;
        }
        catch (Exception ex) { throw ex; }
        finally { dtorder.Dispose(); objorder = null; }
    }
Exemplo n.º 3
0
    //Bind product
    private void BindProduct(string search = "")
    {
        //this.Form.DefaultButton = imgbtnSearch.UniqueID;
        pageSize = Convert.ToInt32(2000);
        productManager objproduct = new productManager();
        DataSet        dtadmin    = new DataSet();

        try
        {
            if (txtSearchProduct.Text != "")
            {
                objproduct.productName = Server.HtmlEncode(txtSearchProduct.Text.Trim());
            }
            else
            {
                objproduct.productName = Server.HtmlEncode(txtSearchProduct.Text.Trim());
            }

            if (pageNo == 0)
            {
                pageNo = 1;
            }
            objproduct.pageNo         = pageNo;
            objproduct.pageSize       = pageSize;
            objproduct.SortExpression = SortExpression;

            dtadmin   = objproduct.SearchOrder();
            totalrecs = objproduct.TotalRecord;
            if (pageNo == 1)
            {
                objproduct.pageNo = 1;
                pageNo            = 1;
            }
            else if (pageNo == 0)
            {
                objproduct.pageNo = 1;
                pageNo            = 1;
            }
            else
            {
                objproduct.pageNo = (pageNo - 1) * pageSize;
            }
            objproduct.pageSize = pageSize;
            totalpages          = totalrecs / pageSize;
            if ((totalrecs % pageSize) > 0 && (totalrecs > pageSize))
            {
                totalpages += 1;
            }
            GVOrder.DataSource = dtadmin;
            GVOrder.DataBind();
            if (dtadmin.Tables[0].Rows.Count > 0)
            {
                int startRowOnPage = (GVOrder.PageIndex * GVOrder.PageSize) + 1;
                int lastRowOnPage  = startRowOnPage + GVOrder.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, "add_order.aspx");
            //ltrpaggingbottom.Text = strpaging;
        }
        catch (Exception ex) { throw ex; }
        finally { dtadmin.Dispose(); objproduct = null; }
    }
Exemplo n.º 4
0
    //Bind product
    private void BindProduct(string search = "")
    {
        productManager objproduct = new productManager();
        DataTable      dtadmin    = new DataTable();

        try
        {
            if (txtsearch.Text != "")
            {
                string   strg   = txtsearch.Text.Trim();
                string[] arystr = strg.Split('\n');
                //string[] arystr = strg.Split(',');
                string orgstr = string.Empty;
                if (arystr.Length > 0)
                {
                    for (int k = 0; k < arystr.Length; k++)
                    {
                        if (k == 0)
                        {
                            orgstr += "('" + Convert.ToString(arystr[k]) + "'";
                        }
                        else
                        {
                            orgstr += ",'" + Convert.ToString(arystr[k]) + "'";
                        }
                    }
                    orgstr += ")";
                }
                //objproduct.sku = txtsearch.Text.Trim();
                objproduct.sku = orgstr.ToString();
            }
            else
            {
                objproduct.sku = txtsearch.Text.Trim();
            }

            //less than greter than equal to
            if (txtfilter.Text != "")
            {
                objproduct.InventoryFilter = txtfilter.Text.Trim();
            }
            else
            {
                objproduct.InventoryFilter = txtfilter.Text.Trim();
            }
            if (ddlfilter.SelectedValue != "0")
            {
                objproduct.filter = ddlfilter.SelectedValue;
            }
            else
            {
                objproduct.filter = ddlfilter.SelectedValue;
            }

            if (pageNo == 0)
            {
                pageNo = 1;
            }
            objproduct.pageNo         = pageNo;
            objproduct.pageSize       = pageSize;
            objproduct.SortExpression = SortExpression;
            querystring = "&pageSize=" + ddlpageSize.SelectedValue + "&key=" + txtsearch.Text;
            //querystring = "&key=" + txtsearch.Text;
            dtadmin   = objproduct.SearchProductInventoryItem();
            totalrecs = objproduct.TotalRecord;
            if (pageNo == 1)
            {
                objproduct.pageNo = 1;
                pageNo            = 1;
            }
            else if (pageNo == 0)
            {
                objproduct.pageNo = 1;
                pageNo            = 1;
            }
            else
            {
                objproduct.pageNo = (pageNo - 1) * pageSize;
            }
            objproduct.pageSize = pageSize;
            totalpages          = totalrecs / pageSize;
            if ((totalrecs % pageSize) > 0 && (totalrecs > pageSize))
            {
                totalpages += 1;
            }
            gvAdmin.DataSource = dtadmin;
            gvAdmin.DataBind();
            if (dtadmin.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, "viewinventory.aspx");
            ltrpaggingbottom.Text = strpaging;
            //Ltrup.Text = strpaging;
        }
        catch (Exception ex) { throw ex; }
        finally { dtadmin.Dispose(); objproduct = null; }
    }
Exemplo n.º 5
0
    //// 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; }
    }