Exemplo n.º 1
0
        public void FillForm(RegistrationFormModels user)
        {
            /* this.WaitForLoad();
             * Thread.Sleep(1000);*/
            CustomerFirstName.SendKeys(user.CustomerFirstName);
            CustomerLastName.SendKeys(user.CustomerLastName);
            CustomerPassword.SendKeys(user.CustomerPassword);
            CustomerAddress.SendKeys(user.CustomerAddress);
            SelectElement years = new SelectElement(YearDD);

            years.SelectByValue(user.Year);
            SelectElement months = new SelectElement(MonthsDD);

            months.SelectByValue(user.Month);
            SelectElement days = new SelectElement(DaysDD);

            days.SelectByValue(user.Day);
            CustomerAddress.SendKeys(user.CustomerAddress);
            CustomerCity.SendKeys(user.CustomerCity);
            CustomerState.SendKeys(user.CustomerState);
            CustomerPostCode.SendKeys(user.CustomerPostCode);
            CustomerPhoneMobile.SendKeys(user.CustomerPhoneMobile);
            CustomerGender.Click();
            FindSubmitField.Click();
        }
Exemplo n.º 2
0
        public void Delete(CustomerCity ObjDelete)
        {
            var ObjToDelete = _context.CustomerCitys.SingleOrDefault(m => m.CompanyID == ObjDelete.CompanyID && m.CustomerCityID == ObjDelete.CustomerCityID);

            if (ObjToDelete != null)
            {
                _context.CustomerCitys.Remove(ObjToDelete);
            }
        }
Exemplo n.º 3
0
        public ActionResult AddNew()
        {
            var          userId   = User.Identity.GetUserId();
            var          UserInfo = _unitOfWork.User.GetMyInfo(userId);
            CustomerCity Obj      = new CustomerCity
            {
                CustomerCityID = _unitOfWork.CustomerCity.GetMaxSerial(UserInfo.fCompanyId)
            };

            return(PartialView(Obj));
        }
Exemplo n.º 4
0
        public void Update(CustomerCity ObjUpdate)
        {
            var ObjToUpdate = _context.CustomerCitys.FirstOrDefault(m => m.CompanyID == ObjUpdate.CompanyID && m.CustomerCityID == ObjUpdate.CustomerCityID);

            if (ObjToUpdate != null)
            {
                ObjToUpdate.ArabicName  = ObjUpdate.ArabicName;
                ObjToUpdate.EnglishName = ObjUpdate.EnglishName;
                ObjToUpdate.InsDateTime = ObjUpdate.InsDateTime;
                ObjToUpdate.InsUserID   = ObjUpdate.InsUserID;
            }
        }
Exemplo n.º 5
0
        public JsonResult UpdateCustomerCity(CustomerCity ObjUpdate)
        {
            MsgUnit Msg = new MsgUnit();

            try
            {
                var userId   = User.Identity.GetUserId();
                var UserInfo = _unitOfWork.User.GetMyInfo(userId);

                ObjUpdate.CompanyID   = UserInfo.fCompanyId;
                ObjUpdate.InsDateTime = DateTime.Now;
                ObjUpdate.InsUserID   = userId;
                if (String.IsNullOrEmpty(ObjUpdate.EnglishName))
                {
                    ObjUpdate.EnglishName = ObjUpdate.ArabicName;
                }

                if (!ModelState.IsValid)
                {
                    string Err    = " ";
                    var    errors = ModelState.Values.SelectMany(v => v.Errors);
                    foreach (ModelError error in errors)
                    {
                        Err = Err + error.ErrorMessage + " * ";
                    }

                    Msg.Msg  = Resources.Resource.SomthingWentWrong + " : " + Err;
                    Msg.Code = 0;
                    return(Json(Msg, JsonRequestBehavior.AllowGet));
                }
                _unitOfWork.CustomerCity.Update(ObjUpdate);
                _unitOfWork.Complete();

                Msg.Code = 1;
                Msg.Msg  = Resources.Resource.UpdatedSuccessfully;
                return(Json(Msg, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                Msg.Msg  = Resources.Resource.SomthingWentWrong + " : " + ex.Message.ToString();
                Msg.Code = 0;
                return(Json(Msg, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 6
0
        public List <CustomerCity> GetCustomersPerCity()
        {
            List <CustomerCity> customersPerCity = new List <CustomerCity>();

            using (SqlConnection connect = new SqlConnection(connectionString))
            {
                try
                {
                    connect.Open();
                    string querySql = "Select * from CustomerCity";
                    using (SqlCommand cmdCustomersPerCity = new SqlCommand(querySql, connect))
                    {
                        using (SqlDataReader customersPerCityReader = cmdCustomersPerCity.ExecuteReader())
                        {
                            while (customersPerCityReader.Read())
                            {
                                CustomerCity customerPerCity = new CustomerCity()
                                {
                                    CityName         = (string)customersPerCityReader["Name"],
                                    CustomersPerCity = (int)customersPerCityReader["Poleis"]//h8ele Nomoi edw dn kanw drop XD
                                };
                                customersPerCity.Add(customerPerCity);
                            }
                        }
                    }
                }
                catch (SqlException e)
                {
                    Console.WriteLine("SQL EXCEPTION", e.Message);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Exception", e.Message);
                }
                return(customersPerCity);
            }
        }
Exemplo n.º 7
0
 public void Add(CustomerCity ObjSave)
 {
     _context.CustomerCitys.Add(ObjSave);
 }
 public CustomerEntity(int Id, string Name, string Password, string Email, string Gender, string Address, CustomerCity City, long PhoneNumber)
 {
     this.Id          = Id;
     this.Name        = Name;
     this.Password    = Password;
     this.Email       = Email;
     this.Gender      = Gender;
     this.Address     = Address;
     this.City        = City;
     this.PhoneNumber = PhoneNumber;
 }