Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //קוד שרץ בעת טעינת הדף הראשונית
            if (!IsPostBack)
            {
                //בדיקה האם מדובר במשתמש רשום
                person per = new person();
                per = (person)Session["person"];
                if (per == null)
                {
                    Response.Redirect("/Reg.aspx");
                }

                //יצירת אובייקט הזמנות חדש
                List <order> orders = new List <order>();

                //מילוי נתונים ברפיטר של ההזמנות
                RptOrders.DataSource = GlobFuncs.getOrdersByCustomerId(per.CustomId);
                RptOrders.DataBind();

                //העברת נתונים לצד לקוח .כמות הזמנות. פרטי כרטיסי אשראי .הודעות. מספר לקוח
                ltlNo.Text = "<script>var numbers = " + RptOrders.Items.Count + "\n var creditCards = " + GlobFuncs.GetCreditCards(per.CustomId) + " \n let messages = " + GlobFuncs.getChathMasseges(per.CustomId) + " \n var customerOrders = " + GlobFuncs.getCustomerOrders(per.CustomId) + ";\n let allOrders = " + GlobFuncs.getOrdersByCustomerIdJson(per.CustomId) + "\n let searchs = " + GlobFuncs.getAllSearchesByUser(per.CustomId) + "</script>";

                //קבלת פרטי הלקוח והזנתו בשדות במסך
                Users us = GetUser(per.CustomId);
                TxtName.Text          = us.Name;
                TxtAddress.Text       = us.Address;
                TxtId.Text            = us.Id;
                TxtCity.Text          = GlobFuncs.getUnitValue(us.City, "CityId", "CityName", "CityTable");
                TxtDateOfBirth.Text   = us.BirthDay.Substring(6, 4) + "-" + us.BirthDay.Substring(3, 2) + "-" + us.BirthDay.Substring(0, 2);
                TxtLicenseNumber.Text = us.LicenseNumber;
                if (us.DateOfIssuanceLicense != null)
                {
                    TxtDateOfIssuanceLicense.Text = us.DateOfIssuanceLicense.Substring(6, 4) + "-" + us.DateOfIssuanceLicense.Substring(3, 2) + "-" + us.DateOfIssuanceLicense.Substring(0, 2);
                }
                DdlLicensCode.Text  = us.LicenseLevel.ToString();
                TxtPhone.Text       = us.Phone;
                TxtLicenseCode.Text = GlobFuncs.getUnitValue(us.LicenseLevel, "LicenseId", "LicenseName", "LicenseLevelTable");

                //יצירת רשימות נפתחות עבור ערים ודרגות רישיון
                ddlCity                     = GetDropDownList(ddlCity, "CityTable", "CityId", "CityName");
                DdlLicensCode               = GetDropDownList(DdlLicensCode, "LicenseLevelTable", "LicenseId", "LicenseName");
                ddlCity.SelectedValue       = us.City.ToString();
                DdlLicensCode.SelectedValue = us.LicenseLevel.ToString();

                //יצירת אובייקט כרטיסי אשראי
                creaditCardBLL creaditCard = new creaditCardBLL()
                {
                    customerId = per.CustomId
                };

                //הזנת פרטי כרטיס האשראי בתוך רפיטר של כרטיסי אשראי
                rptCards.DataSource = creaditCard.getCards();
                rptCards.DataBind();
            }
        }
Esempio n. 2
0
 //מתודה השומרת פרטי כרטיס אשראי חדשים
 protected void addCreditCard_Click(object sender, EventArgs e)
 {
     if (txtCradNumber.Text == "")
     {
         showErrorMwssage(1005);
     }
     else if (txtCardMonth.Text == "")
     {
         showErrorMwssage(2002);
     }
     else if (txtCardYear.Text == "")
     {
         showErrorMwssage(2003);
     }
     else if (txtCardCvv.Text == "")
     {
         showErrorMwssage(2004);
     }
     else if (txtOwnerId.Text == "")
     {
         showErrorMwssage(2005);
     }
     else
     {
         person per = new person();
         per = (person)Session["person"];
         creaditCardBLL creaditCard = new creaditCardBLL()
         {
             id         = GlobFuncs.createCreditCardId(),
             number     = txtCradNumber.Text,
             month      = txtCardMonth.Text,
             year       = txtCardYear.Text,
             digitNo    = txtCardCvv.Text,
             ownerId    = txtOwnerId.Text,
             customerId = per.CustomId
         };
         string txtCardId = creaditCard.AddCard();
         rptCards.DataSource = creaditCard.getCards();
         rptCards.DataBind();
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "hideModal", "hideAddCreditCardModal()", true);
         Response.Redirect("PrivateArea.aspx#CreditCards");
     }
 }