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 = "خطا در اتصال به پایگاه داده!";
        }
    }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //if ((Request.QueryString["order"] != null))
        //{
        //    code_s = Request.QueryString["oreder"];
        //}

        tblPorfolioCollection list_menu = new tblPorfolioCollection();

        list_menu.ReadList(Cruder.Core.Criteria.NewCriteria(tblPorfolio.Columns.grp_stuff, Cruder.Core.CriteriaOperators.Equal, 3));
        for (int i = 0; i < list_menu.Count; i++)
        {
            Literal top = new Literal();
            top.Text = "<div style=\"width:270px;float:right;margin-right: 30px;\"><img class=\"box_shadows img_sales\" src=\"img/stuff/stuff1.jpg\"/><div>";
            Place_stuff.Controls.Add(top);

            Literal span1 = new Literal();
            span1.Text = "<span class=\"common_font\">" + list_menu[i].title_prof + "</span><br />";
            Place_stuff.Controls.Add(span1);

            Literal span2 = new Literal();
            span2.Text = "<span class=\"common_font\">" + list_menu[i].code_stuff + "</span><br />";
            Place_stuff.Controls.Add(span2);

            Literal span3 = new Literal();
            span3.Text = "<span class=\"common_font\">" + list_menu[i].pic_addr + "</span>";
            Place_stuff.Controls.Add(span3);

            Literal div1 = new Literal();
            div1.Text = "<div>";
            Place_stuff.Controls.Add(div1);



            drp_no.Items.Add("1");
            drp_no.Items.Add("2");
            drp_no.Items.Add("3");
            drp_no.Items.Add("4");
            drp_no.Items.Add("5");
            drp_no.Items.Add("6");
            drp_no.Items.Add("7");
            drp_no.Items.Add("8");
            drp_no.Items.Add("9");
            drp_no.Items.Add("10");
            drp_no.Width    = 75;
            drp_no.CssClass = "drp_sale";
            Place_stuff.Controls.Add(drp_no);

            btn_add.Text     = "اضافه به سبد";
            btn_add.Width    = 80;
            btn_add.CssClass = "btn_sale";
            btn_add.Click   += btn_add_Click;
            Place_stuff.Controls.Add(btn_add);

            Literal end_div = new Literal();
            end_div.Text = "</div></div></div>";
            Place_stuff.Controls.Add(end_div);
        }
    }
예제 #3
0
    protected void btn_add_Click1(object sender, EventArgs e)
    {
        tblPorfolioCollection list_code = new tblPorfolioCollection();

        list_code.ReadList(Cruder.Core.Criteria.NewCriteria(tblPorfolio.Columns.code_stuff, Cruder.Core.CriteriaOperators.Equal, Convert.ToInt32(txt_code.Text)));

        lbl_emplty.Visible = false;

        Label lbl = new Label();

        lbl.Text     = list_code[0].title_prof + " به لیست خرید اضافه شد";
        lbl.CssClass = "common_font";
        Place_update.Controls.Add(lbl);

        string text1 = Dns.GetHostName();
        //Response.Write("Host Name: " + text1 + "\r\nIP Adress:" + Dns.GetHostByName(text1).AddressList[0].ToString());

        //add to bascket sales list
        tblFactSale list = new tblFactSale();

        list.stuff_code = txt_code.Text;
        list.stuff_name = list_code[0].title_prof.ToString();
        list.stuff_nom  = ddl_no.Items[ddl_no.SelectedIndex].ToString();
        list.fact_code  = code_fact;
        list.saler      = Dns.GetHostByName(text1).AddressList[0].ToString();
        list.Create();

        //refresh page
        //Response.Redirect("order1.aspx");

        //add to place holder

        Literal lt1 = new Literal();

        lt1.Text = "<p class=\"common_font\">نام کالا: <span class=\"common_font\" style=\"color:Orange;\">" + list_code[0].title_prof.ToString() + "</span></p>";
        Place_bascket.Controls.Add(lt1);

        Literal lt2 = new Literal();

        lt2.Text = "<p class=\"common_font\">تعداد: <span style=\"color:Orange;\">" + ddl_no.Items[ddl_no.SelectedIndex].ToString() + "</span></p><hr />";
        Place_bascket.Controls.Add(lt2);

        Literal div1 = new Literal();

        div1.Text = "<div style=\"text-align:center;\">";
        Place_bascket.Controls.Add(div1);

        Literal div2 = new Literal();

        div2.Text = "</div>";
        Place_bascket.Controls.Add(div2);

        //clear data entry
        txt_code.Text        = "";
        ddl_no.SelectedIndex = 0;

        btn_goto.Visible = true;
    }
    protected void ASPxGridView1_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
    {
        tblPorfolioCollection lists = new tblPorfolioCollection();

        lists.ReadList(Cruder.Core.Criteria.NewCriteria(tblPorfolio.Columns.id_profolio, Cruder.Core.CriteriaOperators.Equal, e.Keys["id_profolio"]));

        lists[0].Delete();
        e.Cancel = true;
    }
예제 #5
0
    protected void btn_accept_Click(object sender, EventArgs e)
    {
        try
        {
            tblFactOn list_fact = new tblFactOn();

            list_fact.addr        = txt_addr.Text;
            list_fact.id_kharidar = 0;
            list_fact.amount      = 0;
            list_fact.date_fact   = DateTime.Now.ToShortDateString();
            list_fact.detail      = "_";
            list_fact.email       = txt_email.Text;
            list_fact.family      = txt_fname.Text;
            list_fact.name        = txt_name.Text;
            list_fact.ref_num     = "0";
            list_fact.res_num     = "0";
            list_fact.state       = "0";
            list_fact.tel         = txt_tel.Text;
            list_fact.mobile      = "0";

            list_fact.Create();

            // for save stuff forokhte shode dar table detailfact
            for (int i = 0; i < productID.Length; i++)
            {
                string[] pro;
                pro = productID[i].Split(sepdash);

                tblDetailStuff list_detail_fact = new tblDetailStuff();

                tblPorfolioCollection list2 = new tblPorfolioCollection();
                list2.ReadList(Criteria.NewCriteria(tblPorfolio.Columns.id_profolio, CriteriaOperators.Like, int.Parse(pro[0])));


                list_detail_fact.id_fact    = int.Parse(NoFact);
                list_detail_fact.id_stuff   = int.Parse(pro[0]);
                list_detail_fact.name_stuff = list2[0].title_prof;
                list_detail_fact.no_stuff   = int.Parse(pro[1]);
                list_detail_fact.pay_one    = Convert.ToInt32(list2[0].pic_addr);
                list_detail_fact.detail     = "-";

                list_detail_fact.Create();
            }


            Response.Redirect("invoice.aspx?n=" + NoFact);
        }
        catch (Exception)
        {
            //Response.Redirect("admin/sign-in.aspx");
        }
    }
 public static tblPorfolioCollection getStuff(string group)
 {
     ; tblPorfolioCollection list = new tblPorfolioCollection();
     list.ReadList(Criteria.NewCriteria(tblPorfolio.Columns.grp_stuff, CriteriaOperators.Like, group));
     if (list == null)
     {
         return(null);
     }
     else
     {
         return(list);
     }
 }
예제 #7
0
    public static tblPorfolioCollection getStuffBasket(int id)
    {
        tblPorfolioCollection list = new tblPorfolioCollection();

        list.ReadList(Criteria.NewCriteria(tblPorfolio.Columns.id_profolio, CriteriaOperators.Like, id));
        if (list == null)
        {
            return(null);
        }
        else
        {
            return(list);
        }
    }
    protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
    {
        tblPorfolioCollection lists = new tblPorfolioCollection();

        lists.ReadList(Cruder.Core.Criteria.NewCriteria(tblPorfolio.Columns.id_profolio, Cruder.Core.CriteriaOperators.Equal, e.Keys["id_profolio"]));

        lists[0].grp_stuff  = Convert.ToInt32(e.NewValues["grp_stuff"].ToString());
        lists[0].title_prof = e.NewValues["title_prof"].ToString();
        lists[0].detail     = e.NewValues["detail"].ToString();
        lists[0].code_stuff = Convert.ToInt32(e.NewValues["code_stuff"].ToString());
        lists[0].pic_addr   = e.NewValues["pic_addr"].ToString();
        lists.UpdateList(true);
        e.Cancel = true;
        ASPxGridView1.CancelEdit();
    }
예제 #9
0
    protected void lnk_natural_Click(object sender, EventArgs e)
    {
        tblPorfolioCollection list_menu = new tblPorfolioCollection();

        list_menu.ReadList(Cruder.Core.Criteria.NewCriteria(tblPorfolio.Columns.grp_stuff, Cruder.Core.CriteriaOperators.Equal, 3));

        Place_stuff.Controls.Clear();

        Literal header = new Literal();

        header.Text = "<h2 class=\"common_font\">عسل های طبیعی</h2>";
        Place_stuff.Controls.Add(header);

        for (int i = 0; i < list_menu.Count; i++)
        {
            Literal top = new Literal();
            top.Text = "<div style=\"width:270px;float:right;margin-right: 30px;\"><img class=\"box_shadows img_sales\" src=\"img/stuff/stuff1.jpg\"/><div style=\"line-height: 22px;\">";
            Place_stuff.Controls.Add(top);

            Literal span1 = new Literal();
            span1.Text = "<span class=\"common_font\">" + list_menu[i].title_prof + "</span><br />";
            Place_stuff.Controls.Add(span1);

            Literal span2 = new Literal();
            span2.Text = "<span class=\"common_font\" style=\"color: red;\"><span class=\"common_font\" style=\"color: black;\">کد کالا: </span> &nbsp; " + list_menu[i].code_stuff + " &nbsp; </span><br />";
            Place_stuff.Controls.Add(span2);

            Literal span3 = new Literal();
            span3.Text = "<span class=\"common_font\" style=\"color: orange;\"><span class=\"common_font\" style=\"color: black;\">قیمت: </span> &nbsp; " + list_menu[i].pic_addr + " &nbsp; </span>";
            Place_stuff.Controls.Add(span3);

            Literal div1 = new Literal();
            div1.Text = "<div style=\"margin-top: 25px;\">";
            Place_stuff.Controls.Add(div1);

            Literal end_div = new Literal();
            end_div.Text = "</div></div></div>";
            Place_stuff.Controls.Add(end_div);
        }
    }
예제 #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string text1 = Dns.GetHostName();

        tblFactSaleCollection list_fact = new tblFactSaleCollection();

        list_fact.ReadList(Cruder.Core.Criteria.NewCriteria(tblFactSale.Columns.saler, Cruder.Core.CriteriaOperators.Like, Dns.GetHostByName(text1).AddressList[0].ToString()));


        try
        {
            if (list_fact.Count > 0)
            {
                code_fact = list_fact[0].fact_code;
            }
            else
            {
                tblFactSaleCollection list_no_fact = tblFactSale.readall();
                if (list_no_fact.Count > 0)
                {
                    code_fact = list_no_fact[list_no_fact.Count - 1].fact_code.ToString();
                }
                code_fact = (Convert.ToInt32(code_fact) + 1).ToString();
            }
        }
        catch (Exception)
        {
            code_fact = "1";
        }

        //add stuff into basket place holder
        try
        {
            for (int i = 0; i < list_fact.Count; i++)
            {
                Literal lt1 = new Literal();
                lt1.Text = "<p class=\"common_font\">نام کالا: <span class=\"common_font\" style=\"color:Orange;\">" + list_fact[i].stuff_name + "</span></p>";
                Place_bascket.Controls.Add(lt1);

                Literal lt2 = new Literal();
                lt2.Text = "<p class=\"common_font\">تعداد: <span style=\"color:Orange;\">" + list_fact[i].stuff_nom + "</span></p><hr />";
                Place_bascket.Controls.Add(lt2);

                Literal div1 = new Literal();
                div1.Text = "<div style=\"text-align:center;\">";
                Place_bascket.Controls.Add(div1);

                Literal div2 = new Literal();
                div2.Text = "</div>";
                Place_bascket.Controls.Add(div2);
            }

            if (list_fact.Count < 1)
            {
                //Literal lbl_empty = new Literal();
                //lbl_empty.Text = "<p class=\"common_font\">لیست خالی است</p>";
                //Place_bascket.Controls.Add(lbl_empty);
                btn_goto.Visible = false;
            }
            else
            {
                lbl_emplty.Visible = false;
            }

            //first data
            tblPorfolioCollection list_menu = new tblPorfolioCollection();
            list_menu.ReadList(Cruder.Core.Criteria.NewCriteria(tblPorfolio.Columns.grp_stuff, Cruder.Core.CriteriaOperators.Equal, 1));

            Literal header = new Literal();
            header.Text = "<h2 class=\"common_font\">عسل های چند گیاه</h2>";
            Place_stuff.Controls.Add(header);

            for (int i = 0; i < list_menu.Count; i++)
            {
                Literal top = new Literal();
                top.Text = "<div style=\"width:270px;float:right;margin-right: 30px;\"><img class=\"box_shadows img_sales\" src=\"img/stuff/stuff1.jpg\"/><div style=\"line-height: 22px;\">";
                Place_stuff.Controls.Add(top);

                Literal span1 = new Literal();
                span1.Text = "<span class=\"common_font\">" + list_menu[i].title_prof + "</span><br />";
                Place_stuff.Controls.Add(span1);

                Literal span2 = new Literal();
                span2.Text = "<span class=\"common_font\" style=\"color: red;\"><span class=\"common_font\" style=\"color: black;\">کد کالا: </span> &nbsp; " + list_menu[i].code_stuff + " &nbsp; </span><br />";
                Place_stuff.Controls.Add(span2);

                Literal span3 = new Literal();
                span3.Text = "<span class=\"common_font\" style=\"color: orange;\"><span class=\"common_font\" style=\"color: black;\">قیمت: </span> &nbsp; " + list_menu[i].pic_addr + " &nbsp; </span>";
                Place_stuff.Controls.Add(span3);

                Literal div1 = new Literal();
                div1.Text = "<div style=\"margin-top: 25px;\">";
                Place_stuff.Controls.Add(div1);

                Literal end_div = new Literal();
                end_div.Text = "</div></div></div>";
                Place_stuff.Controls.Add(end_div);
            }
        }
        catch (Exception)
        {
        }
    }
예제 #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            tblFactOnCollection list_no = tblFactOn.readall();
            if (list_no.Count > 0)
            {
                NoFact = (list_no[list_no.Count - 1].id_fact + 1).ToString();
            }
            else
            {
                NoFact = "1";
            }

            no_fact.InnerText = NoFact;

            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);
                    tblPorfolioCollection listBasket = new tblPorfolioCollection();

                    totalPrice = 0;

                    string content = "<table border='0' cellpadding='0' cellspacing='0' class='table'>" +
                                     "<tr>" +
                                     "<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].pic_addr);

                            content += "<tr class='first_row' >" +
                                       "<td style='color:orange;'>" + (i + 1) + "</td>" +
                                       "<td>" + listBasket[j].title_prof.ToString() + "</td>" +
                                       "<td>" + price.ToString() + "تومان </td>" +

                                       "<td>0 تومان </td>" +
                                       "<td>" + pro[1] + "</td>" +
                                       "<td class='last_cell' style='text-align: left;'><a href='#' class='light-2' data-product-id='" + listBasket[j].id_profolio.ToString() + "' data-product-no='" + pro[1] + "' >حذف</a></td>" +
                                       "</tr>";
                            totalPrice += (price * int.Parse(pro[1]));
                        }
                    }
                    content += "<tr class='first_row'>" +
                               "<td colspan='2'>" + productID.Length + " محصول</td>" +
                               "<td colspan='5' style='text-align: center;' >جمع قابل پرداخت: <big style='color: red;'>" + totalPrice + " تومان</big></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' class='none_stuff'>کالایی موجود نمی باشد</td>" +
                                     "</tr>" +
                                     "</table>";
                showBasket.InnerHtml = err_content;
            }
        }
        catch (Exception)
        {
            showBasket.InnerText = "مشکل در برقراری ارتباط با پایگاه داده!";
        }

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

        btn_accept.Text     = "تایید اصلی";
        btn_accept.CssClass = "dark-2";
        btn_accept.Click   += btn_accept_Click;
        Ph_btn.Controls.Add(btn_accept);
        //}
        //catch (Exception)
        //{

        //}
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string                content   = "";
            tblGroupCollection    listGroup = tblGroup.readall();
            tblPorfolioCollection listStuff = new tblPorfolioCollection();

            if (listGroup == null)
            {
                block_accordeon.InnerText = "گروه بندی نشده!";
            }
            else
            {
                for (int i = 0; i < listGroup.Count; i++)
                {
                    listStuff = getStuff(listGroup[i].id_grp.ToString());

                    if (listGroup[i].name_grp.ToString() == "1")
                    {
                        content += "<div class='button_outer'><div class='button_inner'>" + "عسل های چند گیاه" + "</div></div>" +
                                   "<div class='accordeon_content'>";
                    }
                    else if (listGroup[i].name_grp.ToString() == "2")
                    {
                        content += "<div class='button_outer'><div class='button_inner'>" + "عسل های تک گیاه" + "</div></div>" +
                                   "<div class='accordeon_content'>";
                    }
                    else
                    {
                        content += "<div class='button_outer'><div class='button_inner'>" + "سایر محصولات" + "</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='img/stuff.jpg' alt='عکس لود نشد' class='box_shadows' style='padding: 2px;'></a>" +
                                   "</span>" +
                                   listStuff[j].title_prof + "<br />" +
                                   "قیمت : " + listStuff[j].pic_addr + "<br />" +
                                   "تعداد:<input name='count_stuffs_input_" + listStuff[j].id_profolio + "' type='text' value='1' disabled class='count-stuffs' />";

                        content += "<a href='#' class='dark-2 add2basket' data-product-id='" + listStuff[j].id_profolio.ToString() + "' style='pointer-events: none;' >اضافه به لیست خرید</a></p>";

                        content += "<hr style='height: 10px;' />";
                    }

                    content += "</div>";
                }

                block_accordeon.InnerHtml = content;
            }
        }
        catch (Exception)
        {
            block_accordeon.InnerText = "خطا در برقراری ارتباط با پایگاه داده!";
        }
    }
예제 #13
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();
            tblPorfolioCollection info_stuff = new tblPorfolioCollection();
            info_stuff.ReadList(Criteria.NewCriteria(tblPorfolio.Columns.id_profolio, CriteriaOperators.Like, stuff_id));

            new_content += info_stuff[0].id_profolio;

            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 = "http://shahdforoush.ir/resultbuy.aspx";
            TerminalIdTextBox.Text     = "1309976";
            UserNameTextBox.Text       = "shfd";
            UserPasswordTextBox.Text   = "shfd47";
        }
        //send data to the bank
        try
        {
            string result;

            BypassCertificateError();

            //BPService.PaymentGatewayImplService bpService = new BPService.PaymentGatewayImplService();
            ir.shaparak.bpm.PaymentGatewayImplService bpService = new ir.shaparak.bpm.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;
        }
    }