public IHttpActionResult GetAll(int page)
        {
            ICustomerManager mcust       = new ICustomerManager();
            DALCustomer      dalCustomer = new DALCustomer();

            var responseCustomer = new ResponseCustomer();

            responseCustomer.totalPaginas = mcust.Pagination();

            responseCustomer.customers = dalCustomer.GetProducts(page);

            return(Ok(responseCustomer));
        }
Example #2
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="model"></param>
        /// <param name="currentPage"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public ActionResult PageList(Customer model, int currentPage = 1, int pageSize = 20)
        {
            int             recordCount = 0;
            List <Customer> Customer    = new DALCustomer().QueryPagination(currentPage, pageSize, out recordCount, model).ToList();

            ViewBag.RecordCount = recordCount;
            ViewBag.CurrentPage = currentPage;
            ViewBag.PageSize    = pageSize;
            ViewBag.PageCount   = Math.Ceiling((double)recordCount / (double)pageSize);
            ViewBag.Model       = model;

            return(View(Customer));
        }
Example #3
0
        //Floating Lable Code End
        public OfferMySpace()
        {
            InitializeComponent();
            ShowLoading(true);
            txtPhoneNumber.Text = Convert.ToString(App.Current.Properties["PhoneNumber"]);
            dal_Offer           = new DALOfferMySpace();
            ShowLoading(false);
            dal_Customer = new DALCustomer();
            GetCompanyInfo();

            //Floating Lable Code Start
            lblName.TranslationX = lblPhoneNumber.TranslationX = lblEmail.TranslationX = lblOther.TranslationX = 10;
            lblName.FontSize     = lblPhoneNumber.FontSize = lblEmail.FontSize = lblOther.FontSize = _placeholderFontSize;
            lblName.TextColor    = lblPhoneNumber.TextColor = lblEmail.TextColor = lblOther.TextColor = Color.White;

            if (string.IsNullOrEmpty(txtName.Text))
            {
                TransitionToPlaceholder(true);
            }
            else
            {
                TransitionToTitle(true);
            }
            if (string.IsNullOrEmpty(txtPhoneNumber.Text))
            {
                TransitionToPlaceholder_PhoneNo(true);
            }
            else
            {
                TransitionToTitle_PhoneNo(true);
            }
            if (string.IsNullOrEmpty(txtEmail.Text))
            {
                TransitionToPlaceholder_Email(true);
            }
            else
            {
                TransitionToTitle_Email(true);
            }
            if (string.IsNullOrEmpty(txtOtherDetails.Text))
            {
                TransitionToPlaceholder_OtherDetails(true);
            }
            else
            {
                TransitionToTitle_OtherDetails(true);
            }

            txtName.Focus();
            //Floating Lable Code End
        }
Example #4
0
        public static Customer ReadCustomer(int id, ref List <string> errors)
        {
            if (id <= 0)
            {
                errors.Add("Invalid customer_id");
            }

            if (errors.Count > 0)
            {
                return(null);
            }

            return(DALCustomer.ReadCustomer(id, ref errors));
        }
        public ExtendSession(CustomerParkingSlotDetails customerParkingSlotDetails)
        {
            InitializeComponent();
            ShowLoading(true);
            objCustomerParkingSlotDetails = customerParkingSlotDetails;
            VehicleTypeID          = customerParkingSlotDetails.VehicleTypeID;
            CustomerID             = customerParkingSlotDetails.CustomerID;
            CustomerVehicleID      = customerParkingSlotDetails.CustomerVehicleID;
            CustomerParkingSlotID  = customerParkingSlotDetails.CustomerParkingSlotID;
            LocationParkingLotID   = customerParkingSlotDetails.LocationParkingLotID;
            LocationParkingLotName = customerParkingSlotDetails.LocationParkingLotName;
            dal_LocationParkingLot = new DALLocationParkingLots();
            dal_Customer           = new DALCustomer();
            dal_Vehicle            = new DALVehicle();
            dal_Pass = new DALPass();

            objCustomerParkingSlotDetails.LotOpenCloseTime = ("(" +
                                                              objCustomerParkingSlotDetails.LotOpeningTime + " - " +
                                                              objCustomerParkingSlotDetails.LotClosingTime + ")").ToLower();

            if (VehicleTypeID == Convert.ToInt32(VehicleTypeCodes.TwoWheelerTypeID))
            {
                imgVehicle.Source = "resource://InstaConsumer.Resources." + VehicleTypeCodes.TwoWheelerGreenSpots;
            }
            else if (VehicleTypeID == Convert.ToInt32(VehicleTypeCodes.FourWheelerTypeID))
            {
                imgVehicle.Source = "resource://InstaConsumer.Resources." + VehicleTypeCodes.FourWheelerGreenSpots;
            }

            this.BindingContext = objCustomerParkingSlotDetails;

            VehicleTypeID          = customerParkingSlotDetails.VehicleTypeID;
            CustomerID             = customerParkingSlotDetails.CustomerID;
            CustomerVehicleID      = customerParkingSlotDetails.CustomerVehicleID;
            RegistrationNumber     = customerParkingSlotDetails.RegistrationNumber;
            CustomerParkingSlotID  = customerParkingSlotDetails.CustomerParkingSlotID;
            LocationID             = customerParkingSlotDetails.LocationID;
            LocationParkingLotID   = customerParkingSlotDetails.LocationParkingLotID;
            LocationParkingLotName = customerParkingSlotDetails.LocationParkingLotName;
            dal_LocationParkingLot = new DALLocationParkingLots();
            dal_Customer           = new DALCustomer();
            dal_Vehicle            = new DALVehicle();
            dal_Pass = new DALPass();

            ParkingBayRange = customerParkingSlotDetails.ParkingBayRange;
            ParkingBayID    = customerParkingSlotDetails.ParkingBayID;
            Duration        = 1;
            IsFullDay       = false;
            ShowLoading(false);
        }
Example #6
0
        public BuyAPass(OCustomerVehicle obj_OCustomerVehicle)
        {
            InitializeComponent();
            ShowLoading(true);
            dal_Pass                = new DALPass();
            dal_Vehicle             = new DALVehicle();
            dal_Customer            = new DALCustomer();
            dal_LocationParkingLots = new DALLocationParkingLots();

            objOCustomerVehicle = obj_OCustomerVehicle;
            VehicleTypeID       = obj_OCustomerVehicle.VehicleTypeID;
            LocationID          = obj_OCustomerVehicle.LocationID;
            CustomerID          = obj_OCustomerVehicle.CustomerID;

            ShowLoading(false);
        }
Example #7
0
 private void CustomerForm_Load(object sender, EventArgs e)
 {
     ShowLoading("Loading", "Fetching customer information from db");
     DALCustomer.GetCustomerById(CustomerId, (customer) =>
     {
         Invoke(new Action(() =>
         {
             originalFirstName = customer.FirstName;
             originalLastName  = customer.LastName;
             tbFirstName.Text  = customer.FirstName;
             tbLastName.Text   = customer.LastName;
             HideLoading();
             this.Enabled = true;
         }));
     }, (ex) => ShowErrorFromAnOtherThread(ex, () => { DialogResult = DialogResult.OK; }));
 }
Example #8
0
        /// <summary>
        /// 添加/修改保存
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult Save(Customer model)
        {
            ResultMsg msg = new ResultMsg();

            //修改
            if (model.Rid > 0)
            {
                msg = new DALCustomer().Update(model);
            }
            //添加
            else if (model.Rid == 0)
            {
                msg = new DALCustomer().Insert(model);
            }

            return(Json(new { Success = msg.Success, Result = msg.ReturnInt, ErrMsg = msg.ErrMsg }));
        }
        public void InsertOTP()
        {
            IsOnline = VerifyInternet();
            if (IsOnline)
            {
                OTPVerification objOTP = new OTPVerification();
                objOTP.PhoneNumber = PhoneNumber;
                objOTP.OTP         = random_number;
                objOTP.StartTime   = DateTime.Now;
                objOTP.ExpiryTime  = DateTime.Now.AddMinutes(5);
                objOTP.Status      = Convert.ToInt32(1);
                objOTP.CreatedBy   = CustomerID;

                if (App.Current.Properties.ContainsKey("RefreshedToken"))
                {
                    objOTP.DeviceID = Convert.ToString(App.Current.Properties["RefreshedToken"]).Trim();
                }
                else
                {
                    objOTP.DeviceID = "";
                }

                if (App.Current.Properties.ContainsKey("apitoken"))
                {
                    var json    = JsonConvert.SerializeObject(objOTP);
                    var content = new StringContent(json, Encoding.UTF8, "application/json");
                    dal_Customer = new DALCustomer();
                    OTPVerification resultObj = dal_Customer.InsertOTP(Convert.ToString(App.Current.Properties["apitoken"]), objOTP);

                    if (resultObj.OTPVerificationID != 0)
                    {
                        OTPVerificationID = resultObj.OTPVerificationID;
                    }
                    else
                    {
                        DisplayAlert("", "Failed to generate OTP", "Ok");
                    }
                }
            }
            else
            {
                DisplayAlert("", "Please check your network connectivity", "Ok");
                return;
            }
        }
        public int insertCustomer(Customer c)
        {
            DALCustomer customer = new DALCustomer();

            return(customer.insert(c));
        }
 //新增用户
 public static bool BLLAddCustomer(MODCustomer customer)
 {
     return(DALCustomer.DALInsertCustomer(customer));
 }
 //编辑更新
 public static bool Uptade(MODCustomer modcustomer)
 {
     return(DALCustomer.Uptade(modcustomer));
 }
 //查询所有用户信息
 public static List <MODCustomer> BLLSelectCustomerAll()
 {
     //查询用户信息
     return(DALCustomer.DALSelectCustomerAll());
 }
 //查询用户
 public static bool BLLSelectCustomer(string Login, string Pwd)
 {
     //查询用户信息
     return(DALCustomer.DALSelectCustomer(Login, Pwd));
 }
        public RazorPayment(CustomerParkingSlot customerParkingSlot, CustomerVehiclePass customerVehiclePass)
        {
            InitializeComponent();
            dal_Customer            = new DALCustomer();
            dal_Pass                = new DALPass();
            obj_CustomerParkingSlot = customerParkingSlot;
            obj_CustomerVehiclePass = customerVehiclePass;

            if (App.Current.Properties.ContainsKey("UserName"))
            {
                UserName = Convert.ToString(App.Current.Properties["UserName"]);
            }
            if (App.Current.Properties.ContainsKey("Email"))
            {
                Email = Convert.ToString(App.Current.Properties["Email"]);
            }
            if (App.Current.Properties.ContainsKey("PhoneNumber"))
            {
                PhoneNumber = Convert.ToString(App.Current.Properties["PhoneNumber"]);
            }

            if (obj_CustomerParkingSlot != null && obj_CustomerVehiclePass == null)
            {
                string Source = "http://35.202.198.25:81/RazorPayAPI/Payment.aspx?" +
                                "name=" + UserName + "" +
                                "&email=" + Email +
                                "&contact=" + PhoneNumber + "" +
                                "&description=" + Convert.ToString(obj_CustomerParkingSlot.LocationParkingLotName) +
                                "&amount=" + Convert.ToString(obj_CustomerParkingSlot.PaidAmount) +
                                "&receiptID=" + 0 + "";

                CookieContainer cookieContainer = new CookieContainer();
                Uri             uri             = new Uri(Source, UriKind.RelativeOrAbsolute);

                Cookie cookie = new Cookie
                {
                    Name    = "CustomerID",
                    Expires = DateTime.Now.AddDays(1),
                    Value   = Convert.ToString(obj_CustomerParkingSlot.CustomerID),
                    Domain  = uri.Host,
                    Path    = "/"
                };
                cookieContainer.Add(uri, cookie);
                webView.Cookies = cookieContainer;
                webView.Source  = new UrlWebViewSource {
                    Url = uri.ToString()
                };
            }
            else if (obj_CustomerParkingSlot == null && obj_CustomerVehiclePass != null)
            {
                string Source = "http://35.202.198.25:81/RazorPayAPI/Payment.aspx?" +
                                "name=" + UserName + "" +
                                "&email=" + Email +
                                "&contact=" + PhoneNumber + "" +
                                "&description=" + Convert.ToString(obj_CustomerVehiclePass.StationAccess) +
                                "&amount=" + Convert.ToString(obj_CustomerVehiclePass.TotalAmount + obj_CustomerVehiclePass.PaidDueAmount) +
                                "&receiptID=" + 0 + "";

                CookieContainer cookieContainer = new CookieContainer();
                Uri             uri             = new Uri(Source, UriKind.RelativeOrAbsolute);

                Cookie cookie = new Cookie
                {
                    Name    = "CustomerID",
                    Expires = DateTime.Now.AddDays(1),
                    Value   = Convert.ToString(obj_CustomerVehiclePass.CustomerID),
                    Domain  = uri.Host,
                    Path    = "/"
                };
                cookieContainer.Add(uri, cookie);
                webView.Cookies = cookieContainer;
                webView.Source  = new UrlWebViewSource {
                    Url = uri.ToString()
                };
            }
        }
        private async void btn_SendOTPClicked(object sender, EventArgs e)
        {
            btnSendOTP.IsVisible = false;
            ShowLoading(true);

            if (txtName.Text == "" || txtName.Text == null)
            {
                btnSendOTP.IsVisible = true;
                ShowLoading(false);
                DisplayAlert("", "Please enter your Name", "Ok");
                return;
            }

            var regexName = new Regex("^[a-z A-Z]*$");

            if (!regexName.IsMatch(txtName.Text.Trim()))
            {
                btnSendOTP.IsVisible = true;
                ShowLoading(false);
                DisplayAlert("", "Please enter only alphabets for Name", "Ok");
                return;
            }

            if (txtPhoneNumber.Text == "" || txtPhoneNumber.Text == null)
            {
                btnSendOTP.IsVisible = true;
                ShowLoading(false);
                DisplayAlert("", "Please enter your Phone Number", "Ok");
                return;
            }

            if (txtEmail.Text == "" || txtEmail.Text == null)
            {
                btnSendOTP.IsVisible = true;
                ShowLoading(false);
                DisplayAlert("", "Please enter your Email", "Ok");
                return;
            }

            if (txtName.Text.Length >= 3 && txtName.Text.Length <= 20)
            {
                if (txtEmail.Text != "" && txtEmail.Text != null)
                {
                    if (!RegexUtilities.IsEmailValid(txtEmail.Text.Trim()))
                    {
                        btnSendOTP.IsVisible = true;
                        ShowLoading(false);
                        DisplayAlert("", "Please enter valid Email", "Ok");
                        return;
                    }
                }

                Customer objCustomer = new Customer();
                objCustomer.CustomerID  = CustomerID;
                objCustomer.Name        = txtName.Text.Trim();
                objCustomer.Email       = txtEmail.Text == null || txtEmail.Text == "" ? "" : txtEmail.Text.Trim();
                objCustomer.PhoneNumber = txtPhoneNumber.Text.Trim();
                objCustomer.Gender      = Gender_static;

                if (App.Current.Properties.ContainsKey("RefreshedToken"))
                {
                    btnSendOTP.IsVisible = true;
                    objCustomer.DeviceID = Convert.ToString(App.Current.Properties["RefreshedToken"]);
                }
                else
                {
                    btnSendOTP.IsVisible = true;
                    objCustomer.DeviceID = "";
                }

                if (txtYearOfBirth.Text != "" && txtYearOfBirth.Text != null)
                {
                    if (Convert.ToInt32(txtYearOfBirth.Text.Trim()) > 1900)
                    {
                        DateTime dateOfBirth = new DateTime(Convert.ToInt32(txtYearOfBirth.Text.Trim()), DateTime.Now.Month, 1);
                        objCustomer.DateOfBirth = dateOfBirth;
                        objCustomer.Age         = Convert.ToInt32(DateTime.Now.Year) - Convert.ToInt32(txtYearOfBirth.Text.Trim());
                    }
                    else
                    {
                        btnSendOTP.IsVisible = true;
                        ShowLoading(false);
                        DisplayAlert("", "Only people born after 1900 please! Enter your Year of Birth", "Ok");
                        return;
                    }
                }
                else
                {
                    objCustomer.DateOfBirth = null;
                    objCustomer.Age         = 0;
                }

                if (App.Current.Properties.ContainsKey("apitoken"))
                {
                    var json    = JsonConvert.SerializeObject(objCustomer);
                    var content = new StringContent(json, Encoding.UTF8, "application/json");
                    dal_Customer = new DALCustomer();
                    OCustomer resultObj = dal_Customer.InsertCustomer(Convert.ToString(App.Current.Properties["apitoken"]), objCustomer);

                    if (resultObj.CustomerID != 0)
                    {
                        btnSendOTP.IsVisible = true;
                        ShowLoading(false);
                        await Application.Current.SavePropertiesAsync();

                        await Navigation.PushAsync(new VerifyOTP(txtPhoneNumber.Text, resultObj.CustomerID, "NEW", txtName.Text));
                    }
                    else
                    {
                        btnSendOTP.IsVisible = true;
                        ShowLoading(false);
                        DisplayAlert("Failed - InsertCustomer", "Insert customer failed", "Ok");
                    }
                }
                else
                {
                    btnSendOTP.IsVisible = true;
                    ShowLoading(false);
                }
            }
            else
            {
                btnSendOTP.IsVisible = true;
                ShowLoading(false);
                DisplayAlert("", "Name must be atleast 3 characters and maximum 20 characters", "Ok");
            }
        }
        private async void btn_ProceedClicked(object sender, EventArgs e)
        {
            btnProceed.IsVisible = false;
            ShowLoading(true);
            IsOnline = VerifyInternet();
            if (IsOnline)
            {
                if (txtPhoneNumber.Text != "" && txtPhoneNumber.Text != null)
                {
                    if (txtPhoneNumber.Text.Length != 10)
                    {
                        btnProceed.IsVisible = true;
                        ShowLoading(false);
                        DisplayAlert("", "Please enter valid Phone Number", "Ok");
                        return;
                    }

                    Customer objCustomer = new Customer();
                    objCustomer.PhoneNumber = txtPhoneNumber.Text;

                    // Remove Code

                    using (HttpClient client = new HttpClient())
                    {
                        client.BaseAddress = new Uri(Convert.ToString(App.Current.Properties["BaseURL"]));
                        // We want the response to be JSON.
                        client.DefaultRequestHeaders.Accept.Clear();
                        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                        List <KeyValuePair <string, string> > postData = new List <KeyValuePair <string, string> >();
                        postData.Add(new KeyValuePair <string, string>("grant_type", "password"));
                        postData.Add(new KeyValuePair <string, string>("username", "Kiran"));
                        postData.Add(new KeyValuePair <string, string>("password", "1234"));
                        FormUrlEncodedContent content = new FormUrlEncodedContent(postData);
                        // Post to the Server and parse the response.
                        var response = client.PostAsync("Token", content).Result;
                        if (response.IsSuccessStatusCode)
                        {
                            var        jsonString   = response.Content.ReadAsStringAsync();
                            OAuthToken responseData = JsonConvert.DeserializeObject <OAuthToken>(jsonString.Result);
                            string     Access_Token = responseData.access_token;
                            App.Current.Properties["apitoken"] = Access_Token;
                        }
                    }

                    // Remove Code

                    if (App.Current.Properties.ContainsKey("apitoken"))
                    {
                        var json    = JsonConvert.SerializeObject(objCustomer);
                        var content = new StringContent(json, Encoding.UTF8, "application/json");
                        dal_Customer = new DALCustomer();
                        OCustomer resultObj = dal_Customer.ValidateCustomer(Convert.ToString(App.Current.Properties["apitoken"]), objCustomer);

                        if (resultObj.CustomerID != 0)
                        {
                            btnProceed.IsVisible = true;
                            ShowLoading(false);
                            await Navigation.PushAsync(new VerifyOTP(txtPhoneNumber.Text, resultObj.CustomerID, "EXISTING", resultObj.Name));
                        }
                        else
                        {
                            btnProceed.IsVisible = true;
                            ShowLoading(false);
                            await Navigation.PushAsync(new SignUp(resultObj.CustomerID, txtPhoneNumber.Text));
                        }
                    }
                    else
                    {
                        btnProceed.IsVisible = true;
                        ShowLoading(false);
                    }
                }
                else
                {
                    btnProceed.IsVisible = true;
                    ShowLoading(false);
                    DisplayAlert("", "Please enter your Phone Number", "Ok");
                }
            }
            else
            {
                await DisplayAlert("", "Please check your network connectivity", "Ok");

                return;
            }
        }
 public Notification(int CustomerID)
 {
     InitializeComponent();
     dal_Customer = new DALCustomer();
     GetNotificationsByCustomerID(CustomerID);
 }
        private async void btn_UpdateClicked(object sender, EventArgs e)
        {
            IsOnline = VerifyInternet();

            if (IsOnline)
            {
                btnUpdate.IsVisible = false;
                ShowLoading(true);

                try
                {
                    if (txtName.Text == "" || txtName.Text == null)
                    {
                        btnUpdate.IsVisible = true;
                        ShowLoading(false);
                        DisplayAlert("", "Please enter your Name", "Ok");
                        return;
                    }

                    var regexName = new Regex("^[a-z A-Z]*$");
                    if (!regexName.IsMatch(txtName.Text.Trim()))
                    {
                        btnUpdate.IsVisible = true;
                        ShowLoading(false);
                        DisplayAlert("", "Please enter only alphabets for Name", "Ok");
                        return;
                    }

                    if (txtPhoneNumber.Text == "" || txtPhoneNumber.Text == null)
                    {
                        btnUpdate.IsVisible = true;
                        ShowLoading(false);
                        DisplayAlert("", "Please enter your Phone Number", "Ok");
                        return;
                    }

                    if (txtEmail.Text == "" || txtEmail.Text == null)
                    {
                        btnUpdate.IsVisible = true;
                        ShowLoading(false);
                        DisplayAlert("", "Please enter your Email", "Ok");
                        return;
                    }

                    if (txtName.Text.Length >= 3 && txtName.Text.Length <= 20)
                    {
                        if (txtEmail.Text != "" && txtEmail.Text != null)
                        {
                            if (!RegexUtilities.IsEmailValid(txtEmail.Text.Trim()))
                            {
                                btnUpdate.IsVisible = true;
                                ShowLoading(false);
                                DisplayAlert("", "Please enter valid Email", "Ok");
                                return;
                            }
                        }
                        Customer objCustomer = new Customer();
                        objCustomer.CustomerID  = CustomerID;
                        objCustomer.Name        = txtName.Text.Trim();
                        objCustomer.Email       = txtEmail.Text == null || txtEmail.Text == "" ? "" : txtEmail.Text.Trim();
                        objCustomer.PhoneNumber = txtPhoneNumber.Text.Trim();
                        objCustomer.Gender      = Gender_static;

                        if (imgCameraByteData != null)
                        {
                            objCustomer.ProfileImage = ByteArrayCompressionUtility.Compress(imgCameraByteData);
                        }

                        if (App.Current.Properties.ContainsKey("RefreshedToken"))
                        {
                            btnUpdate.IsVisible  = true;
                            objCustomer.DeviceID = Convert.ToString(App.Current.Properties["RefreshedToken"]);
                        }
                        else
                        {
                            btnUpdate.IsVisible  = true;
                            objCustomer.DeviceID = "";
                        }

                        if (txtYearOfBirth.Text != "" && txtYearOfBirth.Text != null)
                        {
                            if (Convert.ToInt32(txtYearOfBirth.Text.Trim()) > 1900)
                            {
                                DateTime dateOfBirth = new DateTime(Convert.ToInt32(txtYearOfBirth.Text.Trim()), DateTime.Now.Month, 1);
                                objCustomer.DateOfBirth = dateOfBirth;
                                objCustomer.Age         = Convert.ToInt32(DateTime.Now.Year) - Convert.ToInt32(txtYearOfBirth.Text.Trim());
                            }
                            else
                            {
                                btnUpdate.IsVisible = true;
                                ShowLoading(false);
                                DisplayAlert("", "Only people born after 1900 please! Enter your Year of Birth", "Ok");
                                return;
                            }
                        }
                        else
                        {
                            objCustomer.DateOfBirth = null;
                            objCustomer.Age         = 0;
                        }

                        if (App.Current.Properties.ContainsKey("apitoken"))
                        {
                            var json    = JsonConvert.SerializeObject(objCustomer);
                            var content = new StringContent(json, Encoding.UTF8, "application/json");
                            dal_Customer = new DALCustomer();
                            OCustomer resultObj = new OCustomer();

                            await Task.Run(() =>
                            {
                                resultObj = dal_Customer.UpdateCustomer(Convert.ToString(App.Current.Properties["apitoken"]), objCustomer);
                            });

                            if (resultObj.CustomerID != 0)
                            {
                                App.Current.Properties["UserName"]     = txtName.Text.Trim();
                                App.Current.Properties["PhoneNumber"]  = txtPhoneNumber.Text.Trim();
                                App.Current.Properties["Email"]        = txtEmail.Text.Trim();
                                App.Current.Properties["CustomerID"]   = resultObj.CustomerID;
                                App.Current.Properties["ProfileImage"] = resultObj.ProfileImage;
                                await Application.Current.SavePropertiesAsync();

                                int CustomerID = resultObj.CustomerID;
                                App.Current.Properties["CustomerID"] = CustomerID;

                                btnUpdate.IsVisible = true;
                                ShowLoading(false);
                                await Navigation.PushAsync(new Home(null, CustomerID));
                            }
                            else
                            {
                                btnUpdate.IsVisible = true;
                                ShowLoading(false);
                                DisplayAlert("Failed - UpdateCustomer", "Update Customer Failed", "Ok");
                            }
                        }
                        else
                        {
                            btnUpdate.IsVisible = true;
                            ShowLoading(false);
                        }
                    }
                    else
                    {
                        btnUpdate.IsVisible = true;
                        ShowLoading(false);
                        DisplayAlert("", "Name must be atleast 3 characters and maximum 20 characters", "Ok");
                    }
                }
                catch (Exception ex)
                {
                    btnUpdate.IsVisible = true;
                    ShowLoading(false);
                    DisplayAlert("Failed - ", "Failed To Update Details", "Ok");
                }
            }
            else
            {
                await DisplayAlert("", "Please check your network connectivity", "Ok");

                return;
            }
        }
        public SessionHomeReceipt(CustomerParkingSlotDetails customerParkingSlotDetails)
        {
            this.IsBusy = true;
            InitializeComponent();
            dal_Customer           = new DALCustomer();
            dal_LocationParkingLot = new DALLocationParkingLots();

            if (customerParkingSlotDetails != null)
            {
                objCustomerParkingSlotDetails = customerParkingSlotDetails;
                lblLotName.Text = customerParkingSlotDetails.ApplicationTypeID == Convert.ToInt32(App.Current.Properties["PassApplicationTypeID"]) ? customerParkingSlotDetails.LocationParkingLotName + " - PASS CHECK IN" : customerParkingSlotDetails.LocationParkingLotName;
                lblAddress.Text = customerParkingSlotDetails.Address;
                lblFrom.Text    = customerParkingSlotDetails.From.ToString("d MMM yyyy, hh:mm tt", CultureInfo.CreateSpecificCulture("en-US"));
                lblTo.Text      = customerParkingSlotDetails.To.ToString("d MMM yyyy, hh:mm tt", CultureInfo.CreateSpecificCulture("en-US"));
                string fromdatesplit = lblFrom.Text.Split(',')[0];
                string fromtimesplit = lblFrom.Text.Split(',')[1];
                lblFrom.Text     = fromdatesplit;
                lblFromTime.Text = fromtimesplit;
                string toDatesplit = lblTo.Text.Split(',')[0];
                string toTimesplit = lblTo.Text.Split(',')[1];
                lblTo.Text                 = toDatesplit;
                lblToTime.Text             = toTimesplit;
                lblRegistrationNumber.Text = customerParkingSlotDetails.RegistrationNumber;
                lblModel.Text              = customerParkingSlotDetails.Model;

                App.Current.Properties["CustomerParkingSlotID"] = customerParkingSlotDetails.CustomerParkingSlotID;
                App.Current.Properties["UserName"]     = customerParkingSlotDetails.CustomerName;
                App.Current.Properties["PhoneNumber"]  = customerParkingSlotDetails.CustomerPhoneNumber;
                App.Current.Properties["Email"]        = customerParkingSlotDetails.CustomerEmail;
                App.Current.Properties["CustomerID"]   = customerParkingSlotDetails.CustomerID;
                App.Current.Properties["ProfileImage"] = customerParkingSlotDetails.CustomerProfileImage;

                if (customerParkingSlotDetails.ApplicationTypeID == Convert.ToInt32(App.Current.Properties["PassApplicationTypeID"]))
                {
                    stkParkingFee.IsVisible  = false;
                    lblLotName.HeightRequest = 45;
                }
                else
                {
                    stkParkingFee.IsVisible = true;
                    // lblLotName.HeightRequest = 10;
                    lblParkingFee.Text = customerParkingSlotDetails.PaidAmount;

                    TimeSpan t_duration = (customerParkingSlotDetails.To - customerParkingSlotDetails.From);
                    int      d_duration = Convert.ToInt32(Math.Round(t_duration.TotalHours));

                    lblPaymentType.Text = " Paid for " + d_duration + " hour (Via " + customerParkingSlotDetails.PaymentTypeName + ")";
                }

                OrderID.Text      = "ID : #" + customerParkingSlotDetails.CustomerParkingSlotID;
                imgVehicle.Source = customerParkingSlotDetails.VehicleImage;
                currentTime       = DateTime.Now;
                ActualEndTime     = Convert.ToDateTime(customerParkingSlotDetails.To);

                DisabledParking.Source = customerParkingSlotDetails.DisabledParking;
                EvCharging.Source      = customerParkingSlotDetails.EvCharging;
                CoveredParking.Source  = customerParkingSlotDetails.CoveredParking;
                BikeWash.Source        = customerParkingSlotDetails.BikeWash;
                CarWash.Source         = customerParkingSlotDetails.CarWash;
                Mechanic.Source        = customerParkingSlotDetails.Mechanic;

                lblWarning.Text     = "'" + Convert.ToString(customerParkingSlotDetails.ViolationWarningCount) + "' Warning(s) Completed";
                lblOverStayFee.Text = customerParkingSlotDetails.Price == 0 ? "0" : Convert.ToString(decimal.Truncate(customerParkingSlotDetails.Price));
                lblClampFee.Text    = customerParkingSlotDetails.ClampFee == 0 ? "0" : Convert.ToString(decimal.Truncate(customerParkingSlotDetails.ClampFee));
                lblTotal.Text       = Convert.ToDecimal(customerParkingSlotDetails.Price) + Convert.ToDecimal(customerParkingSlotDetails.ClampFee) == 0 ? "0" :
                                      Convert.ToString(decimal.Truncate((Convert.ToDecimal(customerParkingSlotDetails.Price) + Convert.ToDecimal(customerParkingSlotDetails.ClampFee))));
                lblClampReason.Text = customerParkingSlotDetails.ClampReason;

                if (customerParkingSlotDetails.IsClamp)
                {
                    stkSupervisor.IsVisible   = true;
                    stkClampWarning.IsVisible = true;
                    IsClamp = customerParkingSlotDetails.IsClamp;
                    SupervisorPhoneNumber = customerParkingSlotDetails.PhoneNumber;
                    lblSupervisor.Text    = customerParkingSlotDetails.SupervisorName;
                    lblPhoneNumber.Text   = customerParkingSlotDetails.PhoneNumber;
                }

                if (ActualEndTime < currentTime)
                {
                    lblSpotExpiry.Text     = "Spot Expired At";
                    lblExpiryTime.Text     = customerParkingSlotDetails.To.ToString("d MMM yyyy, hh:mm tt", CultureInfo.CreateSpecificCulture("en-US"));
                    lblExpiryTime.FontSize = 20;
                }
                else
                {
                    TimeSpan duration      = ActualEndTime - currentTime;
                    long     durationTicks = Math.Abs(duration.Ticks / TimeSpan.TicksPerMillisecond);
                    long     hours         = durationTicks / (1000 * 60 * 60);
                    long     minutes       = (durationTicks - (hours * 60 * 60 * 1000)) / (1000 * 60);

                    lblExpiryTime.Text = hours.ToString("00 h") + " : " + minutes.ToString("00 m");
                }

                Device.StartTimer(TimeSpan.FromSeconds(60), (Func <bool>)(() =>
                {
                    currentTime = DateTime.Now;
                    if (ActualEndTime < currentTime)
                    {
                        lblSpotExpiry.Text     = "Spot Expired At";
                        lblExpiryTime.Text     = customerParkingSlotDetails.To.ToString("d MMM yyyy, hh:mm tt", CultureInfo.CreateSpecificCulture("en-US"));
                        lblExpiryTime.FontSize = 20;
                        return(false);
                    }
                    else
                    {
                        TimeSpan duration  = ActualEndTime - currentTime;
                        long durationTicks = Math.Abs(duration.Ticks / TimeSpan.TicksPerMillisecond);
                        long hours         = durationTicks / (1000 * 60 * 60);
                        long minutes       = (durationTicks - (hours * 60 * 60 * 1000)) / (1000 * 60);

                        lblExpiryTime.Text = hours.ToString("00 h") + " : " + minutes.ToString("00 m");
                    }
                    return(true); // True = Repeat again, False = Stop the timer
                }));

                GenerateAPIToken();
                this.IsBusy = false;
            }
        }
        private async void btn_VerifyOTPClicked(object sender, EventArgs e)
        {
            IsOnline = VerifyInternet();
            if (IsOnline)
            {
                btnVerify.IsVisible = false;
                ShowLoading(true);

                if ((OTP1.Text != "" && OTP1.Text != null) && (OTP2.Text != "" && OTP2.Text != null) &&
                    (OTP3.Text != "" && OTP3.Text != null) && (OTP4.Text != "" && OTP4.Text != null))
                {
                    OTPVerification objOTP = new OTPVerification();
                    objOTP.OTPVerificationID = OTPVerificationID;
                    objOTP.PhoneNumber       = PhoneNumber;
                    objOTP.OTP        = OTP1.Text + OTP2.Text + OTP3.Text + OTP4.Text;
                    objOTP.ExpiryTime = DateTime.Now;
                    objOTP.CreatedBy  = CustomerID;

                    if (App.Current.Properties.ContainsKey("apitoken"))
                    {
                        var json    = JsonConvert.SerializeObject(objOTP);
                        var content = new StringContent(json, Encoding.UTF8, "application/json");
                        dal_Customer = new DALCustomer();
                        OTPVerification resultObj = dal_Customer.VerifyOTP(Convert.ToString(App.Current.Properties["apitoken"]), objOTP);

                        if (resultObj.OTPVerificationID != 0)
                        {
                            CustomerID = resultObj.CustomerID;
                            App.Current.Properties["CustomerID"]   = Convert.ToString(resultObj.CustomerID);
                            App.Current.Properties["UserName"]     = Convert.ToString(resultObj.Name);
                            App.Current.Properties["PhoneNumber"]  = Convert.ToString(PhoneNumber);
                            App.Current.Properties["Email"]        = Convert.ToString(resultObj.Email);
                            App.Current.Properties["ProfileImage"] = resultObj.ProfileImage;
                            ShowLoading(false);
                            //GetListOfCustomerVehicles();

                            if (NewORExisting == "EXISTING")
                            {
                                DisplayAlert("", "Welcome back " + Name + "! Thank you for using Instaparking", "Ok");
                            }
                            //await Navigation.PushAsync(new MasterPage(objLocationParkingLotFilter));
                            await Navigation.PushAsync(new Home(null, CustomerID));
                        }
                        else
                        {
                            btnVerify.IsVisible = true;
                            ShowLoading(false);
                            DisplayAlert("", "Please enter valid OTP", "Ok");
                        }
                    }
                    else
                    {
                        btnVerify.IsVisible = true;
                        ShowLoading(false);
                    }
                }
                else
                {
                    btnVerify.IsVisible = true;
                    ShowLoading(false);
                    DisplayAlert("", "Please enter OTP sent to " + PhoneNumber + "", "Ok");
                }
            }
            else
            {
                await DisplayAlert("", "Please check your network connectivity", "Ok");

                return;
            }
        }
Example #22
0
        //Floating Lable Code End

        public UpdateVehicle(OCustomerVehicle customerVehicle)
        {
            InitializeComponent();
            ShowLoading(true);
            dal_Vehicle          = new DALVehicle();
            dal_Customer         = new DALCustomer();
            txtMake.Text         = customerVehicle.Make;
            txtModel.Text        = customerVehicle.Model;
            txtColor.Text        = customerVehicle.Color;
            txtRegNumber.Text    = customerVehicle.RegistrationNumber;
            swtPrimary.IsToggled = customerVehicle.IsPrimaryVehicle;
            swtActive.IsToggled  = customerVehicle.IsActive;

            CustomerVehicleMapperID = customerVehicle.CustomerVehicleMapperID;
            CustomerVehicleID       = customerVehicle.CustomerVehicleID;
            VehicleTypeID           = customerVehicle.VehicleTypeID;
            CustomerID      = customerVehicle.CustomerID;
            VehicleTypeCode = customerVehicle.VehicleTypeCode;

            if (customerVehicle.VehicleTypeCode == "2W")
            {
                svgTwo.Source   = "resource://InstaConsumer.Resources.blue_circle_bike.svg";
                svgFour.Source  = "resource://InstaConsumer.Resources.grey_circle_car.svg";
                VehicleTypeCode = VehicleTypeCodes.TwoWheeler;
            }
            else if (customerVehicle.VehicleTypeCode == "4W")
            {
                svgTwo.Source   = "resource://InstaConsumer.Resources.grey_circle_bike.svg";
                svgFour.Source  = "resource://InstaConsumer.Resources.blue_circle_car.svg";
                VehicleTypeCode = VehicleTypeCodes.FourWheeler;
            }

            ShowLoading(false);

            //Floating Lable Code Start
            lblMake.TranslationX = lblModel.TranslationX = lblColor.TranslationX = lblRegNumber.TranslationX = 10;
            lblMake.FontSize     = lblModel.FontSize = lblColor.FontSize = lblRegNumber.FontSize = _placeholderFontSize;
            lblMake.TextColor    = lblModel.TextColor = lblColor.TextColor = lblRegNumber.TextColor = Color.Gray;

            if (string.IsNullOrEmpty(txtMake.Text))
            {
                TransitionToPlaceholder(true);
            }
            else
            {
                TransitionToTitle(true);
            }
            if (string.IsNullOrEmpty(txtModel.Text))
            {
                TransitionToPlaceholder_Model(true);
            }
            else
            {
                TransitionToTitle_Model(true);
            }
            if (string.IsNullOrEmpty(txtColor.Text))
            {
                TransitionToPlaceholder_Color(true);
            }
            else
            {
                TransitionToTitle_Color(true);
            }
            if (string.IsNullOrEmpty(txtRegNumber.Text))
            {
                TransitionToPlaceholder_RegNumber(true);
            }
            else
            {
                TransitionToTitle_RegNumber(true);
            }

            txtMake.Focus();
            //Floating Lable Code End
        }
Example #23
0
 public static List <Customer> ReadCustomers(ref List <string> errors)
 {
     return(DALCustomer.ReadCustomers(ref errors));
 }
        //Floating Lable Code End
        public MyProfile(OCustomer customer)
        {
            InitializeComponent();
            ShowLoading(true);
            dal_Customer        = new DALCustomer();
            CustomerID          = customer.CustomerID;
            Gender_static       = customer.Gender;
            txtName.Text        = customer.Name;
            txtPhoneNumber.Text = customer.PhoneNumber;
            txtEmail.Text       = customer.Email;
            imgProfile.Source   = customer.ProfileImage == null ? "profilepic.png" :
                                  ImageSource.FromStream(() => new MemoryStream(ByteArrayCompressionUtility.Decompress(customer.ProfileImage)));

            imgCameraByteData = customer.ProfileImage == null ? null :
                                new MemoryStream(ByteArrayCompressionUtility.Decompress(customer.ProfileImage)).ToArray();

            if (customer.YearOfBirth != 0)
            {
                txtYearOfBirth.Text = Convert.ToString(customer.YearOfBirth);
            }
            else
            {
                txtYearOfBirth.Text = "";
            }
            ShowLoading(false);

            //Floating Lable Code Start
            lblName.TranslationX = lblPhoneNumber.TranslationX = lblEmail.TranslationX = lblYear.TranslationX = 10;
            lblName.FontSize     = lblPhoneNumber.FontSize = lblEmail.FontSize = lblYear.FontSize = _placeholderFontSize;
            lblName.TextColor    = lblPhoneNumber.TextColor = lblEmail.TextColor = lblYear.TextColor = Color.Gray;

            if (string.IsNullOrEmpty(txtName.Text))
            {
                TransitionToPlaceholder(true);
            }
            else
            {
                TransitionToTitle(true);
            }
            if (string.IsNullOrEmpty(txtPhoneNumber.Text))
            {
                TransitionToPlaceholder_PhoneNo(true);
            }
            else
            {
                TransitionToTitle_PhoneNo(true);
            }
            if (string.IsNullOrEmpty(txtEmail.Text))
            {
                TransitionToPlaceholder_Email(true);
            }
            else
            {
                TransitionToTitle_Email(true);
            }
            if (string.IsNullOrEmpty(txtYearOfBirth.Text))
            {
                TransitionToPlaceholder_YearofBirth(true);
            }
            else
            {
                TransitionToTitle_YearofBirth(true);
            }

            txtName.Focus();
            //Floating Lable Code End
        }
Example #25
0
    protected void btnSaveProduct_Click(object sender, EventArgs e)
    {
        int intUserId = int.Parse(Session["UserId"].ToString());

        try
        {
            DALmstOrder        objDALmstOrder          = new DALmstOrder();
            DALmstRefundAmount objDALmstRefundAmount   = new DALmstRefundAmount();
            DataSet            dsobjDALmstRefundAmount = new DataSet();

            if (txtRefundAmount.Text != "0")
            {
                int      nOrderId              = int.Parse(Request.QueryString["OrderId"].ToString());
                int      nCustomerId           = int.Parse(lblId.Text);
                int      nLanguageId           = 1;
                DateTime dtPaymentReceived     = DateTime.Parse(txtPaymentDueDate.Text);
                float    fRefundAmount         = float.Parse(txtRefundAmount.Text);
                int      nCutomerAccountTypeId = int.Parse(ddlCutomerAccounttype.SelectedValue);
                string   cReferenceNumber      = txtReferencenumber.Text;
                string   cNotes = txtNotes.Text;

                float TotalAmount = float.Parse(lblTotal.Text);
                if (fRefundAmount == TotalAmount)
                {
                    objDALmstOrder.UpdateStatusAfterTakePayment(nOrderId, intUserId, "Return", dtPaymentReceived);


                    objDALmstRefundAmount.InsertRow(nOrderId, nCustomerId, dtPaymentReceived, fRefundAmount, nCutomerAccountTypeId, cReferenceNumber, cNotes, intUserId, true, nLanguageId, false, "", "", "", "");

                    #region //START: Enter Log


                    string strchatUserNAme = Session["ChatUsername"].ToString();

                    string strCustomerName = "";

                    DALCustomer objCustomer = new DALCustomer();
                    DataSet     dsCustomer  = new DataSet();
                    dsCustomer = objCustomer.SelectRow(nCustomerId, intUserId);
                    if (dsCustomer.Tables[0].Rows.Count > 0)
                    {
                        strCustomerName = dsCustomer.Tables[0].Rows[0]["cCustomerFirstName"].ToString() + " " + dsCustomer.Tables[0].Rows[0]["cCustomerLastName"].ToString();
                    }

                    string    strDescription = "Refund payment for 'CN'" + nOrderId + "(" + strCustomerName + ")";
                    DALmstLog objLog         = new DALmstLog();
                    objLog.InsertRow(cReferenceNumber, strDescription, "insert", strchatUserNAme, DateTime.Now, intUserId, 0, true, false, "", "", "");

                    strDescription = "Full Refund payment for 'CN'" + nOrderId + "(" + strCustomerName + ")";

                    objLog.InsertRow(cReferenceNumber, strDescription, "insert", strchatUserNAme, DateTime.Now, intUserId, 0, true, false, "", "", "");

                    #endregion

                    Response.Redirect("ViewInvoice.aspx?PageId=0");
                }
                else if (fRefundAmount > TotalAmount)
                {
                    string strTitleN       = "Take Payment";
                    string strdescriptions = "The amount cannot be more than the credit available to the customer.";
                    NotificationMessage1.NotificationDetails(strTitleN, strdescriptions);
                }
                else
                {
                    objDALmstRefundAmount.InsertRow(nOrderId, nCustomerId, dtPaymentReceived, fRefundAmount, nCutomerAccountTypeId, cReferenceNumber, cNotes, intUserId, true, nLanguageId, false, "", "", "", "");

                    #region //START: Enter Log


                    string strchatUserNAme = Session["ChatUsername"].ToString();

                    string strCustomerName = "";

                    DALCustomer objCustomer = new DALCustomer();
                    DataSet     dsCustomer  = new DataSet();
                    dsCustomer = objCustomer.SelectRow(nCustomerId, intUserId);
                    if (dsCustomer.Tables[0].Rows.Count > 0)
                    {
                        strCustomerName = dsCustomer.Tables[0].Rows[0]["cCustomerFirstName"].ToString() + " " + dsCustomer.Tables[0].Rows[0]["cCustomerLastName"].ToString();
                    }

                    string    strDescription = "Refund amount for 'CN'" + nOrderId + "(" + strCustomerName + ")";
                    DALmstLog objLog         = new DALmstLog();
                    objLog.InsertRow(cReferenceNumber, strDescription, "insert", strchatUserNAme, DateTime.Now, intUserId, 0, true, false, "", "", "");


                    #endregion

                    Response.Redirect("ViewInvoice.aspx?PageId=0");
                }
            }


            else
            {
                string strTitleN       = "";
                string strdescriptions = "The Amount field cannot be $0.00. Please enter an amount other than zero.";
                NotificationMessage1.NotificationDetails(strTitleN, strdescriptions);
            }
        }
        catch (Exception ex)
        {
            DALExceptionDetail objDALExceptionDetail = new DALExceptionDetail();
            objDALExceptionDetail.InsertRow(ex.Message, "RefundToCustomer.aspx", intUserId, DateTime.Now, true);
        }
    }