Exemple #1
0
    public static tblStuffCollection getStuff(string group)
    {
        tblStuffCollection list = new tblStuffCollection();

        list.ReadList(Criteria.NewCriteria(tblStuff.Columns.id_grp, CriteriaOperators.Like, group));
        if (list == null)
        {
            return(null);
        }
        else
        {
            return(list);
        }
    }
Exemple #2
0
    public static tblStuffCollection getStuffBasket(int id)
    {
        tblStuffCollection list = new tblStuffCollection();

        list.ReadList(Criteria.NewCriteria(tblStuff.Columns.id_stuff, CriteriaOperators.Like, id));
        if (list == null)
        {
            return(null);
        }
        else
        {
            return(list);
        }
    }
Exemple #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string             content   = "";
            tblGroupCollection listGroup = tblGroup.readall();
            tblStuffCollection listStuff = new tblStuffCollection();

            if (listGroup == null)
            {
                block_accordeon.InnerText = "گروه بندی نشده!";
            }
            else
            {
                for (int i = 0; i < listGroup.Count; i++)
                {
                    listStuff = getStuff(listGroup[i].id_grp.ToString());
                    content  += "<div class='button_outer'><div class='button_inner'>" + listGroup[i].name_grp.ToString() + "</div></div>" +
                                "<div class='accordeon_content'>";
                    for (int j = 0; j < listStuff.Count; j++)
                    {
                        //int x = Convert.ToInt32(listStuff[j].price_borse);
                        //int y = Convert.ToInt32(listStuff[j].price.ToString());
                        //int discount = y - x;
                        content += "<p class='cover'>" +
                                   "<span class='pic alignright'>" +
                                   "<a href='#' class='pic r_coner'><img src='images/drugs/drug.jpg' alt=''></a>" +
                                   "</span>" +
                                   listStuff[j].name_stuff.ToString() + "  (" + listStuff[j].price + ")   <span style='color:red;font-style: italic;'>" + listStuff[j].detail + "</span><br />" +
                                   "قیمت : " + listStuff[j].price.ToString() + " ریال   |  قیمت بورس: <span style='color:yellow;'>" + listStuff[j].price.ToString() + "</span> ریال   |  ساخت: " + listStuff[j].id_stuff.ToString() + "<br />" +
                                   "تعداد:<input name='count_stuffs_input_" + listStuff[j].id_stuff + "' type='text' value='1' class='count-stuffs' />";

                        if (listStuff[j].name_stuff != "موجود نیست")
                        {
                            content += "<a href='#' class='general_button type_3 add2basket' data-product-id='" + listStuff[j].id_stuff.ToString() + "' >اضافه به لیست خرید</a></p>";
                        }
                    }

                    content += "</div>";
                }

                block_accordeon.InnerHtml = content;
            }
        }
        catch (Exception)
        {
            block_accordeon.InnerText = "خطا در برقراری ارتباط با پایگاه داده!";
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if ((Request.QueryString["n"] != null))
        {
            code_s          = Request.QueryString["n"];
            Session["Fact"] = code_s;
        }
        else
        {
            Response.Redirect("perfact.aspx");
        }


        try
        {
            tblFactOnCollection list_fact = new tblFactOnCollection();
            list_fact.ReadList(Criteria.NewCriteria(tblFactOn.Columns.id_fact, CriteriaOperators.Equal, Convert.ToInt32(code_s)));


            string new_content = "";
            int    count_stuff = 0;
            tblDetailStuffCollection list_detail = new tblDetailStuffCollection();
            list_detail.ReadList(Criteria.NewCriteria(tblDetailStuff.Columns.id_fact, CriteriaOperators.Equal, Convert.ToInt32(code_s)));

            string invoice_content = "<div class='icon'>" +
                                     "<p class='name'>صورتحساب</p>" +
                                     "<table border='1'><tr><td style='padding: 0 15px;padding-right:0;color: rgb(119, 119, 226);'>نام محصول</td><td style='padding: 0 15px;color: rgb(119, 119, 226);'>نام تجاری</td>" +
                                     "<td style='padding: 0 15px;color: rgb(119, 119, 226);'>قیمت مصوب</td><td style='padding: 0 15px;color: rgb(119, 119, 226);'>تخفیف</td><td style='padding: 0 15px;padding-left:0;color: rgb(119, 119, 226);'>قیمت بورس</td></tr>";

            for (int i = 0; i < list_detail.Count; i++)
            {
                count_stuff += 1;
                string             stuff_id   = list_detail[i].id_stuff.ToString();
                tblStuffCollection info_stuff = new tblStuffCollection();
                info_stuff.ReadList(Criteria.NewCriteria(tblStuff.Columns.id_stuff, CriteriaOperators.Like, stuff_id));

                new_content += "<tr><td style='padding: 10px 0;'>" + info_stuff[0].name_stuff + "</td>" +
                               "<td style='padding: 10px 0;'>" + info_stuff[0].detail + "</td>" +
                               "<td style='padding: 10px 0;'>" + info_stuff[0].price + "</td>" +
                               "<td style='padding: 10px 0;'>" + info_stuff[0].detail + "</td>" +
                               "<td style='padding: 10px 0;'>" + info_stuff[0].price + "</td></tr>" +
                               //"<p>جمع کل(بدون تخفیف): " + info_stuff[0].price_borse + "</p>" +
                               //"<p>جمع کل(با تخفیف): " + info_stuff[0].price_borse + "</p>" +
                               "<div class='separator_20'></div>";
                invoice_content += new_content;
            }

            invoice_content += "</table><p>تعداد محصول خریداری: " + (count_stuff + 1) + "</p>" +
                               "<p>جمع قابل پرداخت: " + list_fact[0].amount + "</p>" +
                               "<p>آدرس: " + list_fact[0].addr + "</p>" +
                               "<p>تلفن: " + list_fact[0].name + "</p>" +
                               "<form action='https://acquirer.samanepay.com/payment.aspx' method='post'>" +
                               "<input type='hidden' id='MID' name='MID' value='10085228'/>  " +
                               "<input type='hidden' id='Amount' name='Amount' value='" + list_fact[0].amount + "'/>" +
                               "<input type='hidden' id='ResNum' name='ResNum' value='" + list_fact[0].detail + "'/>" +
                               "<input type='hidden' id='RedirectURL' name='RedirectURL' value='http://boorsedaroo.ir/resultbuy.aspx'/>" +
                               "<p class='tal'>" +
                               "<button type='submit' name='Save' class='general_navigation_button back'>خرید اینترنتی</button>" +
                               "</p>" +
                               "</form>" +
                               "</div>";
            invoice_box.InnerHtml = invoice_content;

            //create form for bank
            //Literal amount = new Literal();
            //amount.Text = "<input type='hidden' id='Amount' name='Amount' value='10000'/>";// +list_fact[0].amount + "'/>";
            //amount.Text += "<input type='hidden' id='ResNum' name='ResNum' value='" + list_fact[0].detail + "'/>";
            //ph_bank.Controls.Add(amount);
        }
        catch (Exception)
        {
            invoice_box.InnerText = "خطا در اتصال به پایگاه داده!";
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //Read Fact Number
        if ((Request.QueryString["n"] != null))
        {
            code_s          = Request.QueryString["n"];
            Session["Fact"] = code_s;
        }
        else
        {
            Response.Redirect("perfact.aspx");
        }

        //Select Data Value
        tblFactOnCollection list_fact = new tblFactOnCollection();

        list_fact.ReadList(Criteria.NewCriteria(tblFactOn.Columns.id_fact, CriteriaOperators.Equal, Convert.ToInt32(code_s)));

        string new_content = "";
        int    count_stuff = 0, Sum_price = 0;
        tblDetailStuffCollection list_detail = new tblDetailStuffCollection();

        list_detail.ReadList(Criteria.NewCriteria(tblDetailStuff.Columns.id_fact, CriteriaOperators.Equal, Convert.ToInt32(code_s)));

        for (int i = 0; i < list_detail.Count; i++)
        {
            count_stuff += 1;
            string             stuff_id   = list_detail[i].id_stuff.ToString();
            tblStuffCollection info_stuff = new tblStuffCollection();
            info_stuff.ReadList(Criteria.NewCriteria(tblStuff.Columns.id_stuff, CriteriaOperators.Like, stuff_id));

            new_content += info_stuff[0].id_stuff;

            Sum_price += Convert.ToInt32((list_detail[i].pay_one * list_detail[i].no_stuff).ToString());
        }

        PayAmountTextBox.Text  = Sum_price.ToString();
        PayOrderIdTextBox.Text = code_s;
        if (!IsPostBack)
        {
            SetDefaultDateTime();
            PayCallBackUrlTextBox.Text = CallBackUrl;
            TerminalIdTextBox.Text     = TerminalId;
            UserNameTextBox.Text       = UserName;
            UserPasswordTextBox.Text   = UserPassword;
        }
        //send data to the bank
        try
        {
            string result;

            BypassCertificateError();

            BPService.PaymentGatewayImplService bpService = new BPService.PaymentGatewayImplService();
            result = bpService.bpPayRequest(Int64.Parse(TerminalIdTextBox.Text),
                                            UserNameTextBox.Text,
                                            UserPasswordTextBox.Text,
                                            Int64.Parse(PayOrderIdTextBox.Text),
                                            Int64.Parse(PayAmountTextBox.Text),
                                            PayDateTextBox.Text,
                                            PayTimeTextBox.Text,
                                            PayAdditionalDataTextBox.Text,
                                            PayCallBackUrlTextBox.Text,
                                            Int64.Parse(PayPayerIdTextBox.Text));

            PayOutputLabel.Text = result;

            String[] resultArray = result.Split(',');
            if (resultArray[0] == "0")
            {
                ClientScript.RegisterStartupScript(typeof(Page), "ClientScript", "<script language='javascript' type='text/javascript'> postRefId('" + resultArray[1] + "');</script> ", false);
            }
        }
        catch (Exception exp)
        {
            PayOutputLabel.Text = "Error: " + exp.Message;
        }
    }
Exemple #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (CurrentMember == null)
        {
            //-----------------> Response.Redirect("admin/sign-in.aspx?p=3");
        }

        //try
        //{
        if (Request.Cookies["ShoppingBasket"] != null)
        {
            HttpCookie MPCookie = (HttpCookie)Request.Cookies["ShoppingBasket"];
            string     value    = MPCookie.Value.ToString();

            if (value.IndexOf(",") == 0)
            {
                value = value.Remove(0, 1);
            }

            if (value != "")
            {
                char[] sep = { ',' };
                productID = value.Split(sep);
                tblStuffCollection listBasket = new tblStuffCollection();


                totalPrice = 0;
                string content = "<table border='0' cellpadding='0' cellspacing='0' class='table tbl-invoice'>" +
                                 "<tr>" +
                                 "<th>ردیف</th>" +
                                 "<th>نام محصول</th>" +
                                 "<th>قیمت مصوب</th>" +
                                 "<th>قیمت بورس</th>" +
                                 "<th>تخفیف</th>" +
                                 "<th>تعداد</th>" +
                                 "<th class='last_cell'></th>" +
                                 "</tr>";
                for (int i = 0; i < productID.Length; i++)
                {
                    string[] pro;
                    pro        = productID[i].Split(sepdash);
                    listBasket = getStuffBasket(int.Parse(pro[0]));
                    for (int j = 0; j < listBasket.Count; j++)
                    {
                        int price       = Convert.ToInt32(listBasket[j].price);
                        int price_borse = Convert.ToInt32(listBasket[j].price);
                        int takhfif     = price - price_borse;

                        content += "<tr class='first_row' >" +
                                   "<td>" + (i + 1) + "</td>" +
                                   "<td>" + listBasket[j].name_stuff.ToString() + "</td>" +
                                   "<td>" + price.ToString() + "ریال </td>" +
                                   "<td>" + price_borse.ToString() + "ریال </td>" +
                                   "<td>" + takhfif + "ریال </td>" +
                                   "<td>" + pro[1] + "</td>" +
                                   "<td class='last_cell'><a href='#' class='general_button type_1 deldrug' data-product-id='" + listBasket[j].id_stuff.ToString() + "' data-product-no='" + pro[1] + "' >حذف</a></td>" +
                                   "</tr>";
                        totalPrice += (price_borse * int.Parse(pro[1]));
                    }
                }
                content += "<tr>" +
                           "<td colspan='7' class='nopadding'>" +
                           "<div class='line_1'></div>" +
                           "</td> " +
                           "</tr>" +
                           "<tr class='first_row'>" +
                           "<td></td>" +
                           "<td>" + productID.Length + " محصول</td>" +
                           "<td colspan='4' >جمع قابل پرداخت: <big>" + totalPrice + " ریال</big></td>" +
                           "<td class='last_cell'></td>" +
                           "</tr>" +
                           "</table>";
                showBasket.InnerHtml = content;
            }
        }
        else
        {
            string err_content = "<table border='0' cellpadding='0' cellspacing='0' class='table'>" +
                                 "<tr>" +
                                 "<th>ردیف</th>" +
                                 "<th>نام محصول</th>" +
                                 "<th>قیمت مصوب</th>" +
                                 "<th>قیمت بورس</th>" +
                                 "<th>تخفیف</th>" +
                                 "<th>تعداد</th>" +
                                 "<th class='last_cell'></th>" +
                                 "</tr>" +
                                 "<tr>" +
                                 "<td colspan='7'>کالایی موجود نمی باشد</td>" +
                                 "</tr>" +
                                 "</table>";
            showBasket.InnerHtml = err_content;
        }

        //}
        //catch (Exception)
        //{
        //showBasket.InnerText = "مشکل در برقراری ارتباط با پایگاه داده!";
        //}

        //try
        //{
        Button btn_accept = new Button();

        btn_accept.Text     = "تایید";
        btn_accept.CssClass = "general_navigation_button back";
        btn_accept.Click   += btn_accept_Click;
        Ph_btn.Controls.Add(btn_accept);
        //}
        //catch (Exception)
        //{

        //}
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if ((Request.QueryString["n"] != null))
        {
            code_s          = Request.QueryString["n"];
            Session["Fact"] = code_s;
        }
        else
        {
            Response.Redirect("perfact.aspx");
        }


        try
        {
            tblFactOnCollection list_fact = new tblFactOnCollection();
            list_fact.ReadList(Criteria.NewCriteria(tblFactOn.Columns.id_fact, CriteriaOperators.Equal, Convert.ToInt32(code_s)));


            string new_content = "";
            int    count_stuff = 0, Sum_price = 0;
            tblDetailStuffCollection list_detail = new tblDetailStuffCollection();
            list_detail.ReadList(Criteria.NewCriteria(tblDetailStuff.Columns.id_fact, CriteriaOperators.Equal, Convert.ToInt32(code_s)));

            string invoice_content = "<div style='text-align:right;direction: rtl;'>" +
                                     "<table border='1' style='width:100%;text-align: center;'><tr style='background-color: rgb(255, 200, 98);'><td style='padding: 0 15px;padding-right:0;color: rgb(119, 119, 226);width: 6%;'>کد کالا</td><td style='padding: 0 15px;color: rgb(119, 119, 226);width: 34%;'>نام محصول</td>" +
                                     "<td style='padding: 0 15px;color: rgb(119, 119, 226);width: 25%;'>قیمت واحد</td><td style='padding: 0 15px;color: rgb(119, 119, 226);width: 10%;'>تعداد</td><td style='padding: 0 15px;padding-left:0;color: rgb(119, 119, 226);width: 25%;'>جمع</td></tr>";

            for (int i = 0; i < list_detail.Count; i++)
            {
                count_stuff += 1;
                string             stuff_id   = list_detail[i].id_stuff.ToString();
                tblStuffCollection info_stuff = new tblStuffCollection();
                info_stuff.ReadList(Criteria.NewCriteria(tblStuff.Columns.id_stuff, CriteriaOperators.Like, stuff_id));

                new_content += "<tr><td style='padding: 10px 0;'>" + info_stuff[0].id_stuff + "</td>" +
                               "<td style='padding: 10px 0;'>" + info_stuff[0].name_stuff + "</td>" +
                               "<td style='padding: 10px 0;'>" + list_detail[i].pay_one + "</td>" +
                               "<td style='padding: 10px 0;'>" + list_detail[i].no_stuff + "</td>" +
                               "<td style='padding: 10px 0;'>" + list_detail[i].pay_one * list_detail[i].no_stuff + "</td></tr>";
                //"<p>جمع کل(بدون تخفیف): " + info_stuff[0].price_borse + "</p>" +
                //"<p>جمع کل(با تخفیف): " + info_stuff[0].price_borse + "</p>" +
                Sum_price += Convert.ToInt32((list_detail[i].pay_one * list_detail[i].no_stuff).ToString());
                //invoice_content += new_content;
            }

            invoice_content += new_content;


            invoice_content += "</table><p style='margin-top: 15px;border-top: 1px solid;'>تعداد محصول خریداری: " + (count_stuff) + "</p>" +
                               "<p>جمع قابل پرداخت: " + Sum_price + "</p>" +
                               "<p>آدرس: " + list_fact[0].addr + "</p>" +
                               "<p>تلفن: " + list_fact[0].tel + "</p>" +
                               "<form action='https://acquirer.samanepay.com/payment.aspx' method='post'>" +
                               "<input type='hidden' id='MID' name='MID' value='10085228'/>  " +
                               "<input type='hidden' id='Amount' name='Amount' value='" + list_fact[0].amount + "'/>" +
                               "<input type='hidden' id='ResNum' name='ResNum' value='" + list_fact[0].detail + "'/>" +
                               "<input type='hidden' id='RedirectURL' name='RedirectURL' value='http://boorsedaroo.ir/resultbuy.aspx'/>" +
                               "<p class='tal'>" +
                               "<button type='submit' name='Save' class='dark-2 common_font common_div'>خرید اینترنتی</button>" +
                               "</p>" +
                               "</form>" +
                               "</div>";
            invoice_box.InnerHtml = invoice_content;



            sum_pay_show.InnerText = "ریال" + Sum_price;


            //create form for bank
            //Literal amount = new Literal();
            //amount.Text = "<input type='hidden' id='Amount' name='Amount' value='10000'/>";// +list_fact[0].amount + "'/>";
            //amount.Text += "<input type='hidden' id='ResNum' name='ResNum' value='" + list_fact[0].detail + "'/>";
            //ph_bank.Controls.Add(amount);
        }
        catch (Exception)
        {
            invoice_box.InnerText = "خطا در اتصال به پایگاه داده!";
        }
    }