public void SetInstallationError() { _installation.RequestFocus(); _installation.SetError("Skal udfyldes", null); }
private bool ValidateForm() { Validations validation = new Validations(); Android.Graphics.Drawables.Drawable icon = Resources.GetDrawable(Resource.Drawable.error); icon.SetBounds(0, 0, icon.IntrinsicWidth, icon.IntrinsicHeight); bool formIsValid = true; if (vehiclebodytype.SelectedItem.ToString() == "Select Vehicle Body Type") { MessageDialog messageDialog = new MessageDialog(); messageDialog.SendToast("Please Select Vehicle Body Type"); formIsValid = false; } if (!validation.IsValidEmail(email.Text)) { email.SetError("Invalid email address", icon); formIsValid = false; } if (!validation.IsValidPhone(phone.Text)) { phone.SetError("Invaild phone number", icon); formIsValid = false; } if (!validation.IsRequired(name.Text)) { name.SetError("This field is required", icon); formIsValid = false; } if (!validation.IsRequired(pickupLocation.Text)) { pickupLocation.SetError("This field is required", icon); formIsValid = false; } else { var pickupLocationPlaceId = PickUpLocations.FirstOrDefault(l => l.Description.Trim() == pickupLocation.Text.Trim()); if (pickupLocationPlaceId == null) { pickupLocation.SetError("Unable to get your pick up location", icon); formIsValid = false; } else { fromLocation = GetLocationDetails(pickupLocationPlaceId.PlaceId, pickupLocation.Text.Trim()); } } if (!validation.IsRequired(dropLocation.Text)) { dropLocation.SetError("This field is required", icon); formIsValid = false; } else { var dropLocationPlaceId = DropLocations.FirstOrDefault(l => l.Description.Trim() == dropLocation.Text.Trim()); if (dropLocationPlaceId == null) { dropLocation.SetError("Unable to get your drop location", icon); formIsValid = false; } else { tolocation = GetLocationDetails(dropLocationPlaceId.PlaceId, pickupLocation.Text.Trim()); } } return(formIsValid); }
private async void RequestProcess() { try { Drawable icon_error = Resources.GetDrawable(Resource.Drawable.alert); icon_error.SetBounds(0, 0, 40, 30); if (txt_EmployeeName.Text != "") { if (txt_EmployeeDepartmentID.Text != "") { if (dtp_RequestStartTime.Text != "") { if (dtp_RequestEndTime.Text != "") { if (txt_Associries.Text != "") { if (txt_NoOFVendors.Text != "") { if (txt_Reasons.Text != "") { foreach (var item in ResultGetAllDepartmentEmployeeNameModel) { if (item.EmployeeName.ToString().Trim() == (txt_EmployeeName.Text.Trim())) { _ObjRequestProcess.EmployeeDepartmentID = item.EmployeeDepartmentID; _ObjRequestProcess.EmployeeId = item.EmployeeSrNo; } } progressDialog = ProgressDialog.Show(this, Android.Text.Html.FromHtml("<font color='#EC407A'> Please wait...</font>"), Android.Text.Html.FromHtml("<font color='#EC407A'> Creating New Request...</font>"), true); string Url = StatusModel.Url + "GetVendorUserInformationByVendorUserID"; WebHelpper _objHelper = new WebHelpper(); VendorUserRegistrationModel _objVendorUserRegistrationModel = new VendorUserRegistrationModel(); _objVendorUserRegistrationModel.VendorUserID = StatusModel.LoginUserName; var PostString = JsonConvert.SerializeObject(_objVendorUserRegistrationModel); var request = await _objHelper.MakePostRequest(Url, PostString, true); VendorUserRegistrationModel ResultVendorUserRegistrationModel = JsonConvert.DeserializeObject <VendorUserRegistrationModel>(request); _ObjRequestProcess.VendorSrNo = ResultVendorUserRegistrationModel.VendorSrNo; _ObjRequestProcess.VisitStartTime = Convert.ToDateTime(dtp_RequestStartTime.Text); _ObjRequestProcess.VisitEndTime = Convert.ToDateTime(dtp_RequestEndTime.Text); _ObjRequestProcess.VendorAccessories = txt_Associries.Text; _ObjRequestProcess.NoOfVendors = Convert.ToInt32(txt_NoOFVendors.Text); _ObjRequestProcess.VendorVisitResons = txt_Reasons.Text; _ObjRequestProcess.RequestProcessDate = Convert.ToDateTime(DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt")); _ObjRequestProcess.ActivityOwnerStatus = "None"; _ObjRequestProcess.AreaOwnerStatus = "None"; _ObjRequestProcess.SafetyStatus = "None"; _ObjRequestProcess.ContractorStatus = "None"; // ADD Insert Code Here WebHelpper _objHelper1 = new WebHelpper(); string Url1 = StatusModel.Url + "AddRequestProcess"; var PostString1 = JsonConvert.SerializeObject(_ObjRequestProcess); var requestTemp1 = await _objHelper1.MakePostRequest(Url1, PostString1, true); ResultModel ResultgetRequest1 = JsonConvert.DeserializeObject <ResultModel>(requestTemp1); if (ResultgetRequest1.success == 1) { progressDialog.Hide(); Toast.MakeText(this, ResultgetRequest1.msg, ToastLength.Short).Show(); } else { progressDialog.Hide(); Toast.MakeText(this, ResultgetRequest1.msg, ToastLength.Short).Show(); return; } clear(); } else { txt_Reasons.RequestFocus(); txt_Reasons.SetError("Please Enter Visit Reason First", icon_error); } } else { txt_NoOFVendors.RequestFocus(); txt_NoOFVendors.SetError("Please Select No of Vendors First", icon_error); } } else { txt_Associries.RequestFocus(); txt_Associries.SetError("Please Enter Associries First", icon_error); } } else { dtp_RequestEndTime.RequestFocus(); dtp_RequestEndTime.SetError("Please Select End Time First", icon_error); } } else { dtp_RequestEndTime.RequestFocus(); dtp_RequestEndTime.SetError("Please Select Start Time First", icon_error); } } else { txt_EmployeeDepartmentID.RequestFocus(); txt_EmployeeDepartmentID.SetError("Please Select Employee Department First", icon_error); } } else { txt_EmployeeName.RequestFocus(); txt_EmployeeName.SetError("Please Enter Full Name First", icon_error); } } catch (Exception e) { string ErrorMsg = e.ToString(); Toast.MakeText(this, ErrorMsg, ToastLength.Long).Show(); } }
private async void DepartmentEmployeeRegistration() { try { TokenNo(); Drawable icon_error = Resources.GetDrawable(Resource.Drawable.alert); icon_error.SetBounds(0, 0, 40, 30); if (txt_EmployeeTokenNo.Text != "") { if (txt_EmployeeName.Text != "") { if (txt_EmployeeAddress.Text != "") { if (txt_EmployeeContactNo.Text != "") { if (txt_EmployeeEmailID.Text != "") { if (txt_EmployeeDepartmentID.Text != "") { if (txt_EmployeeDesignationID.Text != "") { if (txt_EmployeePassword.Text != "") { foreach (var item in ResultAllDesignationMaster) { if (item.DesignationName.ToString().Trim() == (txt_EmployeeDesignationID.Text.Trim())) { _ObjDepartmentEmployeeRegistration.EmployeeDepartmentID = item.DepartmentID; _ObjDepartmentEmployeeRegistration.EmployeeDesignationID = item.DesignationID; } } _ObjDepartmentEmployeeRegistration.DeviceTokenId = DTI.ToString(); _ObjDepartmentEmployeeRegistration.EmployeeTokenNo = txt_EmployeeTokenNo.Text; _ObjDepartmentEmployeeRegistration.EmployeeName = txt_EmployeeName.Text; _ObjDepartmentEmployeeRegistration.EmployeeAddress = txt_EmployeeAddress.Text; _ObjDepartmentEmployeeRegistration.EmployeeContactNo = txt_EmployeeContactNo.Text; _ObjDepartmentEmployeeRegistration.EmployeeEmailID = txt_EmployeeEmailID.Text; //_ObjDepartmentEmployeeRegistration.EmployeeDepartmentID = Convert.ToInt32(txt_EmployeeDepartmentID.Text); //_ObjDepartmentEmployeeRegistration.EmployeeDesignationID = Convert.ToInt32(txt_EmployeeDesignationID.Text); _ObjDepartmentEmployeeRegistration.EmployeePassword = txt_EmployeePassword.Text; _ObjDepartmentEmployeeRegistration.Date = Convert.ToDateTime(DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt")); // ADD Insert Code Here WebHelpper _objHelper = new WebHelpper(); string Url = StatusModel.Url + "AddDepartmentEmployeeRegistration"; progressDialog = ProgressDialog.Show(this, Android.Text.Html.FromHtml("<font color='#EC407A'> Please wait...</font>"), Android.Text.Html.FromHtml("<font color='#EC407A'> Data Inserting...</font>"), true); var PostString = JsonConvert.SerializeObject(_ObjDepartmentEmployeeRegistration); var requestTemp = await _objHelper.MakePostRequest(Url, PostString, true); ResultModel ResultgetRequest = JsonConvert.DeserializeObject <ResultModel>(requestTemp); if (ResultgetRequest.success == 1) { progressDialog.Hide(); Toast.MakeText(this, ResultgetRequest.msg, ToastLength.Short).Show(); } else { progressDialog.Hide(); Toast.MakeText(this, ResultgetRequest.msg, ToastLength.Short).Show(); return; } clear(); } else { txt_EmployeePassword.RequestFocus(); txt_EmployeePassword.SetError("Please Enter Password First", icon_error); } } else { txt_EmployeeDesignationID.RequestFocus(); txt_EmployeeDesignationID.SetError("Please Select Designation First", icon_error); } } else { txt_EmployeeDepartmentID.RequestFocus(); txt_EmployeeDepartmentID.SetError("Please Select Department First", icon_error); } } else { txt_EmployeeEmailID.RequestFocus(); txt_EmployeeEmailID.SetError("Please Enter Email ID First", icon_error); } } else { txt_EmployeeContactNo.RequestFocus(); txt_EmployeeContactNo.SetError("Please Enter Contact Number First", icon_error); } } else { txt_EmployeeAddress.RequestFocus(); txt_EmployeeAddress.SetError("Please Enter Address First", icon_error); } } else { txt_EmployeeName.RequestFocus(); txt_EmployeeName.SetError("Please Enter Full Name First", icon_error); } } else { txt_EmployeeTokenNo.RequestFocus(); txt_EmployeeTokenNo.SetError("Please Enter Token Number First", icon_error); } } catch (Exception e) { progressDialog.Hide(); string ErrorMsg = e.ToString(); Toast.MakeText(this, ErrorMsg, ToastLength.Long).Show(); } }