public CheckOutPaymentConfirmationPage(string redirectdFrom, CustomerParkingSlot objInput) { InitializeComponent(); stLayoutPaymentConfirmCheckOut.IsVisible = false; ObjblueToothDevicePrinting = new BlueToothDevicePrinting(); PageCalledBy = redirectdFrom; objviolationVehicleChekOut = objInput; ImgVehicleType.Source = objInput.VehicleTypeID.VehicleIcon; labelChekInAmount.Text = "(" + objInput.VehicleTypeID.VehicleTypeName + " - For " + objInput.Duration + " Hours)"; labelVehicleRegNumber.Text = objInput.CustomerVehicleID.RegistrationNumber; labelParkingLocation.Text = objInput.LocationParkingLotID.LocationID.LocationName + "-" + objInput.LocationParkingLotID.LocationParkingLotName + "," + objInput.LocationParkingLotID.ParkingBayID.ParkingBayName + " " + objInput.LocationParkingLotID.ParkingBayID.ParkingBayRange; if (redirectdFrom == "ViolationVehicleInformation") { labelChekInAmount.Text = "(Parking ₹" + objInput.Amount.ToString("N2") + " Clamp ₹" + objInput.ClampFees.ToString("N2") + " Due Amount ₹" + objInput.DueAmount.ToString("N2") + ")"; lableAmount.Text = (objInput.Amount + objInput.ClampFees + objInput.DueAmount).ToString("N2"); } else if (redirectdFrom == "PassCheckInVehicleInformation") { labelChekInAmount.Text = "( Clamp ₹" + objInput.ClampFees.ToString("N2") + ")"; lableAmount.Text = (objInput.ClampFees).ToString("N2"); } else if (redirectdFrom == "OverstayVehicleInformation") { lableAmount.Text = (objInput.ExtendAmount + objInput.ClampFees).ToString("N2"); } }
public CheckOutReceiptPage(string vehicleInformation, CustomerParkingSlot objInput) { InitializeComponent(); VehicleInformation = vehicleInformation; ObjblueToothDevicePrinting = new BlueToothDevicePrinting(); LoadVehicleCheckOutDetails(vehicleInformation, objInput); }
public string VerifyVehicleCheckInStatus() // Verify Vehicle already parked { string alreadyCheckIn = string.Empty; try { if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken")) { VehicleCheckIn objPassVehicle = new VehicleCheckIn(); User objloginuser = (User)App.Current.Properties["LoginUser"]; objPassVehicle.LocationID = objloginuser.LocationParkingLotID.LocationID.LocationID; objPassVehicle.LocationParkingLotID = objloginuser.LocationParkingLotID.LocationParkingLotID; objPassVehicle.VehicleTypeCode = SelectedVehicle; objPassVehicle.RegistrationNumber = entryRegistrationNumber.Text; CustomerParkingSlot resultobj = dal_DALCheckIn.VerifyVehicleChekcInStatus(Convert.ToString(App.Current.Properties["apitoken"]), objPassVehicle); if (resultobj.CustomerParkingSlotID != 0) { alreadyCheckIn = resultobj.LocationParkingLotID.LocationID.LocationName + "-" + resultobj.LocationParkingLotID.LocationParkingLotName; } } } catch (Exception ex) { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "CheckInPage.xaml.cs", "", "VerifyVehicleCheckInStatus"); } return(alreadyCheckIn); }
public CustomerParkingSlot VerifyVehicleInCheckInStatus(VehicleCheckIn objVehicle) { CustomerParkingSlot objCustomerParkingSlot = new CustomerParkingSlot(); DataTable resultdt = new DataTable(); try { using (SqlConnection sqlconn_obj = new SqlConnection(SqlHelper.GetDBConnectionString())) { using (SqlCommand sqlcmd_obj = new SqlCommand("OPAPP_PROC_VerifyVehicleInCheckInStatus", sqlconn_obj)) { sqlcmd_obj.CommandType = CommandType.StoredProcedure; sqlcmd_obj.Parameters.AddWithValue("@LocationID", (objVehicle.LocationID == 0) ? (object)DBNull.Value : Convert.ToInt32(objVehicle.LocationID)); sqlcmd_obj.Parameters.AddWithValue("@LocationParkingLotID", (objVehicle.LocationParkingLotID == 0) ? (object)DBNull.Value : Convert.ToInt32(objVehicle.LocationParkingLotID)); sqlcmd_obj.Parameters.AddWithValue("@VehicleTypeCode", objVehicle.VehicleTypeCode); sqlcmd_obj.Parameters.AddWithValue("@RegistrationNumber", objVehicle.RegistrationNumber == "" ? (object)DBNull.Value : objVehicle.RegistrationNumber); sqlconn_obj.Open(); SqlDataAdapter sqldap = new SqlDataAdapter(sqlcmd_obj); sqldap.Fill(resultdt); if (resultdt.Rows.Count > 0) { objCustomerParkingSlot.CustomerParkingSlotID = resultdt.Rows[0]["CustomerParkingSlotID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["CustomerParkingSlotID"]); objCustomerParkingSlot.CustomerID.CustomerID = resultdt.Rows[0]["CustomerID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["CustomerID"]); objCustomerParkingSlot.CustomerID.Name = Convert.ToString(resultdt.Rows[0]["Name"]); objCustomerParkingSlot.LocationParkingLotID.LocationID.LocationID = resultdt.Rows[0]["LocationID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["LocationID"]); objCustomerParkingSlot.LocationParkingLotID.LocationID.LocationName = Convert.ToString(resultdt.Rows[0]["LocationName"]); objCustomerParkingSlot.LocationParkingLotID.LocationParkingLotID = resultdt.Rows[0]["LocationParkingLotID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["LocationParkingLotID"]); objCustomerParkingSlot.LocationParkingLotID.LocationParkingLotName = Convert.ToString(resultdt.Rows[0]["LocationParkingLotName"]); objCustomerParkingSlot.LocationParkingLotID.ParkingBayID.ParkingBayID = resultdt.Rows[0]["ParkingBayID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["ParkingBayID"]); objCustomerParkingSlot.LocationParkingLotID.ParkingBayID.ParkingBayName = Convert.ToString(resultdt.Rows[0]["ParkingBayName"]); objCustomerParkingSlot.LocationParkingLotID.ParkingBayID.ParkingBayRange = Convert.ToString(resultdt.Rows[0]["ParkingBayRange"]); objCustomerParkingSlot.ExpectedStartTime = resultdt.Rows[0]["ExpectedStartTime"] == DBNull.Value ? (Nullable <DateTime>)null : Convert.ToDateTime(resultdt.Rows[0]["ExpectedStartTime"]); objCustomerParkingSlot.ExpectedEndTime = resultdt.Rows[0]["ExpectedEndTime"] == DBNull.Value ? (Nullable <DateTime>)null : Convert.ToDateTime(resultdt.Rows[0]["ExpectedEndTime"]); objCustomerParkingSlot.ActualStartTime = resultdt.Rows[0]["ActualStartTime"] == DBNull.Value ? (Nullable <DateTime>)null : Convert.ToDateTime(resultdt.Rows[0]["ActualStartTime"]); objCustomerParkingSlot.ActualEndTime = resultdt.Rows[0]["ActualEndTime"] == DBNull.Value ? (Nullable <DateTime>)null : Convert.ToDateTime(resultdt.Rows[0]["ActualEndTime"]); objCustomerParkingSlot.VehicleTypeID.VehicleTypeID = resultdt.Rows[0]["VehicleTypeID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["VehicleTypeID"]); objCustomerParkingSlot.VehicleTypeID.VehicleTypeCode = Convert.ToString(resultdt.Rows[0]["VehicleTypeCode"]); objCustomerParkingSlot.VehicleTypeID.VehicleTypeName = Convert.ToString(resultdt.Rows[0]["VehicleTypeName"]); objCustomerParkingSlot.Duration = Convert.ToString(resultdt.Rows[0]["Duration"]); objCustomerParkingSlot.PaymentTypeID.PaymentTypeID = resultdt.Rows[0]["PaymentTypeID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["PaymentTypeID"]); objCustomerParkingSlot.PaymentTypeID.PaymentTypeName = Convert.ToString(resultdt.Rows[0]["PaymentTypeName"]); objCustomerParkingSlot.CreatedBy = resultdt.Rows[0]["UserID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["UserID"]); objCustomerParkingSlot.CreatedByName = Convert.ToString(resultdt.Rows[0]["UserName"]); objCustomerParkingSlot.Amount = resultdt.Rows[0]["Amount"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[0]["Amount"]); objCustomerParkingSlot.CustomerVehicleID.RegistrationNumber = Convert.ToString(resultdt.Rows[0]["RegistrationNumber"]); objCustomerParkingSlot.CustomerVehicleID.CustomerVehicleID = resultdt.Rows[0]["CustomerVehicleID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["CustomerVehicleID"]); objCustomerParkingSlot.IsClamp = resultdt.Rows[0]["IsClamp"] == DBNull.Value ? false : Convert.ToBoolean(resultdt.Rows[0]["IsClamp"]); objCustomerParkingSlot.StatusID.StatusID = resultdt.Rows[0]["StatusID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["StatusID"]); objCustomerParkingSlot.StatusID.StatusCode = Convert.ToString(resultdt.Rows[0]["StatusCode"]); } } } } catch (Exception ex) { objExceptionlog.InsertException("WebAPI", ex.Message, "DALCheckIn", "Proc: " + "OPAPP_PROC_VerifyVehicleInCheckInStatus", "VerifyVehicleInCheckInStatus"); } return(objCustomerParkingSlot); }
public FOCConfirmationPage(CustomerParkingSlot objresult, string RediretFrom) { InitializeComponent(); stLayoutConfirmCheckOut.IsVisible = false; RedirectPage = RediretFrom; dal_ViolationClamp = new DALViolationandClamp(); LoadGetViolationReasons(); GetPassPaymentDetails(objresult); }
public ReceiptPage(CustomerParkingSlot objReceipt) { string vehicleTypeName = string.Empty; dal_Exceptionlog = new DALExceptionManagment(); InitializeComponent(); ObjblueToothDevicePrinting = new BlueToothDevicePrinting(); //LoadReceiptDetails(objReceipt); }
public void LoadVehicleParkingHistory(CustomerVehicle objregistraionnumber) { try { CustomerParkingSlot objresult = null; string vehicleType = string.Empty; ShowLoading(true); if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken")) { lstVehicleHistory = dal_Menubar.GetVehicleParkingHistory(Convert.ToString(App.Current.Properties["apitoken"]), objregistraionnumber); if (lstVehicleHistory.Count > 0) { LstVWParkingVehicle.ItemsSource = lstVehicleHistory; objresult = lstVehicleHistory[0]; } try { if (receiptlines != null && receiptlines.Length > 0) { vehicleType = Convert.ToString(objresult.VehicleTypeID.VehicleTypeDisplayName); 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" + "In :" + (objresult.ActualStartTime == null ? "" : Convert.ToDateTime(objresult.ActualStartTime).ToString("dd MMM yyyy,hh:mm tt")) + "\x1B\x21\x00" + "\n"; receiptlines[5] = "\x1B\x21\x01" + "Out:" + (objresult.ActualEndTime == null ? "" : Convert.ToDateTime(objresult.ActualEndTime).ToString("dd MMM yyyy,hh:mm tt")) + "\x1B\x21\x00" + "\n"; receiptlines[6] = "\x1B\x21\x01" + "Paid Amount: Rs" + (objresult.PaidAmount).ToString("N2") + "\x1B\x21\x01" + "\n"; receiptlines[7] = "\x1B\x21\x01" + "(Includes Violation)" + "\x1B\x21\x01" + "\n"; receiptlines[8] = "\x1B\x21\x01" + "Violation Fee:" + "Rs" + (objresult.ClampFees).ToString("N2") + "\x1B\x21\x01" + "\n"; receiptlines[9] = "\x1B\x21\x06" + "Operator Id:" + objresult.UserCode + "\x1B\x21\x00\n"; receiptlines[10] = "\x1B\x21\x01" + "(Supervisor Mobile:" + objresult.SuperVisorID.PhoneNumber + ")" + "\x1B\x21\x00\n"; receiptlines[11] = "\x1B\x21\x06" + "Security available " + objresult.LocationParkingLotID.LotOpenTime + "-" + objresult.LocationParkingLotID.LotCloseTime + "\x1B\x21\x00\n"; receiptlines[12] = "\x1B\x21\x01" + "We are not responsible for your valuable items like laptop, wallet,helmet etc." + "\x1B\x21\x00\n"; receiptlines[13] = "\x1B\x21\x06" + "GST Number 36AACFZ1015E1ZL" + "\x1B\x21\x00\n"; receiptlines[14] = "\x1B\x21\x06" + "Amount includes 18% GST" + "\x1B\x21\x00\n"; receiptlines[15] = "" + "\n"; receiptlines[16] = "" + "\n"; } } catch (Exception ex) { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "HistoryPage.xaml.cs", "", "LoadVehicleParkingHistory (Printing Code)"); } } ShowLoading(false); } catch (Exception ex) { ShowLoading(false); dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "HistoryPage.xaml.cs", "", "LoadVehicleParkingHistory"); } }
public void GetPassPaymentDetails(CustomerParkingSlot objfocvehicle) { try { objFOCVehicle = objfocvehicle; ImgVehicleType.Source = objfocvehicle.CustomerVehicleID.VehicleTypeID.VehicleIcon; labelVehicleRegNumber.Text = objfocvehicle.CustomerVehicleID.RegistrationNumber; labelParkingLocation.Text = objfocvehicle.LocationParkingLotID.LocationID.LocationName + "-" + objfocvehicle.LocationParkingLotID.LocationParkingLotName + "," + objfocvehicle.LocationParkingLotID.ParkingBayID.ParkingBayName + " " + objfocvehicle.LocationParkingLotID.ParkingBayID.ParkingBayRange; } catch (Exception ex) { } }
private async void BtnCheckOut_Clicked(object sender, EventArgs e) { try { ShowLoading(true); btnCheckOut.IsVisible = false; if (DeviceInternet.InternetConnected()) { ShowLoading(true); slYESNO.IsVisible = false; DALVehicleCheckOut dal_CheckOut = new DALVehicleCheckOut(); if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken")) { CustomerParkingSlot VehicleCheckOut = null; User objCheckoutBy = (User)App.Current.Properties["LoginUser"]; objviolationVehicleChekOut.CreatedBy = objCheckoutBy.UserID; await Task.Run(() => { VehicleCheckOut = dal_CheckOut.VehicleCheckOut(Convert.ToString(App.Current.Properties["apitoken"]), objviolationVehicleChekOut); }); if (VehicleCheckOut != null) { if (VehicleCheckOut.PaymentTypeID != null) // IF Payment Type NULL { VehicleCheckOut.PaymentTypeID.PaymentTypeName = objviolationVehicleChekOut.PaymentTypeID.PaymentTypeName; } await Navigation.PushAsync(new CheckOutReceiptPage(PageCalledBy, VehicleCheckOut)); } else { await DisplayAlert("Alert", "Check-Out Failed,Please contact Admin.", "Ok"); } } } else { await DisplayAlert("Alert", "Please check your Internet connection", "Ok"); } ShowLoading(false); btnCheckOut.IsVisible = true; } catch (Exception ex) { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "CheckOutPaymentConfirmationPage.xaml.cs", "", "BtnCheckOut_Clicked"); ShowLoading(false); btnCheckOut.IsVisible = true; } }
private async void BtnCheckOut_Clicked(object sender, EventArgs e) { try { ShowLoading(true); BtnCheckOut.IsVisible = false; CustomerParkingSlot objcheckoutresult = null; MasterDetailHomePage masterpage = null; DALVehicleCheckOut dal_VehicleCheckOut = new DALVehicleCheckOut(); if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken")) { User objCheckOutBy = (User)App.Current.Properties["LoginUser"]; objresult.ActualEndTime = DateTime.Now; await Task.Run(() => { objresult.ExtendAmount = 0; objresult.ClampFees = 0; objresult.PaymentTypeID.PaymentTypeName = ""; objresult.Duration = null; objresult.CreatedBy = objCheckOutBy.UserID; objcheckoutresult = dal_VehicleCheckOut.VehicleCheckOut(Convert.ToString(App.Current.Properties["apitoken"]), objresult); if (objcheckoutresult != null) { masterpage = new MasterDetailHomePage(); } }); if (objcheckoutresult != null) { await Navigation.PushAsync(masterpage); } else { await DisplayAlert("Alert", "Payment Failed,Please contact Admin", "Ok"); } } ShowLoading(false); BtnCheckOut.IsVisible = false; } catch (Exception ex) { await DisplayAlert("Alert", "Payment Failed,Please contact Admin", "Ok"); dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "PassCheckInVehicleInformation.xaml.cs", "", "BtnCheckOut_Clicked"); ShowLoading(false); BtnCheckOut.IsVisible = false; } }
public async void AddCustomerparkingSlot(CustomerParkingSlot objParkngSlots) { try { await firebase.Child("CustomerParkingSlot") .PostAsync(objParkngSlots); await firebase.Child("CustomerParkingSlotHistory") .PostAsync(objParkngSlots); } catch (Exception ex) { string exmsg = ex.Message; } }
public async void GetVehicleDueAmount(int customerVehicleID) { try { CustomerVehicle objCustomerVehicle = new CustomerVehicle(); objCustomerVehicle.CustomerVehicleID = customerVehicleID; if (App.Current.Properties.ContainsKey("apitoken")) { var json = JsonConvert.SerializeObject(objCustomerVehicle); var content = new StringContent(json, Encoding.UTF8, "application/json"); CustomerParkingSlot resultObj = dal_Vehicle.GetVehicleDueAmount(Convert.ToString(App.Current.Properties["apitoken"]), objCustomerVehicle); if (resultObj.DueCustomerParkingSlotID != 0) { stkDueAmount.IsVisible = true; DueCustomerParkingSlotID = resultObj.DueCustomerParkingSlotID; DueAmount = resultObj.DueAmount; if (DueAmount > 0) { lblDue.Text = "₹ " + Convert.ToString(Convert.ToDouble(DueAmount)) + "/-"; lblPass.Text = "₹ " + Convert.ToString(Convert.ToDouble(objPassPrice == null ? 0 : objPassPrice.Price)) + "/-"; lblTotal.Text = "₹ " + Convert.ToString(Convert.ToDouble(DueAmount + (objPassPrice == null ? 0 : objPassPrice.Price))) + "/-"; } else { lblDue.Text = "₹ " + Convert.ToString(Convert.ToDouble(0)) + "/-"; lblPass.Text = "₹ " + Convert.ToString(Convert.ToDouble(objPassPrice == null ? 0 : objPassPrice.Price)) + "/-"; lblTotal.Text = "₹ " + Convert.ToString(Convert.ToDouble(DueAmount + (objPassPrice == null ? 0 : objPassPrice.Price))) + "/-"; } } else { stkDueAmount.IsVisible = false; DueCustomerParkingSlotID = 0; DueAmount = 0; } } } catch (Exception ex) { DisplayAlert("Failed - GetVehicleDueAmount", Convert.ToString(ex.Message), "Ok"); } }
public CustomerParkingSlot VehicleCheckOut(string accessToken, CustomerParkingSlot ObjVehicleCheckOut) { CustomerParkingSlot objUpdatedVehicle = null; try { string baseUrl = Convert.ToString(App.Current.Properties["BaseURL"]); using (var client = new HttpClient()) { client.BaseAddress = new Uri(baseUrl); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // Add the Authorization header with the AccessToken. client.DefaultRequestHeaders.Add("Authorization", "bearer " + accessToken); // create the URL string. string url = "api/InstaOperator/postOPAPPSaveVehcileCheckOut"; // make the request var json = JsonConvert.SerializeObject(ObjVehicleCheckOut); var content = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = client.PostAsync(url, content).Result; if (response.IsSuccessStatusCode) { string jsonString = response.Content.ReadAsStringAsync().Result; if (jsonString != null) { APIResponse apiResult = JsonConvert.DeserializeObject <APIResponse>(jsonString); if (apiResult.Result) { objUpdatedVehicle = JsonConvert.DeserializeObject <CustomerParkingSlot>(Convert.ToString(apiResult.Object)); } } } } } catch (Exception ex) { } return(objUpdatedVehicle); }
public CustomerParkingSlot ValidateVehicleCheckIn(CustomerVehicle objCustomerVehicle) { DALExceptionManagment objExceptionlog = new DALExceptionManagment(); CustomerParkingSlot obj_CustomerParkingSlot = new CustomerParkingSlot(); string resultMsg = string.Empty; try { using (SqlConnection sqlconn_obj = new SqlConnection(SqlHelper.GetDBConnectionString())) { using (SqlCommand sqlcmd_obj = new SqlCommand("CTAPP_PROC_VALIDATEVEHICLECHECKIN", sqlconn_obj)) { sqlcmd_obj.CommandType = CommandType.StoredProcedure; sqlcmd_obj.Parameters.AddWithValue("@CustomerVehicleID", objCustomerVehicle.CustomerVehicleID); sqlconn_obj.Open(); SqlDataAdapter sqldap = new SqlDataAdapter(sqlcmd_obj); DataTable resultdt = new DataTable(); sqldap.Fill(resultdt); if (resultdt.Rows.Count > 0) { obj_CustomerParkingSlot.CustomerParkingSlotID = Convert.ToInt32(resultdt.Rows[0]["CustomerParkingSlotID"]); obj_CustomerParkingSlot.LocationName = Convert.ToString(resultdt.Rows[0]["LocationName"]); obj_CustomerParkingSlot.LocationParkingLotName = Convert.ToString(resultdt.Rows[0]["LocationParkingLotName"]); } else { obj_CustomerParkingSlot.CustomerParkingSlotID = 0; obj_CustomerParkingSlot.LocationName = ""; obj_CustomerParkingSlot.LocationParkingLotName = ""; } } } } catch (Exception ex) { objExceptionlog.InsertException(ex.Message, "DALVehicle", "Proc: " + "CTAPP_PROC_VALIDATEVEHICLECHECKIN", "UpdateCustomerVehicle"); throw; } return(obj_CustomerParkingSlot); }
public CustomerParkingSlot GetVehicleDueAmount(CustomerVehicle objCustomerVehicle) { DALExceptionManagment objExceptionlog = new DALExceptionManagment(); CustomerParkingSlot obj_CustomerParkingSlot = new CustomerParkingSlot(); try { using (SqlConnection sqlconn_obj = new SqlConnection(SqlHelper.GetDBConnectionString())) { using (SqlCommand sqlcmd_obj = new SqlCommand("CTAPP_PROC_GETVEHICLEDUEAMOUNT", sqlconn_obj)) { sqlcmd_obj.CommandType = CommandType.StoredProcedure; sqlcmd_obj.Parameters.AddWithValue("@CustomerVehicleID", objCustomerVehicle.CustomerVehicleID); sqlconn_obj.Open(); SqlDataAdapter sqldap = new SqlDataAdapter(sqlcmd_obj); DataTable resultdt = new DataTable(); sqldap.Fill(resultdt); if (resultdt.Rows.Count > 0) { obj_CustomerParkingSlot.DueCustomerParkingSlotID = Convert.ToInt32(resultdt.Rows[0]["CustomerParkingSlotID"]); obj_CustomerParkingSlot.DueAmount = Convert.ToDecimal(resultdt.Rows[0]["DueAmount"]); } else { obj_CustomerParkingSlot.DueCustomerParkingSlotID = 0; obj_CustomerParkingSlot.DueAmount = 0; } } } } catch (Exception ex) { objExceptionlog.InsertException(ex.Message, "DALVehicle", "Proc: " + "CTAPP_PROC_GETVEHICLEDUEAMOUNT", "GetVehicleDueAmount"); throw; } return(obj_CustomerParkingSlot); }
public CustomerParkingSlot GetSelectedParkedVehicleDetails(string accessToken, int CustomerParkingSlotID) { CustomerParkingSlot objCustomerParkingSlot = new CustomerParkingSlot(); try { string baseUrl = Convert.ToString(App.Current.Properties["BaseURL"]); using (var client = new HttpClient()) { client.BaseAddress = new Uri(baseUrl); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // Add the Authorization header with the AccessToken. client.DefaultRequestHeaders.Add("Authorization", "bearer " + accessToken); // create the URL string. string url = "api/InstaOperator/getSelectedParkedVehicleDetails?CustomerParkingSlotID=" + Convert.ToString(CustomerParkingSlotID); // make the request HttpResponseMessage response = client.GetAsync(url).Result; if (response.IsSuccessStatusCode) { string jsonString = response.Content.ReadAsStringAsync().Result; if (jsonString != null) { APIResponse apiResult = JsonConvert.DeserializeObject <APIResponse>(jsonString); if (apiResult.Result) { objCustomerParkingSlot = JsonConvert.DeserializeObject <CustomerParkingSlot>(Convert.ToString(apiResult.Object)); } } } } } catch (Exception ex) { } return(objCustomerParkingSlot); }
public async void GetVehicleDueAmountDetails() { try { IsOnline = VerifyInternet(); if (IsOnline) { CustomerParkingSlot objCustomerParkingSlot = new CustomerParkingSlot(); objCustomerParkingSlot.CustomerParkingSlotID = DueCustomerParkingSlotID; if (App.Current.Properties.ContainsKey("apitoken")) { var json = JsonConvert.SerializeObject(objCustomerParkingSlot); var content = new StringContent(json, Encoding.UTF8, "application/json"); CustomerParkingSlotDetails resultObj = dal_Customer.GetVehicleDueAmountDetails(Convert.ToString(App.Current.Properties["apitoken"]), objCustomerParkingSlot); if (resultObj.CustomerParkingSlotID != 0) { lblDueRegNum.Text = resultObj.RegistrationNumber; lblDueLocation.Text = resultObj.LocationName + " - " + resultObj.LocationParkingLotName; lblDueTiming.Text = (resultObj.From).ToString("dd-MM-yyyy hh:mm tt") + " to " + (resultObj.To).ToString("dd-MM-yyyy hh:mm tt"); lblDueAmount.Text = "₹ " + Convert.ToString(resultObj.DueAmount); lblDueDuration.Text = resultObj.Duration; lblDueFOCReason.Text = resultObj.ClampReason; } } } else { DisplayAlert("", "Please check your network connectivity", "Ok"); } } catch (Exception ex) { DisplayAlert("Failed - GetVehicleDueAmountDetails", Convert.ToString(ex.Message), "Ok"); } }
public string VerifyPassVehicleCheckInStatus(string vehicleTypeCode, string registrationNumber) // Verify Vehicle already parked { string alreadyCheckIn = string.Empty; try { if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken")) { VehicleCheckIn objPassVehicle = new VehicleCheckIn(); objPassVehicle.RegistrationNumber = registrationNumber; objPassVehicle.VehicleTypeCode = vehicleTypeCode; CustomerParkingSlot resultobj = dal_DALCheckIn.VerifyVehicleChekcInStatus(Convert.ToString(App.Current.Properties["apitoken"]), objPassVehicle); if (resultobj.CustomerParkingSlotID != 0 && resultobj.StatusID.StatusCode == "O") { alreadyCheckIn = resultobj.LocationParkingLotID.LocationID.LocationName + "-" + resultobj.LocationParkingLotID.LocationParkingLotName; } } } catch (Exception ex) { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "ReNewPassPage.xaml.cs", "", "VerifyPassVehicleCheckInStatus"); } return(alreadyCheckIn); }
private async void BtnCheckOut_Clicked(object sender, EventArgs e) { try { CustomerParkingSlot objcheckoutresult = null; MasterHomePage masterpage = null; DALVehicleCheckOut dal_VehicleCheckOut = new DALVehicleCheckOut(); if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken")) { objresult.ActualEndTime = DateTime.Now; await Task.Run(() => { objcheckoutresult = dal_VehicleCheckOut.VehicleCheckOut(Convert.ToString(App.Current.Properties["apitoken"]), objresult); if (objcheckoutresult != null) { masterpage = new MasterHomePage(); } }); if (objcheckoutresult != null) { await Navigation.PushAsync(masterpage); } else { await DisplayAlert("Alert", "Check-Out Failed,Please contact Admin", "Ok"); } } } catch (Exception ex) { await DisplayAlert("Alert", "Check-Out Failed,Please contact Admin", "Ok"); dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "OverstayVehicleInformation.xaml.cs", "", "BtnCheckOut_Clicked"); } }
private async void BtnYes_Clicked(object sender, EventArgs e) { try { if (IsbtnClicked) { return; } IsbtnClicked = true; btnYes.IsVisible = false; CheckIn checkInPage = null; try { ShowLoading(true); if (DeviceInternet.InternetConnected()) { if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken") && objNewCheckIn != null) { await Task.Run(() => { objResultCustomerParkingSlot = dal_DALCheckIn.SaveVehicleNewCheckIn(Convert.ToString(App.Current.Properties["apitoken"]), objNewCheckIn); dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", "Save New CheckIn : " + objNewCheckIn.RegistrationNumber + "-At" + DateTime.Now, "ConfirmationPage.xaml.cs", "", "BtnYes_Clicked"); checkInPage = new CheckIn(); }); if (objResultCustomerParkingSlot.CustomerParkingSlotID != 0) { if (string.IsNullOrEmpty(objNewCheckIn.PhoneNumber)) { if (printerName != string.Empty && printerName != "") { PrintReceipt(); await Navigation.PushAsync(checkInPage); } else { await DisplayAlert("Alert", "Unable to find Bluetooth device", "Ok"); await Navigation.PushAsync(checkInPage); ShowLoading(false); btnYes.IsVisible = true; } } else { SendSMS(objNewCheckIn.PhoneNumber); await Navigation.PushAsync(checkInPage); } } else { await DisplayAlert("Alert", "Check-In Failed,Please contact Admin.", "Ok"); await Navigation.PushAsync(checkInPage); ShowLoading(false); btnYes.IsVisible = true; } } } else { await Task.Run(() => { App.SQLiteDb.SaveOfflineCheckInAsync(objNewCheckIn).Wait(); checkInPage = new CheckIn(); }); if (printerName != string.Empty && printerName != "") { PrintReceipt(); await Navigation.PushAsync(checkInPage); } else { await DisplayAlert("Alert", "Unable to find Bluetooth device", "Ok"); await Navigation.PushAsync(checkInPage); ShowLoading(false); btnYes.IsVisible = true; } ShowLoading(false); btnYes.IsVisible = true; } } catch (Exception ex) { ShowLoading(false); btnYes.IsVisible = true; dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "ConfirmationPage.xaml.cs", "", "BtnPrint_Clicked"); } IsbtnClicked = false; } catch (Exception ex) { ShowLoading(false); btnYes.IsVisible = true; dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "ConfirmationPage.xaml.cs", "", "BtnPrint_Clicked"); } }
private async void stk_CheckOutTapped(object sender, EventArgs e) { try { IsOnline = VerifyInternet(); if (IsOnline) { ParkingFee objParkingFee = new ParkingFee(); this.IsBusy = true; DateTime ActualEndTime = Convert.ToDateTime(objCustomerParkingSlotDetails.To); TimeSpan ds; int days; currentTime = DateTime.Now; ds = (currentTime.Date - Convert.ToDateTime(objCustomerParkingSlotDetails.To).Date); days = Convert.ToInt32(ds.Days); ShowLoading(true); await Task.Run(() => { objParkingFee = ValidateVehicleClamped(); }); if (objParkingFee.CustomerParkingSlotID != 0 && objParkingFee.StatusID != 5 && objParkingFee.StatusID != 6) { lblWarning.Text = "'" + Convert.ToString(objParkingFee.ViolationWarningCount) + "' Warning(s) Completed"; lblOverStayFee.Text = objParkingFee.Price == 0 ? "0" : Convert.ToString(decimal.Truncate(objParkingFee.Price)); lblClampFee.Text = objParkingFee.ClampFee == 0 ? "0" : Convert.ToString(decimal.Truncate(objParkingFee.ClampFee)); lblTotal.Text = Convert.ToDecimal(objParkingFee.Price) + Convert.ToDecimal(objParkingFee.ClampFee) == 0 ? "0" : Convert.ToString(decimal.Truncate((Convert.ToDecimal(objParkingFee.Price) + Convert.ToDecimal(objParkingFee.ClampFee)))); lblClampReason.Text = objParkingFee.ClampReason; if (objParkingFee.IsClamp) { stkSupervisor.IsVisible = true; stkClampWarning.IsVisible = true; IsClamp = objParkingFee.IsClamp; SupervisorPhoneNumber = objParkingFee.PhoneNumber; lblSupervisor.Text = objParkingFee.SupervisorName; lblPhoneNumber.Text = objParkingFee.PhoneNumber; ShowLoading(false); StklauoutactivityIndicator.IsVisible = false; await DisplayAlert("", "Sorry! Your vehicle is clamped. Please visit the Parking Lot", "Ok"); return; } else { if (days <= 0) { if (objParkingFee.Price != 0) { if (ActualEndTime < currentTime) { var confirmed = await DisplayAlert("", "Please confirm that you want to Check Out your Vehicle " + lblRegistrationNumber.Text + "", "Yes", "No"); if (confirmed) { CustomerParkingSlot obj_CustomerParkingSlot = new CustomerParkingSlot(); obj_CustomerParkingSlot.CustomerParkingSlotID = objCustomerParkingSlotDetails.CustomerParkingSlotID; obj_CustomerParkingSlot.ExpectedStartTime = objCustomerParkingSlotDetails.From.ToString("MM/dd/yyyy hh:mm tt"); obj_CustomerParkingSlot.ActualEndTime = DateTime.Now.ToString("MM/dd/yyyy hh:mm tt"); obj_CustomerParkingSlot.CustomerID = objCustomerParkingSlotDetails.CustomerID; obj_CustomerParkingSlot.LocationName = "CHECKOUT"; obj_CustomerParkingSlot.LocationParkingLotName = objCustomerParkingSlotDetails.LocationParkingLotName; obj_CustomerParkingSlot.PaidAmount = Convert.ToDecimal(objParkingFee.Price == 0 ? "0" : Convert.ToString(decimal.Truncate(objParkingFee.Price))); obj_CustomerParkingSlot.Duration = Convert.ToString(objParkingFee.Hours); ShowLoading(false); await Navigation.PushAsync(new RazorPayment(obj_CustomerParkingSlot, null)); } else { ShowLoading(false); StklauoutactivityIndicator.IsVisible = false; } } } else { var confirmed = await DisplayAlert("", "Please confirm that you want to Check Out your Vehicle " + lblRegistrationNumber.Text + "", "Yes", "No"); if (confirmed) { CustomerParkingSlot obj_CustomerParkingSlot = new CustomerParkingSlot(); obj_CustomerParkingSlot.CustomerParkingSlotID = objCustomerParkingSlotDetails.CustomerParkingSlotID; obj_CustomerParkingSlot.ExpectedStartTime = objCustomerParkingSlotDetails.From.ToString("MM/dd/yyyy hh:mm tt"); obj_CustomerParkingSlot.ActualEndTime = DateTime.Now.ToString("MM/dd/yyyy hh:mm tt"); obj_CustomerParkingSlot.CustomerID = objCustomerParkingSlotDetails.CustomerID; TimeSpan ts = Convert.ToDateTime(DateTime.Now) - Convert.ToDateTime(objCustomerParkingSlotDetails.From); obj_CustomerParkingSlot.Duration = Convert.ToString(ts.Hours); obj_CustomerParkingSlot.PaidAmount = 0; if (App.Current.Properties.ContainsKey("apitoken")) { var json = JsonConvert.SerializeObject(obj_CustomerParkingSlot); var content = new StringContent(json, Encoding.UTF8, "application/json"); CustomerParkingSlotDetails resultObj = dal_Customer.UpdateCheckOut(Convert.ToString(App.Current.Properties["apitoken"]), obj_CustomerParkingSlot); if (resultObj.CustomerParkingSlotID != 0) { App.Current.Properties["CustomerParkingSlotID"] = "0"; Application.Current.SavePropertiesAsync(); ShowLoading(false); StklauoutactivityIndicator.IsVisible = false; await DisplayAlert("", "Thank you for parking with us!", "Ok"); int CustomerID = 0; if (App.Current.Properties.ContainsKey("CustomerID")) { CustomerID = Convert.ToInt32(App.Current.Properties["CustomerID"]); } await Navigation.PushAsync(new Home(null, CustomerID)); } else { ShowLoading(false); StklauoutactivityIndicator.IsVisible = false; await DisplayAlert("", "Check Out failed", "Ok"); } } } else { ShowLoading(false); StklauoutactivityIndicator.IsVisible = false; } } } else { ShowLoading(false); StklauoutactivityIndicator.IsVisible = false; await DisplayAlert("", "This Vehicle cannot be Checked Out. Please visit the Parking Lot.", "Ok"); return; } } } else { if (objParkingFee.StatusID == 5 || objParkingFee.StatusID == 6) { lblOverStayFee.Text = "0"; lblClampFee.Text = "0"; lblTotal.Text = "0"; ShowLoading(false); StklauoutactivityIndicator.IsVisible = false; await DisplayAlert("", "Your Vehicle has been Checked Out!", "Ok"); int CustomerID = 0; if (App.Current.Properties.ContainsKey("CustomerID")) { CustomerID = Convert.ToInt32(App.Current.Properties["CustomerID"]); } await Navigation.PushAsync(new Home(null, CustomerID)); } else { //await DisplayAlert("Status - CustomerParkingSlotID : ", Convert.ToString(objParkingFee.StatusID) + " - " + Convert.ToString(objParkingFee.CustomerParkingSlotID), "Ok"); } } } else { await DisplayAlert("", "Please check your network connectivity", "Ok"); return; } } catch (Exception ex) { ShowLoading(false); StklauoutactivityIndicator.IsVisible = false; await DisplayAlert("Failed - CheckOut", Convert.ToString(ex.Message), "Ok"); } }
private void LoadParkingVehicleDetails(int customerParkingSlotID) { try { if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken")) { objresult = objHome.GetSelectedParkedVehicleDetails(Convert.ToString(App.Current.Properties["apitoken"]), customerParkingSlotID); 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; labelOverstayFrom.Text = objresult.ExpectedStartTime == null ? null : Convert.ToDateTime(objresult.ExpectedStartTime).ToString("dd MMM yyyy, hh:mm tt"); labelOverstayTo.Text = objresult.ActualEndTime == null?DateTime.Now.ToString("dd MMM yyyy, hh:mm tt") : Convert.ToDateTime(objresult.ActualEndTime).ToString("dd MMM yyyy, hh:mm tt"); User objloginuser = (User)App.Current.Properties["LoginUser"]; if (objloginuser.UserTypeID.UserTypeName.ToUpper() != "Operator".ToUpper()) { slFOC.IsVisible = true; } imageVehicleImage.Source = objresult.CustomerVehicleID.VehicleTypeID.VehicleIcon; labelVehicleDetails.Text = objresult.CustomerVehicleID.RegistrationNumber; imageParkingFeeImage.Source = "rupee_black.png"; labelParkingFeesDetails.Text = (objresult.PaidAmount).ToString("N2") + "/-"; //(objresult.Amount+objresult.ExtendAmount).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); objresult.Duration = (objresult.Duration == "" || objresult.Duration == string.Empty ? "0" : objresult.Duration); if (objresult.ApplicationTypeID.ApplicationTypeCode == "P") { labelParkingFeesDetails.Text = "Pass Check-In"; labelParkingPaymentType.Text = ""; imageParkingFeeImage.Source = ""; } else { labelParkingPaymentType.Text = "Paid for " + string.Format(((Math.Abs(parkingduration.Hours) == 0 || Math.Abs(parkingduration.Hours) == 1) ? Convert.ToInt32(objresult.Duration) : parkingduration.Hours) + "hr") + "- By " + objresult.PaymentTypeID.PaymentTypeName; } DateTime?actualendime = objresult.ActualEndTime == null ? DateTime.Now : Convert.ToDateTime(objresult.ActualEndTime); if (actualendime != null) { DateTime CurrentTime = DateTime.Now; TimeSpan t = CurrentTime - Convert.ToDateTime(actualendime); int totalHours = (t.Days > 0 ? t.Hours + (t.Days * 24) : t.Hours); objInputs = new ViolationVehicleFees(); objInputs.CustomerParkingSlotId = objresult.CustomerParkingSlotID; objInputs.LocationParkingLotID = objresult.LocationParkingLotID.LocationParkingLotID; objInputs.ParkingStartTime = Convert.ToDateTime(actualendime); objInputs.ParkingEndTime = CurrentTime; objInputs.VehicleTypeCode = objresult.VehicleTypeID.VehicleTypeCode; if (objresult.ClampFees > 0) { slCheckOut.IsVisible = false; slCash.IsVisible = true; slEPay.IsVisible = true; objInputs = dal_ViolationClamp.GetViolationVehicleCharges(Convert.ToString(App.Current.Properties["apitoken"]), objInputs); } else if ((Convert.ToInt32(t.TotalMinutes) > voilationBasicMinutes)) { slCheckOut.IsVisible = false; slCash.IsVisible = true; slEPay.IsVisible = true; objInputs = dal_ViolationClamp.GetViolationVehicleCharges(Convert.ToString(App.Current.Properties["apitoken"]), objInputs); } labelOverstayTimeDetails.Text = "OVERSTAY- " + (objresult.ActualEndTime == null ? "" : Convert.ToDateTime(objresult.ActualEndTime).ToString("hh:mm tt")) + " TO " + DateTime.Now.ToString("hh:mm tt"); labelOverstayTime.Text = string.Format(objInputs.TotalHours + " h : " + t.Minutes + " m"); objresult.ExtendAmount = objInputs.ParkingFee; objresult.Duration = Convert.ToString(objInputs.TotalHours); } #region Clamp and Warning data loading slVehicleWarning.IsVisible = (objresult.ViolationWarningCount >= 3) ? false : true; checkBoxClampVehicle.IsChecked = objresult.IsClamp; checkBoxClampVehicle.IsChecked = objresult.IsClamp; checkBoxClampVehicle.IsEnabled = !objresult.IsClamp; chkWarning.IsChecked = objresult.IsWarning; chkWarning.IsEnabled = !objresult.IsWarning; lblWarningCount.Text = (objresult.ViolationWarningCount > 3) ? "" : Convert.ToString(objresult.ViolationWarningCount) + " Warning(s) Completed"; lblClampFees.Text = (objresult.ClampFees > 0) ? objresult.ClampFees.ToString("N2") : "0.00"; lblParkingFees.Text = objInputs.ParkingFee == 0 ? "0.00" : objInputs.ParkingFee.ToString("N2"); lblTotal.Text = (objresult.ClampFees + objInputs.ParkingFee).ToString("N2"); if (objresult.ViolationReasonID.ViolationReasonID != 0) { for (int x = 0; x < lstReasons.Count; x++) { if (lstReasons[x].Reason.ToUpper() == objresult.ViolationReasonID.Reason.ToUpper()) { pickerViolationReason.SelectedIndex = x; pickerViolationReason.IsEnabled = false; checkBoxClampVehicle.IsEnabled = false; chkWarning.IsEnabled = false; } } } slPaymentAndExpand.IsVisible = true; frmClampbutton.IsVisible = false; #endregion } else { DisplayAlert("Alert", "Vehicle details unvailable,Please contact Admin", "Ok"); } } } catch (Exception ex) { ShowLoading(false); dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "OverstayVehicleInformation.xaml.cs", "", "LoadParkingVehicleDetails"); } }
public string UpdateVehicleClampStaus(CustomerParkingSlot objInPut) { string resultmsg = string.Empty; DALExceptionManagment objExceptionlog = new DALExceptionManagment(); try { using (SqlConnection sqlconn_obj = new SqlConnection(SqlHelper.GetDBConnectionString())) { using (SqlCommand sqlcmd_obj = new SqlCommand("OPAPP_PROC_UpdateVehicleClampStatus", sqlconn_obj)) { sqlcmd_obj.CommandType = CommandType.StoredProcedure; sqlcmd_obj.Parameters.AddWithValue("@CustomerParkingSlotID", objInPut.CustomerParkingSlotID); sqlcmd_obj.Parameters.AddWithValue("@CustomerVehicleID", objInPut.CustomerVehicleID.CustomerVehicleID); sqlcmd_obj.Parameters.AddWithValue("@LocationParkingLotID", objInPut.LocationParkingLotID.LocationParkingLotID); sqlcmd_obj.Parameters.AddWithValue("@IsClamp", objInPut.IsClamp); sqlcmd_obj.Parameters.AddWithValue("@IsWarning", Convert.ToBoolean(objInPut.IsWarning)); sqlcmd_obj.Parameters.AddWithValue("@StatusID", objInPut.StatusID.StatusID); sqlcmd_obj.Parameters.AddWithValue("@VehicleTypeID", objInPut.VehicleTypeID.VehicleTypeID); sqlcmd_obj.Parameters.AddWithValue("@RegistrationNumber", objInPut.CustomerVehicleID.RegistrationNumber); sqlcmd_obj.Parameters.AddWithValue("@ViolationReasonID", objInPut.ViolationReasonID.ViolationReasonID); sqlcmd_obj.Parameters.AddWithValue("@UserID", objInPut.CreatedBy); sqlconn_obj.Open(); SqlDataAdapter sqldap = new SqlDataAdapter(sqlcmd_obj); DataTable resultdt = new DataTable(); sqldap.Fill(resultdt); if (resultdt.Rows.Count > 0) { PushNotification pushNotification = new PushNotification(); NotificationContent notificationContent = new NotificationContent(); notificationContent.DeviceID = Convert.ToString(resultdt.Rows[0]["DeviceID"]); notificationContent.Title = "Clamp"; //notificationContent.TextMessage = "Your vehicle - " + Convert.ToString(resultdt.Rows[0]["RegistrationNumber"]) + " has been clamped due to " + Convert.ToString(resultdt.Rows[0]["Reason"]) + " at " + Convert.ToString(resultdt.Rows[0]["LocationName"]) + " metro station in the " + Convert.ToString(resultdt.Rows[0]["LocationParkingLotName"]) + " lot"; notificationContent.TextMessage = "Sorry! Your vehicle is clamped. Please visit the parking lot"; if (notificationContent.DeviceID != "") { pushNotification.SendPushNotification(notificationContent); } resultmsg = "Success"; } else { resultmsg = "Fail"; } /* * int result = sqlcmd_obj.ExecuteNonQuery(); * if (result > 0) * { * resultmsg = "Success"; * } * else * { * resultmsg = "Fail"; * } */ } } } catch (Exception ex) { objExceptionlog.InsertException("WebAPI", ex.Message, "DALVehicleCheckOut", "Proc: " + "OPAPP_PROC_UpdateVehicleClampStatus", "UpdateVehicleClampStaus"); throw; } return(resultmsg); }
public CustomerParkingSlot VehicleCheckOut(CustomerParkingSlot objInPut) { CustomerParkingSlot objcheckOut = new CustomerParkingSlot(); DALExceptionManagment objExceptionlog = new DALExceptionManagment(); try { using (SqlConnection sqlconn_obj = new SqlConnection(SqlHelper.GetDBConnectionString())) { using (SqlCommand sqlcmd_obj = new SqlCommand("OPAPP_PROC_SaveVehicleCheckOut", sqlconn_obj)) { sqlcmd_obj.CommandType = CommandType.StoredProcedure; sqlcmd_obj.Parameters.AddWithValue("@CustomerParkingSlotID", objInPut.CustomerParkingSlotID); sqlcmd_obj.Parameters.AddWithValue("@CustomerVehicleID", objInPut.CustomerVehicleID.CustomerVehicleID); sqlcmd_obj.Parameters.AddWithValue("@LocationParkingLotID", objInPut.LocationParkingLotID.LocationParkingLotID); sqlcmd_obj.Parameters.AddWithValue("@StatusName", objInPut.StatusID.StatusName); sqlcmd_obj.Parameters.AddWithValue("@PaymentType", objInPut.PaymentTypeID.PaymentTypeName); sqlcmd_obj.Parameters.AddWithValue("@IsClamp", objInPut.IsClamp); sqlcmd_obj.Parameters.AddWithValue("@ActualEndTime", objInPut.ActualEndTime); sqlcmd_obj.Parameters.AddWithValue("@Amount", objInPut.Amount); sqlcmd_obj.Parameters.AddWithValue("@ViolationFees", objInPut.ViolationFees); sqlcmd_obj.Parameters.AddWithValue("@ViolationReasonID", (objInPut.ViolationReasonID.ViolationReasonID == 0 || objInPut.ViolationReasonID.ViolationReasonID == null) ? (object)DBNull.Value : objInPut.ViolationReasonID.ViolationReasonID); sqlcmd_obj.Parameters.AddWithValue("@FOCReasonID", (objInPut.FOCReasonID.ViolationReasonID == 0 || objInPut.FOCReasonID.ViolationReasonID == null) ? (object)DBNull.Value : objInPut.FOCReasonID.ViolationReasonID); sqlcmd_obj.Parameters.AddWithValue("@ClampFees", objInPut.ClampFees); sqlcmd_obj.Parameters.AddWithValue("@ExtendAmount", objInPut.ExtendAmount); sqlcmd_obj.Parameters.AddWithValue("@PaidDueAmount", objInPut.DueAmount == 0 ? (object)DBNull.Value : objInPut.DueAmount); sqlcmd_obj.Parameters.AddWithValue("@ParkingDuration", objInPut.Duration); sqlcmd_obj.Parameters.AddWithValue("@UserID", objInPut.CreatedBy); sqlconn_obj.Open(); SqlDataAdapter sqldap = new SqlDataAdapter(sqlcmd_obj); DataTable resultdt = new DataTable(); sqldap.Fill(resultdt); if (resultdt.Rows.Count > 0) { objcheckOut.CustomerParkingSlotID = resultdt.Rows[0]["CustomerParkingSlotID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["CustomerParkingSlotID"]); objcheckOut.CustomerID.CustomerID = resultdt.Rows[0]["CustomerID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["CustomerID"]); objcheckOut.CustomerID.Name = Convert.ToString(resultdt.Rows[0]["Name"]); objcheckOut.LocationParkingLotID.LocationID.LocationID = resultdt.Rows[0]["LocationID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["LocationID"]); objcheckOut.LocationParkingLotID.LocationID.LocationName = Convert.ToString(resultdt.Rows[0]["LocationName"]); objcheckOut.LocationParkingLotID.LocationParkingLotID = resultdt.Rows[0]["LocationParkingLotID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["LocationParkingLotID"]); objcheckOut.LocationParkingLotID.LocationParkingLotName = Convert.ToString(resultdt.Rows[0]["LocationParkingLotName"]); objcheckOut.LocationParkingLotID.LotCloseTime = Convert.ToString(resultdt.Rows[0]["LotCloseTime"]); objcheckOut.LocationParkingLotID.LotOpenTime = Convert.ToString(resultdt.Rows[0]["LotOpenTime"]); objcheckOut.LocationParkingLotID.ParkingBayID.ParkingBayID = resultdt.Rows[0]["ParkingBayID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["ParkingBayID"]); objcheckOut.LocationParkingLotID.ParkingBayID.ParkingBayName = Convert.ToString(resultdt.Rows[0]["ParkingBayName"]); objcheckOut.LocationParkingLotID.ParkingBayID.ParkingBayRange = Convert.ToString(resultdt.Rows[0]["ParkingBayRange"]); objcheckOut.ExpectedStartTime = resultdt.Rows[0]["ExpectedStartTime"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(resultdt.Rows[0]["ExpectedStartTime"]); objcheckOut.ExpectedEndTime = resultdt.Rows[0]["ExpectedEndTime"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(resultdt.Rows[0]["ExpectedEndTime"]); objcheckOut.ActualStartTime = resultdt.Rows[0]["ActualStartTime"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(resultdt.Rows[0]["ActualStartTime"]); objcheckOut.ActualEndTime = resultdt.Rows[0]["ActualEndTime"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(resultdt.Rows[0]["ActualEndTime"]); objcheckOut.VehicleTypeID.VehicleTypeID = resultdt.Rows[0]["VehicleTypeID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["VehicleTypeID"]); objcheckOut.VehicleTypeID.VehicleTypeCode = Convert.ToString(resultdt.Rows[0]["VehicleTypeCode"]); objcheckOut.VehicleTypeID.VehicleTypeName = Convert.ToString(resultdt.Rows[0]["VehicleTypeName"]); string vehicleTypeCode = resultdt.Rows[0]["VehicleTypeCode"] == DBNull.Value ? "" : Convert.ToString(resultdt.Rows[0]["VehicleTypeCode"]);; objcheckOut.Duration = Convert.ToString(resultdt.Rows[0]["Duration"]); objcheckOut.PaymentTypeID.PaymentTypeID = resultdt.Rows[0]["PaymentTypeID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["PaymentTypeID"]); objcheckOut.PaymentTypeID.PaymentTypeName = Convert.ToString(resultdt.Rows[0]["PaymentTypeName"]); objcheckOut.CreatedBy = resultdt.Rows[0]["UserID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["UserID"]); objcheckOut.CreatedByName = Convert.ToString(resultdt.Rows[0]["UserName"]); objcheckOut.UserCode = resultdt.Rows[0]["UserCode"] == DBNull.Value ? "": Convert.ToString(resultdt.Rows[0]["UserCode"]); objcheckOut.Amount = resultdt.Rows[0]["Amount"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[0]["Amount"]); objcheckOut.ViolationFees = resultdt.Rows[0]["ViolationFees"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[0]["ViolationFees"]); objcheckOut.ClampFees = resultdt.Rows[0]["ClampFee"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[0]["ClampFee"]); objcheckOut.PaidAmount = resultdt.Rows[0]["PaidAmount"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[0]["PaidAmount"]); objcheckOut.DueAmount = resultdt.Rows[0]["DueAmount"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[0]["DueAmount"]); objcheckOut.PaidDueAmount = resultdt.Rows[0]["PaidDueAmount"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[0]["PaidDueAmount"]); objcheckOut.CustomerVehicleID.RegistrationNumber = Convert.ToString(resultdt.Rows[0]["RegistrationNumber"]); objcheckOut.CustomerVehicleID.CustomerVehicleID = resultdt.Rows[0]["CustomerVehicleID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["CustomerVehicleID"]); objcheckOut.IsClamp = resultdt.Rows[0]["IsClamp"] == DBNull.Value ? false : Convert.ToBoolean(resultdt.Rows[0]["IsClamp"]); objcheckOut.ExtendAmount = resultdt.Rows[0]["ExtendAmount"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[0]["ExtendAmount"]); objcheckOut.SuperVisorID.UserCode = resultdt.Rows[0]["SUPERVISORCODE"] == DBNull.Value ? "" : Convert.ToString(resultdt.Rows[0]["SUPERVISORCODE"]); objcheckOut.SuperVisorID.PhoneNumber = resultdt.Rows[0]["SUPERVISORPHONENUMBER"] == DBNull.Value ? "" : Convert.ToString(resultdt.Rows[0]["SUPERVISORPHONENUMBER"]); objcheckOut.ApplicationTypeID.ApplicationTypeCode = resultdt.Rows[0]["ApplicationTypeCode"] == DBNull.Value ? "" : Convert.ToString(resultdt.Rows[0]["ApplicationTypeCode"]); objcheckOut.ApplicationTypeID.ApplicationTypeName = resultdt.Rows[0]["ApplicationTypeName"] == DBNull.Value ? "" : Convert.ToString(resultdt.Rows[0]["ApplicationTypeName"]); objcheckOut.CustomerVehicleID.VehicleTypeID.VehicleTypeID = resultdt.Rows[0]["VehicleTypeID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["VehicleTypeID"]); objcheckOut.CustomerVehicleID.VehicleTypeID.VehicleTypeCode = Convert.ToString(resultdt.Rows[0]["VehicleTypeCode"]); objcheckOut.CustomerVehicleID.VehicleTypeID.VehicleTypeName = Convert.ToString(resultdt.Rows[0]["VehicleTypeName"]); objcheckOut.GSTNumber = "36AACFZ1015E1ZL"; if (vehicleTypeCode.ToUpper() == "2W") { objcheckOut.VehicleTypeID.VehicleTypeDisplayName = "BIKE"; objcheckOut.VehicleTypeID.VehicleDisplayImage = "Twowheeler_circle.png"; //Default InActive Image objcheckOut.VehicleTypeID.VehicleIcon = "bike_black.png"; } else if (vehicleTypeCode.ToUpper() == "3W") { objcheckOut.VehicleTypeID.VehicleTypeDisplayName = "Three Wheeler"; objcheckOut.VehicleTypeID.VehicleDisplayImage = "ThreeW.png"; //Default InActive Image objcheckOut.VehicleTypeID.VehicleIcon = "ThreeW_black.png"; } else if (vehicleTypeCode.ToUpper() == "4W") { objcheckOut.VehicleTypeID.VehicleTypeDisplayName = "CAR"; objcheckOut.VehicleTypeID.VehicleDisplayImage = "Fourwheeler_circle.png"; //Default InActive Image objcheckOut.VehicleTypeID.VehicleIcon = "car_black.png"; } else if (vehicleTypeCode.ToUpper() == "HW") { objcheckOut.VehicleTypeID.VehicleTypeDisplayName = "Heavy Vehicle"; objcheckOut.VehicleTypeID.VehicleDisplayImage = "bus.png"; //Default InActive Image objcheckOut.VehicleTypeID.VehicleIcon = "hv_black.png"; } PushNotification pushNotification = new PushNotification(); NotificationContent notificationContent = new NotificationContent(); notificationContent.DeviceID = Convert.ToString(resultdt.Rows[0]["DeviceID"]); notificationContent.Title = "Check Out"; //notificationContent.TextMessage = "Your vehicle - " + Convert.ToString(resultdt.Rows[0]["RegistrationNumber"]) + " has been checked out from " + Convert.ToString(resultdt.Rows[0]["LocationName"]) + " metro station in the " + Convert.ToString(resultdt.Rows[0]["LocationParkingLotName"]) + " lot"; notificationContent.TextMessage = "Your vehicle is checked out. Thank you for parking with us"; if (notificationContent.DeviceID != "") { pushNotification.SendPushNotification(notificationContent); } } } } } catch (Exception ex) { objExceptionlog.InsertException("WebAPI", ex.Message, "DALVehicleCheckOut", "Proc: " + "OPAPP_PROC_SaveVehicleCheckOut", "VehicleCheckOut"); throw; } return(objcheckOut); }
public CustomerParkingSlot SaveVehicleNewCheckIn(VehicleCheckIn obj) { CustomerParkingSlot objCustomerParkingSlot = new CustomerParkingSlot(); DataTable resultdt = new DataTable(); try { using (SqlConnection sqlconn_obj = new SqlConnection(SqlHelper.GetDBConnectionString())) { using (SqlCommand sqlcmd_obj = new SqlCommand("OPAPP_PROC_SaveVehicleNewCheckIn", sqlconn_obj)) { sqlcmd_obj.CommandType = CommandType.StoredProcedure; sqlcmd_obj.Parameters.AddWithValue("@CustomerParkingSlotID", (obj.CustomerParkingSlotID == 0) ? (object)DBNull.Value : obj.CustomerParkingSlotID); sqlcmd_obj.Parameters.AddWithValue("@UserID", obj.UserID); sqlcmd_obj.Parameters.AddWithValue("@LocationID", obj.LocationID); sqlcmd_obj.Parameters.AddWithValue("@LocationParkingLotID", obj.LocationParkingLotID); sqlcmd_obj.Parameters.AddWithValue("@BayNumberID", obj.BayNumberID); sqlcmd_obj.Parameters.AddWithValue("@VehicleTypeCode", obj.VehicleTypeCode); sqlcmd_obj.Parameters.AddWithValue("@RegistrationNumber", obj.RegistrationNumber); sqlcmd_obj.Parameters.AddWithValue("@PhoneNumber", obj.PhoneNumber); sqlcmd_obj.Parameters.AddWithValue("@ParkingStartTime", obj.ParkingStartTime); sqlcmd_obj.Parameters.AddWithValue("@ParkingEndTime", obj.ParkingEndTime); sqlcmd_obj.Parameters.AddWithValue("@PaymentType", obj.PaymentType); sqlcmd_obj.Parameters.AddWithValue("@ParkingHours", obj.ParkingHours); sqlcmd_obj.Parameters.AddWithValue("@ParkingFees", obj.ParkingFees); sqlcmd_obj.Parameters.AddWithValue("@ClampFees", (obj.ClampFees == null || obj.ClampFees == 0) ? (object)DBNull.Value : obj.ClampFees); sqlcmd_obj.Parameters.AddWithValue("@PaidDueAmount", (obj.DueAmount == null || obj.DueAmount == 0) ? (object)DBNull.Value : obj.DueAmount); sqlconn_obj.Open(); SqlDataAdapter sqldap = new SqlDataAdapter(sqlcmd_obj); sqldap.Fill(resultdt); if (resultdt.Rows.Count > 0) { objCustomerParkingSlot.CustomerParkingSlotID = resultdt.Rows[0]["CustomerParkingSlotID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["CustomerParkingSlotID"]); objCustomerParkingSlot.CustomerID.CustomerID = resultdt.Rows[0]["CustomerID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["CustomerID"]); objCustomerParkingSlot.CustomerID.Name = Convert.ToString(resultdt.Rows[0]["Name"]); objCustomerParkingSlot.LocationParkingLotID.LocationID.LocationID = resultdt.Rows[0]["LocationID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["LocationID"]); objCustomerParkingSlot.LocationParkingLotID.LocationID.LocationName = Convert.ToString(resultdt.Rows[0]["LocationName"]); objCustomerParkingSlot.LocationParkingLotID.LocationParkingLotID = resultdt.Rows[0]["LocationParkingLotID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["LocationParkingLotID"]); objCustomerParkingSlot.LocationParkingLotID.LocationParkingLotName = Convert.ToString(resultdt.Rows[0]["LocationParkingLotName"]); objCustomerParkingSlot.LocationParkingLotID.LotOpenTime = Convert.ToString(resultdt.Rows[0]["LotOpenTime"]); objCustomerParkingSlot.LocationParkingLotID.LotCloseTime = Convert.ToString(resultdt.Rows[0]["LotCloseTime"]); objCustomerParkingSlot.LocationParkingLotID.ParkingBayID.ParkingBayID = resultdt.Rows[0]["ParkingBayID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["ParkingBayID"]); objCustomerParkingSlot.LocationParkingLotID.ParkingBayID.ParkingBayName = Convert.ToString(resultdt.Rows[0]["ParkingBayName"]); objCustomerParkingSlot.LocationParkingLotID.ParkingBayID.ParkingBayRange = Convert.ToString(resultdt.Rows[0]["ParkingBayRange"]); objCustomerParkingSlot.ExpectedStartTime = Convert.ToDateTime(resultdt.Rows[0]["ExpectedStartTime"]); objCustomerParkingSlot.ExpectedEndTime = Convert.ToDateTime(resultdt.Rows[0]["ExpectedEndTime"]); objCustomerParkingSlot.ActualStartTime = Convert.ToDateTime(resultdt.Rows[0]["ActualStartTime"]); objCustomerParkingSlot.ActualEndTime = Convert.ToDateTime(resultdt.Rows[0]["ActualEndTime"]); objCustomerParkingSlot.VehicleTypeID.VehicleTypeID = resultdt.Rows[0]["VehicleTypeID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["VehicleTypeID"]); objCustomerParkingSlot.VehicleTypeID.VehicleTypeCode = Convert.ToString(resultdt.Rows[0]["VehicleTypeCode"]); objCustomerParkingSlot.VehicleTypeID.VehicleTypeName = Convert.ToString(resultdt.Rows[0]["VehicleTypeName"]); if (Convert.ToString(resultdt.Rows[0]["VehicleTypeCode"]).ToUpper() == "2W") { objCustomerParkingSlot.VehicleTypeID.VehicleTypeDisplayName = "BIKE"; } else if (Convert.ToString(resultdt.Rows[0]["VehicleTypeCode"]).ToUpper() == "3W") { objCustomerParkingSlot.VehicleTypeID.VehicleTypeDisplayName = "THREE WHEELER"; } else if (Convert.ToString(resultdt.Rows[0]["VehicleTypeCode"]).ToUpper() == "4W") { objCustomerParkingSlot.VehicleTypeID.VehicleTypeDisplayName = "CAR"; } else if (Convert.ToString(resultdt.Rows[0]["VehicleTypeCode"]).ToUpper() == "HW") { objCustomerParkingSlot.VehicleTypeID.VehicleTypeDisplayName = "HEAVY VEHICLE"; } objCustomerParkingSlot.Duration = Convert.ToString(resultdt.Rows[0]["Duration"]); objCustomerParkingSlot.PaymentTypeID.PaymentTypeID = Convert.ToInt32(resultdt.Rows[0]["PaymentTypeID"]); objCustomerParkingSlot.PaymentTypeID.PaymentTypeName = Convert.ToString(resultdt.Rows[0]["PaymentTypeName"]); objCustomerParkingSlot.CreatedBy = resultdt.Rows[0]["UserID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["UserID"]); objCustomerParkingSlot.UserCode = resultdt.Rows[0]["USERCODE"] == DBNull.Value ? "" : Convert.ToString(resultdt.Rows[0]["USERCODE"]); objCustomerParkingSlot.SuperVisorID.UserCode = resultdt.Rows[0]["SUPERVISORCODE"] == DBNull.Value ? "" : Convert.ToString(resultdt.Rows[0]["SUPERVISORCODE"]); objCustomerParkingSlot.SuperVisorID.PhoneNumber = resultdt.Rows[0]["SUPERVISORPHONENUMBER"] == DBNull.Value ? "" : Convert.ToString(resultdt.Rows[0]["SUPERVISORPHONENUMBER"]); objCustomerParkingSlot.CreatedByName = Convert.ToString(resultdt.Rows[0]["UserName"]); objCustomerParkingSlot.Amount = resultdt.Rows[0]["Amount"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[0]["Amount"]); objCustomerParkingSlot.PaidDueAmount = resultdt.Rows[0]["PaidDueAmount"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[0]["PaidDueAmount"]); objCustomerParkingSlot.ClampFees = resultdt.Rows[0]["ClampFee"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[0]["ClampFee"]); objCustomerParkingSlot.PaidAmount = resultdt.Rows[0]["PaidAmount"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[0]["PaidAmount"]); objCustomerParkingSlot.ExtendAmount = resultdt.Rows[0]["ExtendAmount"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[0]["ExtendAmount"]); objCustomerParkingSlot.CustomerVehicleID.RegistrationNumber = Convert.ToString(resultdt.Rows[0]["RegistrationNumber"]); objCustomerParkingSlot.CustomerVehicleID.CustomerVehicleID = resultdt.Rows[0]["CustomerVehicleID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["CustomerVehicleID"]); objCustomerParkingSlot.IsClamp = resultdt.Rows[0]["IsClamp"] == DBNull.Value ? false : Convert.ToBoolean(resultdt.Rows[0]["IsClamp"]); objCustomerParkingSlot.ApplicationTypeID.ApplicationTypeID = resultdt.Rows[0]["ApplicationTypeID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["ApplicationTypeID"]); objCustomerParkingSlot.ApplicationTypeID.ApplicationTypeCode = Convert.ToString(resultdt.Rows[0]["ApplicationTypeCode"]); objCustomerParkingSlot.GSTNumber = "36AACFZ1015E1ZL"; } } } } catch (Exception ex) { objExceptionlog.InsertException("WebAPI", ex.Message, "DALCheckIn", "Proc: " + "OPAPP_PROC_SaveVehicleNewCheckIn", "SaveVehicleNewCheckIn"); } return(objCustomerParkingSlot); }
public void LoadReceiptDetails(CustomerParkingSlot objCheckInReceipt) { try { string vehicleType = string.Empty; labelParkingLocation.Text = objCheckInReceipt.LocationParkingLotID.LocationID.LocationName + "-" + objCheckInReceipt.LocationParkingLotID.LocationParkingLotName + "," + objCheckInReceipt.LocationParkingLotID.ParkingBayID.ParkingBayName + " " + objCheckInReceipt.LocationParkingLotID.ParkingBayID.ParkingBayRange; labelValidFrom.Text = objCheckInReceipt.ActualStartTime == null ? "" : Convert.ToDateTime(objCheckInReceipt.ActualStartTime).ToString("dd MMM yyyy,hh:mm tt"); labelValidTo.Text = objCheckInReceipt.ActualEndTime == null ? "" : Convert.ToDateTime(objCheckInReceipt.ActualEndTime).ToString("dd MMM yyyy,hh:mm tt"); if (objCheckInReceipt.VehicleTypeID.VehicleTypeCode == "2W") { vehicleType = "BIKE"; imageVehicleImage.Source = ImageSource.FromFile("bike_black.jpg"); } else if (objCheckInReceipt.VehicleTypeID.VehicleTypeCode == "4W") { vehicleType = "CAR"; imageVehicleImage.Source = ImageSource.FromFile("car_black.jpg"); } labelRegistration.Text = objCheckInReceipt.CustomerVehicleID.RegistrationNumber; imageParkingFeeImage.Source = "rupee_black.png"; TimeSpan t = Convert.ToDateTime(objCheckInReceipt.ActualEndTime) - Convert.ToDateTime(objCheckInReceipt.ActualStartTime); int totalHours = (t.Days > 0 ? t.Hours + (t.Days * 24) : t.Hours); string duration = "Paid for " + string.Format(totalHours + "hr"); decimal totalParkingAmount = objCheckInReceipt.PaidAmount;// + objCheckInReceipt.ExtendAmount; labelParkingFeesDetails.Text = totalParkingAmount.ToString("N2") + "/-" + duration; labelParkingPaymentType.Text = "- By " + objCheckInReceipt.PaymentTypeID.PaymentTypeName; imageOperatorProfile.Source = "operator.png"; labelOperatorName.Text = objCheckInReceipt.CreatedByName; labelOperatorID.Text = "- #" + objCheckInReceipt.UserCode; objCheckInReceipt.LocationParkingLotID.LotTimmings = "6am - 10pm (Mon-Sat) and 12pm - 8pm (Sun)"; try { if (receiptlines != null && receiptlines.Length > 0) { receiptlines[0] = "\x1B\x21\x12" + " " + "HMRL PARKING" + "\x1B\x21\x00" + "\n"; receiptlines[1] = "\x1B\x21\x01" + " " + objCheckInReceipt.LocationParkingLotID.LocationID.LocationName + "-" + objCheckInReceipt.LocationParkingLotID.LocationParkingLotName + "\n"; receiptlines[2] = " " + "\n"; receiptlines[3] = "\x1B\x21\x08" + vehicleType + " " + objCheckInReceipt.CustomerVehicleID.RegistrationNumber + "\x1B\x21\x00" + "\n"; receiptlines[4] = "\x1B\x21\x08" + objCheckInReceipt.ActualStartTime == null ? "" : Convert.ToDateTime(objCheckInReceipt.ActualStartTime).ToString("dd MMM yyyy,hh:mm tt") + "\x1B\x21\x00\n"; receiptlines[5] = "" + "\n"; receiptlines[6] = "\x1B\x21\x01" + "Paid Rs" + objCheckInReceipt.Amount.ToString("N2") + "\x1B\x21\x00\n"; receiptlines[7] = "\x1B\x21\x01" + "Parked at - Bays:" + objCheckInReceipt.LocationParkingLotID.ParkingBayID.ParkingBayRange + "\x1B\x21\x00\n"; receiptlines[8] = "\x1B\x21\x01" + "OPERATOR ID -" + objCheckInReceipt.UserCode + "\x1B\x21\x00\n"; receiptlines[9] = "\x1B\x21\x01" + "Security available " + objCheckInReceipt.LocationParkingLotID.LotTimmings + "\x1B\x21\x00\n"; receiptlines[10] = "\x1B\x21\x01" + "We are not responsible for your valuable items like laptop, wallet,helmet etc." + "\x1B\x21\x00\n"; receiptlines[11] = "\x1B\x21\x01" + "GST Number 36AACFZ1015E1ZL" + "\x1B\x21\x00\n"; receiptlines[12] = "\x1B\x21\x01" + "Amount includes 18% GST" + "\x1B\x21\x00\n"; receiptlines[13] = "" + "\n"; receiptlines[14] = "" + "\n"; receiptlines[15] = "" + "\n"; } } catch (Exception ex) { } } catch (Exception ex) { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "ReceiptPage.xaml.cs", "", "LoadReceiptDetails"); } }
public List <CustomerParkingSlot> GetVehicleDueAmountHistory(string RegistrationNumber, string VehicleTypeCode) { List <CustomerParkingSlot> lstVehicleParkingDetails = new List <CustomerParkingSlot>(); DataTable resultdt = new DataTable(); int VehicleWarningCount = 0; try { using (SqlConnection sqlconn_obj = new SqlConnection(SqlHelper.GetDBConnectionString())) { using (SqlCommand sqlcmd_obj = new SqlCommand("OPAPP_PROC_Get_VehicleDueAmountHistory", sqlconn_obj)) { sqlcmd_obj.CommandType = CommandType.StoredProcedure; sqlcmd_obj.Parameters.AddWithValue("@RegistrationNumber", RegistrationNumber); sqlcmd_obj.Parameters.AddWithValue("@VehicleTypeCode", VehicleTypeCode); sqlconn_obj.Open(); SqlDataAdapter sqldap = new SqlDataAdapter(sqlcmd_obj); sqldap.Fill(resultdt); if (resultdt.Rows.Count > 0) { for (var i = 0; i < resultdt.Rows.Count; i++) { decimal totalParkingAmount = 0; CustomerParkingSlot objCustomerParkingSlot = new CustomerParkingSlot(); objCustomerParkingSlot.CustomerParkingSlotID = resultdt.Rows[i]["CustomerParkingSlotID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[i]["CustomerParkingSlotID"]); objCustomerParkingSlot.CustomerID.CustomerID = resultdt.Rows[i]["CustomerID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[i]["CustomerID"]); objCustomerParkingSlot.UserCode = Convert.ToString(resultdt.Rows[i]["UserCode"]); objCustomerParkingSlot.LocationParkingLotID.LocationID.LocationID = resultdt.Rows[i]["LocationID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[i]["LocationID"]); objCustomerParkingSlot.LocationParkingLotID.LocationID.LocationName = Convert.ToString(resultdt.Rows[i]["LocationName"]); objCustomerParkingSlot.LocationParkingLotID.LocationParkingLotID = resultdt.Rows[i]["LocationParkingLotID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[i]["LocationParkingLotID"]); objCustomerParkingSlot.LocationParkingLotID.LocationParkingLotName = Convert.ToString(resultdt.Rows[i]["LocationParkingLotName"]); objCustomerParkingSlot.LocationParkingLotID.ParkingBayID.ParkingBayID = resultdt.Rows[i]["ParkingBayID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[i]["ParkingBayID"]); objCustomerParkingSlot.ParkingBayID.ParkingBayID = resultdt.Rows[i]["ParkingBayID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[i]["ParkingBayID"]); objCustomerParkingSlot.LocationParkingLotID.ParkingBayID.ParkingBayName = Convert.ToString(resultdt.Rows[i]["ParkingBayName"]); objCustomerParkingSlot.LocationParkingLotID.ParkingBayID.ParkingBayRange = Convert.ToString(resultdt.Rows[i]["ParkingBayRange"]); objCustomerParkingSlot.ExpectedStartTime = resultdt.Rows[i]["ExpectedStartTime"] == DBNull.Value ? (Nullable <DateTime>)null : Convert.ToDateTime(resultdt.Rows[i]["ExpectedStartTime"]); objCustomerParkingSlot.ExpectedEndTime = resultdt.Rows[i]["ExpectedEndTime"] == DBNull.Value ? (Nullable <DateTime>)null : Convert.ToDateTime(resultdt.Rows[i]["ExpectedEndTime"]); objCustomerParkingSlot.ActualStartTime = resultdt.Rows[i]["ActualStartTime"] == DBNull.Value ? (Nullable <DateTime>)null : Convert.ToDateTime(resultdt.Rows[i]["ActualStartTime"]); objCustomerParkingSlot.ActualEndTime = resultdt.Rows[i]["ActualEndTime"] == DBNull.Value ? (Nullable <DateTime>)null : Convert.ToDateTime(resultdt.Rows[i]["ActualEndTime"]); objCustomerParkingSlot.Duration = Convert.ToString(resultdt.Rows[i]["Duration"]); objCustomerParkingSlot.PaymentTypeID.PaymentTypeID = resultdt.Rows[i]["PaymentTypeID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[i]["PaymentTypeID"]); objCustomerParkingSlot.PaymentTypeID.PaymentTypeName = Convert.ToString(resultdt.Rows[i]["PaymentTypeName"]); objCustomerParkingSlot.CreatedBy = resultdt.Rows[i]["UserID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[i]["UserID"]); objCustomerParkingSlot.CreatedByName = Convert.ToString(resultdt.Rows[i]["UserName"]); objCustomerParkingSlot.SuperVisorID.PhoneNumber = Convert.ToString(resultdt.Rows[i]["SUPERVISORPHONENUMBER"]); objCustomerParkingSlot.PaidAmount = resultdt.Rows[i]["PaidAmount"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[i]["PaidAmount"]); objCustomerParkingSlot.DueAmount = resultdt.Rows[i]["DueAmount"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[i]["DueAmount"]); objCustomerParkingSlot.IsWarning = resultdt.Rows[i]["IsWarning"] == DBNull.Value ? false : Convert.ToBoolean(resultdt.Rows[i]["IsWarning"]); objCustomerParkingSlot.IsClamp = resultdt.Rows[i]["IsClamp"] == DBNull.Value ? false : Convert.ToBoolean(resultdt.Rows[i]["IsClamp"]); objCustomerParkingSlot.ClampFees = resultdt.Rows[i]["ClampFee"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[i]["ClampFee"]); objCustomerParkingSlot.ViolationFees = resultdt.Rows[i]["ViolationFees"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[i]["ViolationFees"]); //Total Parking Amount if (Convert.ToString(resultdt.Rows[i]["StatusCode"]) != "FOC") { totalParkingAmount = ((resultdt.Rows[i]["Amount"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[i]["Amount"])) + (resultdt.Rows[i]["ExtendAmount"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[i]["ExtendAmount"]))); } objCustomerParkingSlot.Amount = totalParkingAmount; objCustomerParkingSlot.CustomerVehicleID.RegistrationNumber = Convert.ToString(resultdt.Rows[i]["RegistrationNumber"]); objCustomerParkingSlot.CustomerVehicleID.CustomerVehicleID = resultdt.Rows[i]["CustomerVehicleID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[i]["CustomerVehicleID"]); objCustomerParkingSlot.ApplicationTypeID.ApplicationTypeID = resultdt.Rows[i]["ApplicationTypeID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[i]["ApplicationTypeID"]); objCustomerParkingSlot.ApplicationTypeID.ApplicationTypeCode = Convert.ToString(resultdt.Rows[i]["ApplicationTypeCode"]); objCustomerParkingSlot.ApplicationTypeID.ApplicationTypeName = Convert.ToString(resultdt.Rows[i]["ApplicationTypeName"]); objCustomerParkingSlot.ViolationReasonID.ViolationReasonID = resultdt.Rows[i]["ViolationReasonID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[i]["ViolationReasonID"]); objCustomerParkingSlot.ViolationReasonID.Reason = Convert.ToString(resultdt.Rows[i]["Reason"]); //FOC Reason objCustomerParkingSlot.FOCReasonID.ViolationReasonID = resultdt.Rows[i]["FOCReasonID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[i]["FOCReasonID"]); objCustomerParkingSlot.FOCReasonID.Reason = Convert.ToString(resultdt.Rows[i]["FOCReason"]); //FOC Reason END objCustomerParkingSlot.VehicleParkingImage = resultdt.Rows[i]["VehicleParkingImage"] == DBNull.Value ? null : (byte[])resultdt.Rows[i]["VehicleParkingImage"]; objCustomerParkingSlot.StatusID.StatusCode = Convert.ToString(resultdt.Rows[i]["StatusCode"]); objCustomerParkingSlot.StatusID.StatusName = Convert.ToString(resultdt.Rows[i]["StatusName"]); objCustomerParkingSlot.StatusID.StatusColor = "#010101"; // App Style objCustomerParkingSlot.ApplicationTypeID.ApplicationTypeColor = "#3293fa"; bool IsViolationRec = resultdt.Rows[i]["IsViolation"] == DBNull.Value ? false : Convert.ToBoolean(resultdt.Rows[i]["IsViolation"]); if (Convert.ToString(resultdt.Rows[i]["StatusCode"]) == "C" || Convert.ToString(resultdt.Rows[i]["StatusCode"]) == "V" || IsViolationRec) { objCustomerParkingSlot.ApplicationTypeID.ApplicationTypeCode = "V"; objCustomerParkingSlot.StatusID.StatusColor = "#ff0000"; // App Style objCustomerParkingSlot.ApplicationTypeID.ApplicationTypeColor = "#ff0000"; } if (Convert.ToString(resultdt.Rows[i]["StatusCode"]) == "FOC") { if (IsViolationRec) { objCustomerParkingSlot.ApplicationTypeID.ApplicationTypeCode = "V"; } objCustomerParkingSlot.StatusID.StatusColor = "#ff0000"; // App Style } if (((resultdt.Rows[i]["IsWarning"] == DBNull.Value) ? false : Convert.ToBoolean(resultdt.Rows[i]["IsWarning"]))) { VehicleWarningCount = VehicleWarningCount + 1; objCustomerParkingSlot.ViolationWarningCount = VehicleWarningCount;// resultdt.Rows[i]["ViolationWarningCount"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[i]["ViolationWarningCount"]); } else { objCustomerParkingSlot.ViolationWarningCount = VehicleWarningCount; } objCustomerParkingSlot.VehicleTypeID.VehicleTypeID = Convert.ToInt32(resultdt.Rows[i]["VehicleTypeID"]); objCustomerParkingSlot.VehicleTypeID.VehicleTypeCode = Convert.ToString(resultdt.Rows[i]["VehicleTypeCode"]); objCustomerParkingSlot.VehicleTypeID.VehicleTypeName = Convert.ToString(resultdt.Rows[i]["VehicleTypeName"]); objCustomerParkingSlot.GSTNumber = "36AACFZ1015E1ZL"; string vehicleTypeCode = Convert.ToString(resultdt.Rows[i]["VehicleTypeCode"]); if (vehicleTypeCode.ToUpper() == "2W") { objCustomerParkingSlot.VehicleTypeID.VehicleTypeDisplayName = "BIKE"; objCustomerParkingSlot.VehicleTypeID.VehicleDisplayImage = "Twowheeler_circle.png"; //Default InActive Image objCustomerParkingSlot.VehicleTypeID.VehicleIcon = "bike_black.png"; objCustomerParkingSlot.CustomerVehicleID.VehicleTypeID.VehicleIcon = "bike_black.png"; } else if (vehicleTypeCode.ToUpper() == "3W") { objCustomerParkingSlot.VehicleTypeID.VehicleTypeDisplayName = "Three Wheeler"; objCustomerParkingSlot.VehicleTypeID.VehicleDisplayImage = "ThreeW.png"; //Default InActive Image objCustomerParkingSlot.VehicleTypeID.VehicleIcon = "ThreeW_black.png"; objCustomerParkingSlot.CustomerVehicleID.VehicleTypeID.VehicleIcon = "ThreeW_black.png"; } else if (vehicleTypeCode.ToUpper() == "4W") { objCustomerParkingSlot.VehicleTypeID.VehicleTypeDisplayName = "CAR"; objCustomerParkingSlot.VehicleTypeID.VehicleDisplayImage = "Fourwheeler_circle.png"; //Default InActive Image objCustomerParkingSlot.VehicleTypeID.VehicleIcon = "car_black.png"; objCustomerParkingSlot.CustomerVehicleID.VehicleTypeID.VehicleIcon = "car_black.png"; } else if (vehicleTypeCode.ToUpper() == "HW") { objCustomerParkingSlot.VehicleTypeID.VehicleTypeDisplayName = "Heavy Vehicle"; objCustomerParkingSlot.VehicleTypeID.VehicleDisplayImage = "bus.png"; //Default InActive Image objCustomerParkingSlot.VehicleTypeID.VehicleIcon = "hv_black.png"; objCustomerParkingSlot.CustomerVehicleID.VehicleTypeID.VehicleIcon = "hv_black.png"; } lstVehicleParkingDetails.Add(objCustomerParkingSlot); } } } } } catch (Exception ex) { objExceptionlog.InsertException("WebAPI", ex.Message, "DALCustomerVehicleParkingLot", "Proc: " + "OPAPP_PROC_GetVehicleParkingHistory", "GetVehicleParkingHistory"); } return(lstVehicleParkingDetails); }
private void LoadVehicleCheckOutDetails(string pageStatus, CustomerParkingSlot objCheckOutReceipt) { try { string vehicleType = string.Empty; labelParkingLocation.Text = objCheckOutReceipt.LocationParkingLotID.LocationID.LocationName + " " + objCheckOutReceipt.LocationParkingLotID.LocationParkingLotName + " " + objCheckOutReceipt.LocationParkingLotID.ParkingBayID.ParkingBayName + " " + objCheckOutReceipt.LocationParkingLotID.ParkingBayID.ParkingBayRange; labelValidFrom.Text = objCheckOutReceipt.ActualStartTime == null ? "" : Convert.ToDateTime(objCheckOutReceipt.ActualStartTime).ToString("dd MMM yyyy,hh:mm tt"); labelValidTo.Text = objCheckOutReceipt.ActualEndTime == null ? "" : Convert.ToDateTime(objCheckOutReceipt.ActualEndTime).ToString("dd MMM yyyy,hh:mm tt"); vehicleType = objCheckOutReceipt.VehicleTypeID.VehicleTypeDisplayName; imageVehicleImage.Source = objCheckOutReceipt.VehicleTypeID.VehicleIcon; labelVehicleDetails.Text = objCheckOutReceipt.CustomerVehicleID.RegistrationNumber; imageParkingFeeImage.Source = "rupee_black.png"; decimal totalParkingFees = (objCheckOutReceipt.ExtendAmount + objCheckOutReceipt.ViolationFees + objCheckOutReceipt.ClampFees + objCheckOutReceipt.PaidDueAmount); labelParkingFeesDetails.Text = totalParkingFees.ToString("N2") + "/-"; //objCheckOutReceipt.PaidAmount.ToString("N2") + "/-"; if ((objCheckOutReceipt.ExtendAmount + objCheckOutReceipt.ViolationFees + objCheckOutReceipt.PaidDueAmount) > 0) { labelParkingPaymentType.Text = "Paid for " + objCheckOutReceipt.Duration + "hr - " + "By " + objCheckOutReceipt.PaymentTypeID.PaymentTypeName; } else { labelParkingPaymentType.Text = "By " + objCheckOutReceipt.PaymentTypeID.PaymentTypeName; } labelCheckOutFeesDetails.Text = "(Parking" + " ₹" + (objCheckOutReceipt.ExtendAmount + objCheckOutReceipt.ViolationFees).ToString("N2") + " + " + "Clamp" + " ₹" + objCheckOutReceipt.ClampFees + " + " + " Paid DueAmount" + " ₹" + objCheckOutReceipt.PaidDueAmount + ")"; imageOperatorProfile.Source = "operator.png"; if (objCheckOutReceipt.CreatedByName != "") { labelOperatorName.Text = objCheckOutReceipt.CreatedByName; labelOperatorID.Text = "- #" + objCheckOutReceipt.UserCode; imageOperatorProfile.IsVisible = true; } else { imageOperatorProfile.IsVisible = false; } try { if (receiptlines != null && receiptlines.Length > 0) { receiptlines[0] = "\x1B\x21\x08" + " " + "HMRL PARKING" + "\x1B\x21\x00" + "\n"; receiptlines[1] = "\x1B\x21\x01" + " " + objCheckOutReceipt.LocationParkingLotID.LocationID.LocationName + "-" + objCheckOutReceipt.LocationParkingLotID.LocationParkingLotName + "\x1B\x21\x00\n"; receiptlines[2] = "" + "\n"; receiptlines[3] = "\x1B\x21\x08" + vehicleType + ":" + objCheckOutReceipt.CustomerVehicleID.RegistrationNumber + "\x1B\x21\x00\n"; receiptlines[4] = "\x1B\x21\x01" + "In :" + (objCheckOutReceipt.ActualStartTime == null ? "" : Convert.ToDateTime(objCheckOutReceipt.ActualStartTime).ToString("dd MMM yyyy,hh:mm tt")) + "\x1B\x21\x00" + "\n"; receiptlines[5] = "\x1B\x21\x01" + "Out:" + (objCheckOutReceipt.ActualEndTime == null ? "" : Convert.ToDateTime(objCheckOutReceipt.ActualEndTime).ToString("dd MMM yyyy,hh:mm tt")) + "\x1B\x21\x00" + "\n"; receiptlines[6] = "\x1B\x21\x01" + "Paid Amount: Rs" + ((objCheckOutReceipt.ExtendAmount + objCheckOutReceipt.ViolationFees + objCheckOutReceipt.ClampFees + objCheckOutReceipt.PaidDueAmount)).ToString("N2") + "\x1B\x21\x01" + "\n"; receiptlines[7] = "\x1B\x21\x01" + "(Includes Violation)" + "\x1B\x21\x01" + "\n"; receiptlines[8] = "\x1B\x21\x01" + "Violation Fee:" + "Rs" + (objCheckOutReceipt.ClampFees).ToString("N2") + "\x1B\x21\x01" + "\n"; receiptlines[9] = "\x1B\x21\x06" + "Operator Id:" + objCheckOutReceipt.UserCode + "\x1B\x21\x00\n"; receiptlines[10] = "\x1B\x21\x01" + "(Supervisor Mobile:" + objCheckOutReceipt.SuperVisorID.PhoneNumber + ")" + "\x1B\x21\x00\n"; receiptlines[11] = "\x1B\x21\x06" + "Security available " + objCheckOutReceipt.LocationParkingLotID.LotOpenTime + "-" + objCheckOutReceipt.LocationParkingLotID.LotCloseTime + "\x1B\x21\x00\n"; receiptlines[12] = "\x1B\x21\x01" + "We are not responsible for your valuable items like laptop, wallet,helmet etc." + "\x1B\x21\x00\n"; receiptlines[13] = "\x1B\x21\x06" + "GST Number" + objCheckOutReceipt.GSTNumber + "\x1B\x21\x00\n"; receiptlines[14] = "\x1B\x21\x06" + "Amount includes 18% GST" + "\x1B\x21\x00\n"; receiptlines[15] = "" + "\n"; receiptlines[16] = "" + "\n"; } } catch (Exception ex) { } } catch (Exception ex) { } }
private async void btn_CheckInClicked(object sender, EventArgs e) { IsOnline = VerifyInternet(); if (IsOnline) { ShowLoading(true); btnCheckIn.IsVisible = false; CustomerParkingSlot obj_CustomerParkingSlot = new CustomerParkingSlot(); obj_CustomerParkingSlot.CustomerParkingSlotID = CustomerParkingSlotID; obj_CustomerParkingSlot.CustomerID = CustomerID; obj_CustomerParkingSlot.VehicleTypeID = VehicleTypeID; obj_CustomerParkingSlot.PaymentTypeID = Convert.ToInt32(App.Current.Properties["PaymentTypeID"]); obj_CustomerParkingSlot.LocationParkingLotID = LocationParkingLotID; DateTime LotOpenTime = DateTime.Parse(objOCustomerVehiclePass.LotOpenTime); DateTime LotCloseTime = DateTime.Parse(objOCustomerVehiclePass.LotCloseTime); currentTime = DateTime.Now; if (currentTime <= LotOpenTime) { obj_CustomerParkingSlot.ExpectedStartTime = LotOpenTime.ToString("MM/dd/yyyy hh:mm tt"); TimeSpan ts = LotCloseTime - LotOpenTime; obj_CustomerParkingSlot.Duration = Convert.ToString(ts.Hours); } else { obj_CustomerParkingSlot.ExpectedStartTime = objCustomerParkingSlotDetails.To.ToString("MM/dd/yyyy hh:mm tt"); TimeSpan ts = LotCloseTime - objCustomerParkingSlotDetails.To; obj_CustomerParkingSlot.Duration = Convert.ToString(ts.Hours); } obj_CustomerParkingSlot.ExpectedEndTime = LotCloseTime.ToString("MM/dd/yyyy hh:mm tt"); obj_CustomerParkingSlot.ActualStartTime = obj_CustomerParkingSlot.ExpectedStartTime; obj_CustomerParkingSlot.ActualEndTime = LotCloseTime.ToString("MM/dd/yyyy hh:mm tt"); obj_CustomerParkingSlot.ExtendAmount = 0; obj_CustomerParkingSlot.Amount = 0; obj_CustomerParkingSlot.TransactionID = "0"; obj_CustomerParkingSlot.StatusID = Convert.ToInt32(App.Current.Properties["StatusID"]); obj_CustomerParkingSlot.CustomerVehicleID = CustomerVehicleID; obj_CustomerParkingSlot.ApplicationTypeID = Convert.ToInt32(App.Current.Properties["PassApplicationTypeID"]); obj_CustomerParkingSlot.PaidAmount = 0; obj_CustomerParkingSlot.ParkingBayID = ParkingBayID; if (App.Current.Properties.ContainsKey("apitoken")) { var json = JsonConvert.SerializeObject(obj_CustomerParkingSlot); var content = new StringContent(json, Encoding.UTF8, "application/json"); CustomerParkingSlotDetails resultObj = dal_Customer.InsertCustomerParkingSlot(Convert.ToString(App.Current.Properties["apitoken"]), obj_CustomerParkingSlot); if (resultObj.CustomerParkingSlotID != 0) { btnCheckIn.IsVisible = true; ShowLoading(false); App.Current.Properties["CustomerParkingSlotID"] = Convert.ToString(resultObj.CustomerParkingSlotID); await Navigation.PushAsync(new SessionHomeReceipt(resultObj)); } else { btnCheckIn.IsVisible = true; ShowLoading(false); DisplayAlert("", "Payment Failed", "Ok"); } } else { btnCheckIn.IsVisible = true; ShowLoading(false); } } else { DisplayAlert("", "Please check your network connectivity", "Ok"); } }
private async void btn_PayClicked(object sender, EventArgs e) { ShowLoading(true); btnPay.IsVisible = false; try { double duration_double = 0; currentTime = DateTime.Now; DateTime LotOpenTime = objCustomerParkingSlotDetails.LotOpenTime; DateTime LotCloseTime = objCustomerParkingSlotDetails.LotCloseTime; TimeSpan tss = LotCloseTime - objCustomerParkingSlotDetails.To; duration_double = tss.TotalHours; if (Duration <= Math.Ceiling(duration_double)) { TimeSpan ts = LotCloseTime - currentTime; duration_double = ts.TotalHours; stkTiming.IsVisible = duration_double <= 1 ? false : true; stkTimingFlag = stkTiming.IsVisible; if (Duration <= Math.Ceiling(duration_double)) { ExpectedEndTime_date = objCustomerParkingSlotDetails.To.AddHours(Duration) <= LotCloseTime?objCustomerParkingSlotDetails.To.AddHours(Duration) : LotCloseTime; lblExpiryMessage.Text = ExpectedEndTime_date.ToString("hh:mm tt"); if (IsFullDay) { ts = LotCloseTime - ExpectedEndTime_date; Duration = ts.Hours; ExpectedEndTime_date = LotCloseTime; } } else { btnPay.IsVisible = false; btnCheckIn.IsVisible = false; ShowLoading(false); await DisplayAlert("", "Parking Lot closes at " + Convert.ToString(Convert.ToDateTime(LotCloseTime).ToString("hh:mm tt")).ToLower() + " today. Please select proper timings.", "Ok"); return; } } else { lblExpiryMessage.Text = Convert.ToString(LotCloseTime.ToString("hh:mm tt")); stkExpiry.IsVisible = false; stkPrice.IsVisible = false; btnPay.IsVisible = false; btnCheckIn.IsVisible = false; ShowLoading(false); await DisplayAlert("", "Parking Lot closes at " + Convert.ToString(Convert.ToDateTime(LotCloseTime).ToString("hh:mm tt")).ToLower() + " today", "Ok"); return; } CustomerParkingSlot obj_CustomerParkingSlot = new CustomerParkingSlot(); obj_CustomerParkingSlot.CustomerParkingSlotID = CustomerParkingSlotID; obj_CustomerParkingSlot.CustomerID = CustomerID; obj_CustomerParkingSlot.VehicleTypeID = VehicleTypeID; obj_CustomerParkingSlot.PaymentTypeID = Convert.ToInt32(App.Current.Properties["PaymentTypeID"]); obj_CustomerParkingSlot.LocationParkingLotID = LocationParkingLotID; obj_CustomerParkingSlot.LocationParkingLotName = LocationParkingLotName; if (currentTime <= LotOpenTime) { obj_CustomerParkingSlot.ExpectedStartTime = LotOpenTime.ToString("MM/dd/yyyy hh:mm tt"); obj_CustomerParkingSlot.ExpectedEndTime = LotOpenTime.AddHours(Duration).ToString("MM/dd/yyyy hh:mm tt"); } else { obj_CustomerParkingSlot.ExpectedStartTime = objCustomerParkingSlotDetails.To.ToString("MM/dd/yyyy hh:mm tt"); obj_CustomerParkingSlot.ExpectedEndTime = ExpectedEndTime_date.ToString("MM/dd/yyyy hh:mm tt"); } obj_CustomerParkingSlot.ActualStartTime = objCustomerParkingSlotDetails.From.ToString("MM/dd/yyyy hh:mm tt"); obj_CustomerParkingSlot.ActualEndTime = ExpectedEndTime_date.ToString("MM/dd/yyyy hh:mm tt"); obj_CustomerParkingSlot.ExtendAmount = Convert.ToDecimal(lblParkingFee.Text); obj_CustomerParkingSlot.Duration = Convert.ToString(Duration); obj_CustomerParkingSlot.Amount = Convert.ToDecimal(lblParkingFee.Text); obj_CustomerParkingSlot.TransactionID = "0"; obj_CustomerParkingSlot.StatusID = Convert.ToInt32(App.Current.Properties["StatusID"]); obj_CustomerParkingSlot.CustomerVehicleID = CustomerVehicleID; obj_CustomerParkingSlot.ApplicationTypeID = Convert.ToInt32(App.Current.Properties["ApplicationTypeID"]); obj_CustomerParkingSlot.PaidAmount = Convert.ToDecimal(lblParkingFee.Text); obj_CustomerParkingSlot.ParkingBayID = ParkingBayID; btnPay.IsVisible = true; ShowLoading(false); await Navigation.PushAsync(new RazorPayment(obj_CustomerParkingSlot, null)); } catch (Exception ex) { btnPay.IsVisible = true; ShowLoading(false); DisplayAlert("Failed - Pay", Convert.ToString(ex.Message), "Ok"); } }