Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            person per = new person();

            per = (person)Session["person"];
            if (!IsPostBack)
            {
                if (per == null)
                {
                    if (Session["search"] != null)
                    {
                        Session["orderQuery"] = Request.RawUrl;
                        Response.Redirect("login.aspx");
                    }
                }
                if (Session["search"] == null)
                {
                    Response.Redirect("search.aspx");
                }
                TxtOrdEmail.Text = per.Email;
                TxtOrdName.Text  = per.FullName;
                TxtOrdPhone.Text = per.PhoneNumber;
                Company          = (string)Request["Comapny"];
                Car = (string)Request["CarId"];
                string   tot = GetOrder();
                string[] arr = GetTemplate(Company, int.Parse(Car)).Split('#');
                LtlMsg.Text  = "<script>var temp = JSON.parse(" + arr[0] + "\")\n var search = " + JsonConvert.SerializeObject((searchBLL)Session["search"]) + "</script>";
                LtlMsg1.Text = "<script>var extention = JSON.parse(\"" + arr[1] + ")</script>";
                LtlMsg2.Text = "<script>var cards = " + GetCreditCards() + "</script>";
                List <Extention> extentions = new List <Extention>();
                string           ext        = arr[1].Replace("\\", "");
                ext = ext.Substring(0, ext.Length - 1);
                DataTable table = new DataTable();
                table = JsonConvert.DeserializeObject <DataTable>(ext);
                foreach (DataRow row in table.Rows)
                {
                    extentions.Add(new Extention(int.Parse(row["id"].ToString()), row["description"].ToString(), int.Parse(row["Price"].ToString())));
                }
                rptExt.DataSource = extentions;
                rptExt.DataBind();
                CreateYearList();
            }
            else
            {
                Company = (string)Request["Comapny"];
                Car     = (string)Request["CarId"];
            }
            if (Request["id"] != null)
            {
                BtnOrder.Text = "שמור שינויים";
                double    o       = double.Parse(Request["id"]);
                double    orderId = o / 1825.8976;
                DataTable orderDt = GlobFuncs.getOrderDataByOrderId(int.Parse(orderId.ToString()));
                txtNotes.Text      = orderDt.Rows[0]["notes"].ToString();
                TxtOrdName.Text    = per.FullName;
                ltlExtInOrder.Text = "<script>var extInOrder =" + GlobFuncs.getExtByOrderId(orderId.ToString()) + "\n var creditCardInOrder = " + GlobFuncs.getCreditCardOfOrder(int.Parse(orderId.ToString())) + "</script>";
            }
        }