public FBCustomerParkingSlot()
 {
     LocationParkingLotID = new LocationParkingLot();
     VehicleTypeID        = new VehicleType();
     StatusID             = new Status();
     ApplicationTypeID    = new ApplicationType();
     CreatedBy            = new User();
     UpdatedBy            = new User();
     PaymentTypeID        = new PaymentType();
     CustomerVehicleID    = new CustomerVehicle();
     ViolationReasonID    = new ViolationReason();
     FOCReasonID          = new ViolationReason();
 }
        private async void BtnClamp_Clicked(object sender, EventArgs e)
        {
            try
            {
                ShowLoading(true);
                BtnClamp.IsEnabled = false;
                MasterHomePage masterPage = null;
                string         resultmsg  = string.Empty;
                if (pickerViolationReason.SelectedItem != null)
                {
                    ViolationReason objselectedreason = (ViolationReason)pickerViolationReason.SelectedItem;
                    if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                    {
                        await Task.Run(() =>
                        {
                            User objClampedBy   = (User)App.Current.Properties["LoginUser"];
                            objresult.IsClamp   = checkBoxClampVehicle.IsChecked;
                            objresult.IsWarning = chkWarning.IsChecked;
                            objresult.ViolationReasonID.ViolationReasonID = objselectedreason.ViolationReasonID;
                            objresult.CreatedBy = objClampedBy.UserID;
                            resultmsg           = dal_ViolationClamp.UpdaetVehicleClampStatus(Convert.ToString(App.Current.Properties["apitoken"]), objresult);
                            if (resultmsg == "Success")
                            {
                                masterPage = new MasterHomePage();
                            }
                        });

                        if (resultmsg == "Success")
                        {
                            await Navigation.PushAsync(masterPage);
                        }
                        else
                        {
                            await DisplayAlert("Alert", "Clamp Failed,Please contact Admin", "Ok");
                        }
                    }
                }
                else
                {
                    await DisplayAlert("Alert", "Please select Reason", "Ok");
                }
                BtnClamp.IsEnabled = true;
                ShowLoading(false);
            }
            catch (Exception ex)
            {
                BtnClamp.IsEnabled = true;
                ShowLoading(false);
            }
        }
        public IList <ViolationReason> GetActiveFOCReasonList()
        {
            IList <ViolationReason> violationList = new List <ViolationReason>();

            sqlhelper_obj = new SqlHelper();
            try
            {
                using (SqlConnection sqlconn_obj = new SqlConnection())
                {
                    sqlconn_obj.ConnectionString = sqlhelper_obj.GetConnectionSrting();

                    using (SqlCommand sqlcmd_obj = new SqlCommand("PARK_PROC_GetFOCReasons", sqlconn_obj))
                    {
                        sqlcmd_obj.CommandType    = CommandType.StoredProcedure;
                        sqlcmd_obj.CommandTimeout = 0;
                        DataSet ds;
                        using (SqlDataAdapter da = new SqlDataAdapter(sqlcmd_obj))
                        {
                            ds = new DataSet();
                            da.Fill(ds);
                        }
                        DataTable dt = ds.Tables[0];

                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            ViolationReason violation_obj = new ViolationReason();
                            violation_obj.ViolationReasonID = Convert.ToInt32(dt.Rows[i]["ViolationReasonID"]);
                            violation_obj.Reason            = Convert.ToString(dt.Rows[i]["Reason"]);
                            violationList.Add(violation_obj);
                        }
                    }
                }
                return(violationList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #4
0
        public List <ViolationReason> GetViolationReasons(string StatusCode)
        {
            List <ViolationReason> lstViolationReason = new List <ViolationReason>();
            string resultMsg = string.Empty;

            try
            {
                using (SqlConnection sqlconn_obj = new SqlConnection(SqlHelper.GetDBConnectionString()))
                {
                    using (SqlCommand sqlcmd_obj = new SqlCommand("OPAPP_PROC_GetViolationReasons", sqlconn_obj))
                    {
                        sqlcmd_obj.CommandType = CommandType.StoredProcedure;
                        sqlcmd_obj.Parameters.AddWithValue("@StatusCode", (StatusCode == "" || StatusCode == string.Empty)?(object)DBNull.Value: StatusCode);
                        sqlconn_obj.Open();
                        SqlDataAdapter sqldap   = new SqlDataAdapter(sqlcmd_obj);
                        DataTable      resultdt = new DataTable();
                        sqldap.Fill(resultdt);
                        if (resultdt.Rows.Count > 0)
                        {
                            for (var i = 0; i < resultdt.Rows.Count; i++)
                            {
                                ViolationReason objViolationReason = new ViolationReason();
                                objViolationReason.ViolationReasonID = resultdt.Rows[i]["ViolationReasonID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[i]["ViolationReasonID"]);
                                objViolationReason.Reason            = Convert.ToString(resultdt.Rows[i]["Reason"]);
                                lstViolationReason.Add(objViolationReason);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                objExceptionlog.InsertException("WebAPI", ex.Message, "DALViolation", "Proc: " + "OPAPP_PROC_GetViolationReasons", "GetViolationReasons");
            }
            return(lstViolationReason);
        }
        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;
        }
예제 #6
0
        private async void BtnCheckOut_Clicked(object sender, EventArgs e)
        {
            string resultmsg = string.Empty;
            MasterDetailHomePage masterPage = null;

            btnCheckOut.IsVisible = false;
            try
            {
                if (DeviceInternet.InternetConnected())
                {
                    ShowLoading(true);
                    if (pickerChckOutReason.SelectedItem != null)
                    {
                        DALVehicleCheckOut dal_CheckOut = new DALVehicleCheckOut();
                        if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                        {
                            ViolationReason objselectedreason = (ViolationReason)pickerChckOutReason.SelectedItem;
                            objFOCVehicle.StatusID.StatusName           = "FOC";
                            objFOCVehicle.FOCReasonID.ViolationReasonID = objselectedreason.ViolationReasonID;
                            User objFOCBy = (User)App.Current.Properties["LoginUser"];
                            objFOCVehicle.CreatedBy = objFOCBy.UserID;
                            await Task.Run(() =>
                            {
                                resultmsg = dal_CheckOut.FOCVehicleCheckOut(Convert.ToString(App.Current.Properties["apitoken"]), objFOCVehicle);
                                if (resultmsg != null && resultmsg == "Success")
                                {
                                    masterPage = new MasterDetailHomePage();
                                }
                            });

                            if (resultmsg != null && resultmsg == "Success")
                            {
                                await Navigation.PushAsync(masterPage);
                            }
                            else
                            {
                                await DisplayAlert("Alert", "FOC Failed,Please contact Admin.", "Ok");
                            }
                        }
                        else
                        {
                            await DisplayAlert("Alert", "Lost API Token,Please login agin", "Ok");
                        }
                    }
                    else
                    {
                        await DisplayAlert("Alert", "Please select Reason", "Ok");
                    }
                }
                else
                {
                    await DisplayAlert("Alert", "Please check your Internet connection", "Ok");
                }
            }
            catch (Exception ex)
            {
                ShowLoading(false);
                btnCheckOut.IsVisible = true;
            }
            ShowLoading(false);
            btnCheckOut.IsVisible = true;
        }