//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 }
private async void BtnViolation_Clicked(object sender, EventArgs e) { string resultmsg = string.Empty; string existingCheckIn = string.Empty; MasterHomePage masterPage = null; BtnViolation.IsVisible = false; ShowLoading(true); try { int number; if (DeviceInternet.InternetConnected()) { if (SelectedVehicle != string.Empty) { if (entryRegistrationNumber.Text != null && (!entryRegistrationNumber.Text.Contains(" ") && (entryRegistrationNumber.Text.Length >= 6 && entryRegistrationNumber.Text.Length <= 10))) { string regNumber = entryRegistrationNumber.Text; string regFormat = regNumber.Substring(regNumber.Length - 4); if (int.TryParse(regFormat, out number)) { if (pickerBayNumers.SelectedItem != null) { if ((checkBoxClampVehicle.IsChecked) || (chkWarning.IsChecked)) { if (pickerVehicleReason.SelectedItem != null) { ParkingBay objselectedbay = (ParkingBay)pickerBayNumers.SelectedItem; ViolationReason objselectedreason = (ViolationReason)pickerVehicleReason.SelectedItem; if (imgCameraByteData != null) { if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken")) { await Task.Run(() => { existingCheckIn = VerifyVehicleCheckInStatus(); if (existingCheckIn == string.Empty) { ViolationAndClamp objViolationAndClamp = new ViolationAndClamp(); User objloginuser = (User)App.Current.Properties["LoginUser"]; objViolationAndClamp.UserID = objloginuser.UserID; objViolationAndClamp.UserTypeID = objloginuser.UserTypeID.UserTypeID; objViolationAndClamp.LocationID = objloginuser.LocationParkingLotID.LocationID.LocationID; objViolationAndClamp.LocationParkingLotID = objloginuser.LocationParkingLotID.LocationParkingLotID; objViolationAndClamp.LocationName = objloginuser.LocationParkingLotID.LocationID.LocationName; objViolationAndClamp.RegistrationNumber = entryRegistrationNumber.Text; objViolationAndClamp.BayNumberID = objselectedbay.ParkingBayID; objViolationAndClamp.BayNumber = objselectedbay.ParkingBayName; objViolationAndClamp.IsClamp = checkBoxClampVehicle.IsChecked; objViolationAndClamp.ReasonID = objselectedreason.ViolationReasonID; objViolationAndClamp.ReasonName = objselectedreason.Reason; objViolationAndClamp.VehicleTypeCode = SelectedVehicle; DateTime openTime = DateTime.Parse(objloginuser.LocationParkingLotID.LotOpenTime); if (DateTime.Now < openTime) { objViolationAndClamp.ViolationStartTime = openTime; objViolationAndClamp.ViolationTime = openTime.ToString("MM/dd/yyyy HH:mm tt"); } else { objViolationAndClamp.ViolationStartTime = violationTime; objViolationAndClamp.ViolationTime = violationTime.ToString("MM/dd/yyyy HH:mm tt"); } objViolationAndClamp.IsWarning = Convert.ToBoolean(chkWarning.IsChecked); objViolationAndClamp.VehicleImageLottitude = Convert.ToDecimal(Latitude); objViolationAndClamp.VehicleImageLongitude = Convert.ToDecimal(Longitude); if (imgCameraByteData != null) { objViolationAndClamp.ViolationImage = ByteArrayCompressionUtility.Compress(imgCameraByteData); } resultmsg = dal_ViolationClamp.SaveViolationAndClamp(Convert.ToString(App.Current.Properties["apitoken"]), objViolationAndClamp); if (resultmsg == "Success") { masterPage = new MasterHomePage(); } } }); if (existingCheckIn == string.Empty) { if (resultmsg == "Success") { await Navigation.PushAsync(masterPage); } else { await DisplayAlert("Alert", "Violation Check In failed,Please contact Admin.", "Ok"); } } else { await DisplayAlert("Alert", "Vehicle Checked In as Violation at " + existingCheckIn, "Ok"); } } else { await DisplayAlert("Alert", "User details and API token unavailable. Login again", "Ok"); } } else { await DisplayAlert("Alert", "Please select Vehicle Image.", "Ok"); } } else { await DisplayAlert("Alert", "Please select Reason.", "Ok"); } } else { await DisplayAlert("Alert", "Please check Clamp or Warning ", "Ok"); } } else { await DisplayAlert("Alert", "Please select Bay Number.", "Ok"); } } else { await DisplayAlert("Alert", "Please enter valid Registration Number", "Ok"); } } else { await DisplayAlert("Alert", "Please enter valid Registration Number.", "Ok"); } } else { await DisplayAlert("Alert", "Please select Vehicle type", "Ok"); } BtnViolation.IsVisible = true; } else { await DisplayAlert("Alert", "Please check your Internet connection", "Ok"); ShowLoading(false); BtnViolation.IsVisible = true; } } catch (Exception ex) { } ShowLoading(false); BtnViolation.IsVisible = true; }
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 void DeCompressMessages() { decomperessedBuffer = ByteArrayCompressionUtility.Decompress(compressedData); }
public void CompressMessages() { compressedData = ByteArrayCompressionUtility.Compress(uncompressedData.ToArray()); }
public MasterHomePage() { InitializeComponent(); dal_Exceptionlog = new DALExceptionManagment(); dal_Menubar = new DALMenubar(); try { if (App.Current.Properties.ContainsKey("LoginUser")) { User loginUser = (User)App.Current.Properties["LoginUser"]; labelUserName.Text = loginUser.UserName.ToUpper(); labelUserID.Text = "ID: " + Convert.ToString(loginUser.UserCode); if (loginUser.Photo != null && loginUser.Photo.Length > 0) // Show User Profile Image { imgProfile.Source = ImageSource.FromStream(() => new MemoryStream(ByteArrayCompressionUtility.Decompress(loginUser.Photo))); } if (loginUser.UserTypeID.UserTypeName.ToUpper() == "Administrator".ToUpper()) { AdminHomePage adminhomePage = new AdminHomePage(); Detail = new NavigationPage(adminhomePage); } else { CheckIn checkInPage = new CheckIn(); Detail = new NavigationPage(checkInPage); } IsPresented = false; } } catch (Exception ex) { } }
private void ImageViolation_Clicked(object sender, EventArgs e) { try { if (objresult.VehicleParkingImage != null) { popupImageView.IsVisible = true; imgViolationpopupImage.Source = ImageSource.FromStream(() => new MemoryStream(ByteArrayCompressionUtility.Decompress(objresult.VehicleParkingImage))); labelViolationImageLocation.Text = objresult.VehicleImageLottitude + "," + objresult.VehicleImageLongitude + Environment.NewLine + Convert.ToDateTime(objresult.CreatedOn).ToString("dd MMM yyyy"); } } catch (Exception ex) { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "ViolationVehicleInformation.xaml.cs", "", "ImageViolation_Clicked"); } }
private void LoadParkedVehicleDetails(int customerParkingLotID) { try { string vehicleType = string.Empty; if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken")) { objresult = objHome.GetSelectedParkedVehicleDetails(Convert.ToString(App.Current.Properties["apitoken"]), customerParkingLotID); if (objresult.CustomerParkingSlotID != 0) { labelParkingLocation.Text = objresult.LocationParkingLotID.LocationID.LocationName + "-" + objresult.LocationParkingLotID.LocationParkingLotName; labelBayNumber.Text = "Bay Number " + objresult.LocationParkingLotID.ParkingBayID.ParkingBayRange; labelCheckInBy.Text = objresult.CreatedByName + " #" + objresult.UserCode; labelCheckInFrom.Text = objresult.ExpectedStartTime == null ? "" : Convert.ToDateTime(objresult.ExpectedStartTime).ToString("dd MMM yyyy, hh:mm tt"); labelCheckInTo.Text = objresult.ActualEndTime == null ? "" : Convert.ToDateTime(objresult.ActualEndTime).ToString("dd MMM yyyy, hh:mm tt"); imageParkingFeeImage.Source = "rupee_black.png"; decimal parkingAmount = objresult.PaidAmount; labelParkingFeesDetails.Text = parkingAmount.ToString("N2") + "/-"; labelPaidDueAmountDetails.Text = "( Parking Amount:" + Math.Abs(objresult.Amount - objresult.PaidDueAmount).ToString("N2") + "/-, " + "Paid Due Amount:" + objresult.PaidDueAmount.ToString("N2") + "/- )"; TimeSpan parkingduration = Convert.ToDateTime(objresult.ActualEndTime) - Convert.ToDateTime(objresult.ExpectedStartTime); if (objresult.Duration != "" && objresult.Duration != string.Empty) { var parkhours = ((Math.Abs(parkingduration.Hours) == 0 || Math.Abs(parkingduration.Hours) == 1)) ? Convert.ToInt32(objresult.Duration) : Math.Abs(parkingduration.Hours); labelParkingPaymentType.Text = "Paid for " + string.Format(parkhours + "hr") + " - By " + objresult.PaymentTypeID.PaymentTypeName; } labelVehicleDetails.Text = objresult.CustomerVehicleID.RegistrationNumber; imageVehicleImage.Source = objresult.CustomerVehicleID.VehicleTypeID.VehicleIcon; vehicleType = objresult.CustomerVehicleID.VehicleTypeID.VehicleTypeDisplayName; User objloginuser = (User)App.Current.Properties["LoginUser"]; slSpotExpireTimeDisplay.IsVisible = true; slVehicleWarning.IsVisible = (objresult.ViolationWarningCount >= 3) ? false : true; lblWarningCount.Text = (objresult.ViolationWarningCount > 3) ? "" : Convert.ToString(objresult.ViolationWarningCount) + " Warning(s) Completed"; lblWarningCount.IsVisible = true; imgbtnPrint.IsVisible = true; if (objloginuser.UserTypeID.UserTypeName.ToUpper() != "Operator".ToUpper()) { slFOC.IsVisible = true; } if (objresult.ApplicationTypeID.ApplicationTypeCode == "P") { labelParkingFeesDetails.Text = "Pass Check-In"; labelParkingPaymentType.Text = ""; imageParkingFeeImage.Source = ""; labelPaidDueAmountDetails.Text = ""; } if (objresult.StatusID.StatusCode.ToUpper() == "G") { imgbtnPrint.IsVisible = false; slSpotExpireTimeDisplay.IsVisible = false; slFeesDetails.IsVisible = false; slFOC.IsVisible = false; slClamp.IsVisible = false; chkWarning.IsVisible = false; slVehicleWarning.IsVisible = false; labelParkingFeesDetails.Text = "Free of charge - Government Vehicle"; labelParkingPaymentType.Text = ""; labelPaidDueAmountDetails.Text = ""; imgGovPhone.Source = "phone.png"; imgGovPhone.HeightRequest = 20; labelPhoneNumber.Text = objresult.CustomerID.PhoneNumber; lblWarningCount.IsVisible = false; if (objresult.GovernmentVehicleImage != null) { imageGovernmentVehicle.Source = ImageSource.FromStream(() => new MemoryStream(ByteArrayCompressionUtility.Decompress(objresult.GovernmentVehicleImage))); imageGovernmentVehicle.HeightRequest = 150; labelGovImageLocation.Text = objresult.VehicleImageLottitude + "," + objresult.VehicleImageLongitude + Environment.NewLine + Convert.ToDateTime(objresult.CreatedOn).ToString("dd MMM yyyy"); } else { imageGovernmentVehicle.IsVisible = false; imageGovernmentVehicle.HeightRequest = 0; } } if (objresult.ActualEndTime != null) { DateTime exptendime = Convert.ToDateTime(objresult.ActualEndTime); DateTime CurrentTime = DateTime.Now; TimeSpan t = CurrentTime - exptendime; labelSpotExpiresTime.Text = string.Format("{0:%h} h : {0:%m} m", t); } #region Clamp and Warning data loading checkBoxClampVehicle.IsChecked = objresult.IsClamp; checkBoxClampVehicle.IsEnabled = !objresult.IsClamp; chkWarning.IsChecked = objresult.IsWarning; chkWarning.IsEnabled = !objresult.IsWarning; slCash.IsVisible = (objresult.ClampFees > 0) ? true : false; slEPay.IsVisible = (objresult.ClampFees > 0) ? true : false; lblClampFees.Text = (objresult.ClampFees > 0) ? objresult.ClampFees.ToString("N2") : "0.00"; lblParkingFees.Text = "0.00"; lblTotal.Text = objresult.ClampFees.ToString("N2"); if (objresult.StatusID.StatusCode.ToUpper() == "G") { slCheckOut.IsVisible = false; if (objloginuser.UserTypeID.UserTypeName.ToUpper() != "Operator".ToUpper()) { slCheckOut.IsVisible = true; imgbtnPrint.IsVisible = true; } } else { slCheckOut.IsVisible = (objresult.ClampFees > 0) ? false : true; } if (objresult.ViolationReasonID.ViolationReasonID != 0) { for (int x = 0; x < lstReasons.Count; x++) { if (lstReasons[x].ViolationReasonID == objresult.ViolationReasonID.ViolationReasonID) { pickerViolationReason.SelectedIndex = x; pickerViolationReason.IsEnabled = false; checkBoxClampVehicle.IsEnabled = false; chkWarning.IsEnabled = false; } } slClampReason.IsVisible = true; } frmClampbutton.IsVisible = false; slPaymentAndExpand.IsVisible = true; #endregion try { if (receiptlines != null && receiptlines.Length > 0) { receiptlines[0] = "\x1B\x21\x08" + " " + "HMRL PARKING" + "\x1B\x21\x00" + "\n"; receiptlines[1] = "\x1B\x21\x01" + " " + objresult.LocationParkingLotID.LocationID.LocationName + objresult.LocationParkingLotID.LocationParkingLotName + "\x1B\x21\x00\n"; receiptlines[2] = "" + "\n"; receiptlines[3] = "\x1B\x21\x08" + vehicleType + ":" + objresult.CustomerVehicleID.RegistrationNumber + "\x1B\x21\x00\n"; receiptlines[4] = "\x1B\x21\x01" + (objresult.ActualStartTime == null ? "" : "In:" + Convert.ToDateTime(objresult.ActualStartTime).ToString("dd MMM yyyy,hh:mm tt")) + "\x1B\x21\x00" + "\n"; receiptlines[5] = "\x1B\x21\x01" + "Paid: Rs" + objresult.Amount.ToString("N2") + "(Up to " + objresult.Duration + " hours)" + "\x1B\x21\x00\n"; receiptlines[6] = "\x1B\x21\x01" + "Valid Till:" + (objresult.ActualEndTime == null ? "" : Convert.ToDateTime(objresult.ActualEndTime).ToString("dd MMM yyyy,hh:mm tt")) + "\x1B\x21\x00\n"; receiptlines[7] = "\x1B\x21\x01" + "Parked at: (Bays)" + objresult.LocationParkingLotID.ParkingBayID.ParkingBayRange + "\x1B\x21\x00\n"; receiptlines[8] = "\x1B\x21\x06" + "Operator Id :" + objresult.UserCode + "\x1B\x21\x00\n"; receiptlines[9] = "\x1B\x21\x01" + "(Supervisor Mobile:" + objresult.SuperVisorID.PhoneNumber + ")" + "\x1B\x21\x00\n"; receiptlines[10] = "\x1B\x21\x06" + "Security available " + objresult.LocationParkingLotID.LotOpenTime + "-" + objresult.LocationParkingLotID.LotCloseTime + "\x1B\x21\x00\n"; receiptlines[11] = "\x1B\x21\x01" + "We are not responsible for your valuable items like laptop, wallet,helmet etc." + "\x1B\x21\x00\n"; receiptlines[12] = "\x1B\x21\x06" + "GST Number 36AACFZ1015E1ZL" + "\x1B\x21\x00\n"; receiptlines[13] = "\x1B\x21\x06" + "Amount includes 18% GST" + "\x1B\x21\x00\n"; receiptlines[14] = "" + "\n"; receiptlines[15] = "" + "\n"; } } catch (Exception ex) { } objresult.CreatedBy = objloginuser.UserID; } else { DisplayAlert("Alert", "Vehicle details unvailable,Please contact Admin", "Ok"); } } } catch (Exception ex) { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "PassCheckInVehicleInformation.xaml.cs", "", "LoadParkedVehicleDetails"); } }