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");
        }

        //for register btn
        btn.InnerHtml = "<a class='dark-2 common_font common_div' href='Default.aspx?code=" + code_s + "' onclick='deleteAllCookies();'>ثبت سفارش</a>";

        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();

                tblPorfolioCollection info_stuff = new tblPorfolioCollection();
                info_stuff.ReadList(Criteria.NewCriteria(tblPorfolio.Columns.id_profolio, CriteriaOperators.Like, stuff_id));

                new_content += "<tr><td style='padding: 10px 0;'>" + stuff_id + "</td>" +
                               "<td style='padding: 10px 0;'>" + info_stuff[0].title_prof + "</td>" +
                               "<td style='padding: 10px 0;'>" + info_stuff[0].pic_addr + "</td>" +
                               "<td style='padding: 10px 0;'>" + list_detail[i].no_stuff + "</td>" +
                               "<td style='padding: 10px 0;'>" + Convert.ToInt32(info_stuff[0].pic_addr) * list_detail[i].no_stuff + "</td></tr>";
                Sum_price += Convert.ToInt32((list_detail[i].pay_one * list_detail[i].no_stuff).ToString());
            }

            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>" +
                               "</div>";
            invoice_box.InnerHtml  = invoice_content;
            sum_pay_show.InnerText = "ریال" + Sum_price;
        }
        catch (Exception)
        {
            invoice_box.InnerText = "خطا در اتصال به پایگاه داده!";
        }
    }
Ejemplo n.º 2
0
    protected void btn_refresh_Click(object sender, EventArgs e)
    {
        try
        {
            tblDetailStuffCollection lists = new tblDetailStuffCollection();
            lists.ReadList(Criteria.NewCriteria(tblDetailStuff.Columns.id_fact, CriteriaOperators.Equal, Convert.ToInt32(ddl_no_fact.Items[ddl_no_fact.SelectedIndex].Value)));

            lbl_no_fact.Text = lists[0].id_fact.ToString();

            ////set value for dgv
            //ASPxGridView2.DataSource = lists;
            //ASPxGridView2.KeyFieldName = "id_fact";
            //ASPxGridView2.DataBind();

            string content = "";
            content = "<div class='title-header'><span class='title'>شماره کالا</span><span class='title'>نام کالا</span><span class='title'>تعداد</span><span class='title'>بهای کالا</span></div>";

            for (int i = 0; i < lists.Count; i++)
            {
                content += "<div class='title-header'>";
                content += "<span class='title1'>" + lists[i].id_stuff + "</span>";
                content += "<span class='title2'>" + lists[i].name_stuff + "</span>";
                content += "<span class='title3'>" + lists[i].pay_one + "</span>";
                content += "<span class='title4'>" + lists[i].no_stuff + "</span>";
                content += "</div>";
            }
            Place_preview.InnerHtml = content;
        }
        catch (Exception)
        {
            Literal text = new Literal();
            text.Text = "فاکتور خالی است";
            Place_detail.Controls.Add(text);
        }
    }
Ejemplo n.º 3
0
    protected void btn_refresh_Click(object sender, EventArgs e)
    {
        try
        {
            tblDetailStuffCollection lists = new tblDetailStuffCollection();
            lists.ReadList(Criteria.NewCriteria(tblDetailStuff.Columns.id_fact, CriteriaOperators.Equal, Convert.ToInt32(ddl_no_fact.Items[ddl_no_fact.SelectedIndex].Value)));

            lbl_no_fact.Text = lists[0].id_fact.ToString();

            //set value for dgv
            ASPxGridView2.DataSource   = lists;
            ASPxGridView2.KeyFieldName = "id_fact";
            ASPxGridView2.DataBind();
        }
        catch (Exception)
        {
            Literal text = new Literal();
            text.Text = "فاکتور خالی است";
            Place_detail.Controls.Add(text);
        }
    }
    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 = "خطا در اتصال به پایگاه داده!";
        }
    }
Ejemplo n.º 5
0
    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 = "خطا در اتصال به پایگاه داده!";
        }
    }