Exemplo n.º 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);
        }
    }
Exemplo n.º 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);
        }
    }
    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;
        }
    }
    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 = "خطا در اتصال به پایگاه داده!";
        }
    }