//dispaly vehicle Details private void DisplayVehicleDetails(RentRunningTrans rentRunningTrans) { ddlRegNo.Text = rentRunningTrans.RegNo; ddlVehicleType.SetSelection(Array.IndexOf(strVehicleType, rentRunningTrans.VehicleType)); ddlVehicleType.Enabled = false; ddlFuelLevel.SetSelection(Array.IndexOf(strArrFuelLevel, rentRunningTrans.FuelLevel)); txtEmail.Text = rentRunningTrans.Email; txtMileage.Text = rentRunningTrans.Mileage.ToString(); txtMobile.Text = rentRunningTrans.Mobile; }
void ddlRegNo_ItemClick(object sender, AdapterView.ItemClickEventArgs e) { Vehicle vehicle = oVehicles.Where(x => x.RegNumber == ddlRegNo.Text).First(); objDataManager = new DataManager(); rentRunningTrans = objDataManager.GetVehicleRentLastTransactionDetails(vehicle.ID, strShowVehicleForStatus); if (rentRunningTrans != null) { DisplayVehicleDetails(rentRunningTrans); } else { ddlVehicleType.SetSelection(Array.IndexOf(strVehicleType, vehicle.VehicleType)); ddlVehicleType.Enabled = false; txtMileage.RequestFocus(); } }
// WebClient webClient; protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ActionBar actionBar = ((Activity)this).ActionBar; actionBar.SetDisplayShowHomeEnabled(true); actionBar.SetLogo(Resource.Drawable.ic_launcher); actionBar.SetDisplayUseLogoEnabled(true); // Create your application here SetContentView(Resource.Layout.RentFlowVehicle); strShowVehicleForStatus = Intent.GetStringExtra("ShowVehicleForStatus"); strTransType = Intent.GetStringExtra("TransType"); actionBar.Title = "Select Vehicle for " + strTransType; ddlRegNo = FindViewById <AutoCompleteTextView>(Resource.Id.ddlRegNo); //string[] strArrRegNo = Resources.GetStringArray(Resource.Array.strArrRegNo); BindVehicleRegNoList(strShowVehicleForStatus); //objDataManager = new DataManager(); //oVehicles = objDataManager.GetVehicles(strShowVehicleForStatus); //List<String> oVRegNolist = new List<String>(); //foreach (Vehicle v in oVehicles) //{ // oVRegNolist.Add(v.RegNumber); //} //var adpVRegNo = new ArrayAdapter<String>(this, Resource.Layout.list_item, oVRegNolist); //ddlRegNo.Adapter = adpVRegNo; //ddlRegNo.ItemClick += ddlRegNo_ItemClick; ddlVehicleType = FindViewById <Spinner>(Resource.Id.ddlVehicleType); strVehicleType = Resources.GetStringArray(Resource.Array.strArrVehicleType); //var adpVehicleType = ArrayAdapter.CreateFromResource( // this, Resource.Array.strArrVehicleType, Android.Resource.Layout.SimpleSpinnerItem); var adpVehicleType = ArrayAdapter.CreateFromResource( this, Resource.Array.strArrVehicleType, Resource.Layout.list_item); //adpVehicleType.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); ddlVehicleType.Adapter = adpVehicleType; ddlFuelLevel = FindViewById <Spinner>(Resource.Id.ddlFuelLevel); strArrFuelLevel = Resources.GetStringArray(Resource.Array.strArrFuelLevel); var adapter = new ArrayAdapter <String>(this, Resource.Layout.list_item, strArrFuelLevel); ddlFuelLevel.Adapter = adapter; this.progressLayout = FindViewById <ProgressBar>(Resource.Id.progressLayout); this.progressLayout.Visibility = ViewStates.Gone; //ConnectivityManager connectivityManager = (ConnectivityManager)GetSystemService(ConnectivityService); txtEmail = FindViewById <EditText>(Resource.Id.txtEmail); txtMileage = FindViewById <EditText>(Resource.Id.txtMileage); txtMobile = FindViewById <EditText>(Resource.Id.txtMobile); var actionToolbar = FindViewById <Toolbar>(Resource.Id.action_toolbar); actionToolbar.SetNavigationIcon(Resource.Drawable.ic_action_account_circle); actionToolbar.Title = ApplicationClass.username; actionToolbar.SetPadding(00, 0, 0, 00); //actionToolbar.SetContentInsetsAbsolute(0, 0); actionToolbar.InflateMenu(Resource.Menu.action_menus); actionToolbar.Menu.FindItem(Resource.Id.menu_save).SetVisible(false); actionToolbar.Menu.FindItem(Resource.Id.menu_sendemail).SetVisible(false); actionToolbar.MenuItemClick += (sender, e) => { if (e.Item.ItemId == Resource.Id.menu_next) { if (!String.IsNullOrWhiteSpace(ddlRegNo.Text.Trim()) && !String.IsNullOrWhiteSpace(txtEmail.Text.Trim()) && !String.IsNullOrWhiteSpace(txtMobile.Text.Trim()) && !String.IsNullOrWhiteSpace(txtMileage.Text.Trim())) { Regex regexEmail = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$"); Regex regxMobile = new Regex(@"[0-9]{10}"); Regex regxFuelLevel = new Regex("Select Fuel Level"); Regex regxVehicleType = new Regex("Select Vehicle Type"); if (!regxMobile.Match(txtMobile.Text).Success) { // Toast.MakeText(this, "Please enter valid mobile number.", ToastLength.Short).Show(); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetMessage("Please enter valid mobile number."); alert.SetNeutralButton("OK", delegate { }); alert.Create().Show(); txtMobile.RequestFocus(); } else if (!regexEmail.Match(txtEmail.Text).Success) { // Toast.MakeText(this, "Please enter valid email id.", ToastLength.Short).Show(); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetMessage("Please enter valid email id."); alert.SetNeutralButton("OK", delegate { }); alert.Create().Show(); txtEmail.RequestFocus(); } else if (regxVehicleType.Match(ddlVehicleType.SelectedItem.ToString()).Success) { // Toast.MakeText(this, "Please select vehicle type.", ToastLength.Short).Show(); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetMessage("Please select vehicle type."); alert.SetNeutralButton("OK", delegate { }); alert.Create().Show(); ddlFuelLevel.RequestFocus(); } else if (regxFuelLevel.Match(ddlFuelLevel.SelectedItem.ToString()).Success) { // Toast.MakeText(this, "Please select fuel level.", ToastLength.Short).Show(); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetMessage("Please select fuel level."); alert.SetNeutralButton("OK", delegate { }); alert.Create().Show(); ddlFuelLevel.Focusable = true; ddlFuelLevel.FocusableInTouchMode = true; ddlFuelLevel.RequestFocus(); ddlFuelLevel.PerformClick(); } else if (CommonFunctions.IsNetworkConnected()) { this.progressLayout.Visibility = ViewStates.Visible; Vehicle objVehicle = oVehicles.Where(x => x.RegNumber == ddlRegNo.Text).FirstOrDefault(); if (objVehicle != null) { var intentMarkDamage = new Intent(this, typeof(RentFlowMarkDamageActivity)); if (rentRunningTrans == null) { rentRunningTrans = new RentRunningTrans(); } rentRunningTrans.VehicleId = objVehicle.ID; rentRunningTrans.VehicleType = strVehicleType[ddlVehicleType.SelectedItemPosition]; rentRunningTrans.TransType = strTransType; rentRunningTrans.RegNo = ddlRegNo.Text.Trim(); rentRunningTrans.Email = txtEmail.Text.Trim(); rentRunningTrans.Mobile = txtMobile.Text.Trim(); rentRunningTrans.Mileage = Convert.ToInt32(txtMileage.Text); rentRunningTrans.FuelLevel = strArrFuelLevel[ddlFuelLevel.SelectedItemPosition]; intentMarkDamage.PutExtra("RentRunningTrans", JsonConvert.SerializeObject(rentRunningTrans)); StartActivity(intentMarkDamage); } else { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetMessage("Please select valid Reg Number."); alert.SetNeutralButton("OK", delegate { }); alert.Create().Show(); // Toast.MakeText(this, "Please select valid Reg Number.", ToastLength.Short).Show(); } } else { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetMessage("Please enable internet to get vehicle images from API."); alert.SetNeutralButton("OK", delegate { }); alert.Create().Show(); } } else { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetMessage("Please fill all mandatory details."); alert.SetNeutralButton("OK", delegate { }); alert.Create().Show(); // Toast.MakeText(this, "Please fill all mandatory details", ToastLength.Short).Show(); txtMileage.RequestFocus(); } } if (e.Item.ItemId == Resource.Id.menu_back) { rentRunningTrans = null; var intentMainMenu = new Intent(this, typeof(MainMenuActivity)); StartActivity(intentMainMenu); } if (e.Item.ItemId == Resource.Id.menu_sendsms) { if (!String.IsNullOrWhiteSpace(txtMobile.Text.Trim())) { this.progressLayout.Visibility = ViewStates.Visible; var intentSendSMS = new Intent(this, typeof(SendSMSActivity)); intentSendSMS.PutExtra("MobileNo", txtMobile.Text); intentSendSMS.PutExtra("FromActivity", "Vehicle"); intentSendSMS.PutExtra("RentRunningTrans", JsonConvert.SerializeObject(rentRunningTrans)); StartActivity(intentSendSMS); } else { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetMessage("Please enter mobile no."); alert.SetNeutralButton("OK", delegate { }); alert.Create().Show(); // Toast.MakeText(this, "Please enter mobile no", ToastLength.Short).Show(); txtMobile.RequestFocus(); } } if (e.Item.ItemId == Resource.Id.menu_sendemail) { this.progressLayout.Visibility = ViewStates.Visible; var intentSendEmail = new Intent(this, typeof(SendEmailActivity)); intentSendEmail.PutExtra("EmailId", txtEmail.Text); StartActivity(intentSendEmail); } if (e.Item.ItemId == Resource.Id.menu_video) { this.progressLayout.Visibility = ViewStates.Visible; var intentVideo = new Intent(this, typeof(CaptureVideoActivity)); StartActivity(intentVideo); } if (e.Item.ItemId == Resource.Id.menu_dashboard) { this.progressLayout.Visibility = ViewStates.Visible; rentRunningTrans = null; var intentMainMenu = new Intent(this, typeof(MainMenuActivity)); StartActivity(intentMainMenu); } }; //load existing details (if available) if (savedInstanceState != null) { rentRunningTrans = JsonConvert.DeserializeObject <RentRunningTrans>(savedInstanceState.GetString("RentRunningTrans", JsonConvert.SerializeObject(rentRunningTrans))); } else if (Intent.GetStringExtra("RentRunningTrans") != null) { rentRunningTrans = JsonConvert.DeserializeObject <RentRunningTrans>(Intent.GetStringExtra("RentRunningTrans")); } if (rentRunningTrans != null) { actionBar.Title = "Select Vehicle for " + rentRunningTrans.TransType; if (rentRunningTrans.TransType.Equals("PRE")) { BindVehicleRegNoList("IN"); } else if (rentRunningTrans.TransType.Equals("OUT")) { BindVehicleRegNoList("PRE"); } else if (rentRunningTrans.TransType.Equals("IN")) { BindVehicleRegNoList("OUT"); } DisplayVehicleDetails(rentRunningTrans); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ActionBar actionBar = ((Activity)this).ActionBar; actionBar.SetDisplayShowHomeEnabled(true); actionBar.SetLogo(Resource.Drawable.ic_launcher); actionBar.SetDisplayUseLogoEnabled(true); // Create your application here SetContentView(Resource.Layout.RentFlowDriverSignature); this.progressLayout = FindViewById <ProgressBar>(Resource.Id.progressLayout); this.progressLayout.Visibility = ViewStates.Gone; var signatureDriver = FindViewById <SignaturePadView>(Resource.Id.signatureDriver); signatureDriver.Caption.Text = "Driver Signature"; signatureDriver.Caption.SetTextColor(Color.Rgb(0, 0, 0)); signatureDriver.Caption.SetTypeface(Typeface.Serif, TypefaceStyle.BoldItalic); signatureDriver.Caption.SetTextSize(global::Android.Util.ComplexUnitType.Sp, 16f); signatureDriver.SignaturePrompt.Text = ""; signatureDriver.BackgroundColor = Color.Rgb(255, 255, 255); // a light yellow. signatureDriver.StrokeColor = Color.Black; signatureDriver.StrokeWidth = 4; signatureDriver.ClearLabel.Text = "Refresh"; signatureDriver.ClearLabel.SetTextColor(Color.Rgb(0, 0, 0)); var signatureCustomer = FindViewById <SignaturePadView>(Resource.Id.signatureCustomer); signatureCustomer.Caption.Text = "Customer Signature"; signatureCustomer.Caption.SetTextColor(Color.Rgb(0, 0, 0)); signatureCustomer.Caption.SetTypeface(Typeface.Serif, TypefaceStyle.BoldItalic); signatureCustomer.Caption.SetTextSize(global::Android.Util.ComplexUnitType.Sp, 16f); signatureCustomer.SignaturePrompt.Text = ""; signatureCustomer.BackgroundColor = Color.Rgb(255, 255, 255); // a light yellow. signatureCustomer.StrokeColor = Color.Black; signatureCustomer.StrokeWidth = 4; signatureCustomer.ClearLabel.Text = "Refresh"; signatureCustomer.ClearLabel.SetTextColor(Color.Rgb(0, 0, 0)); //signatureCustomer.LoadPoints() var actionToolbar = FindViewById <Toolbar>(Resource.Id.action_toolbar); actionToolbar.SetNavigationIcon(Resource.Drawable.ic_action_account_circle); actionToolbar.Title = ApplicationClass.username; actionToolbar.SetPadding(00, 0, 0, 00); //actionToolbar.SetContentInsetsAbsolute(0, 0); actionToolbar.InflateMenu(Resource.Menu.action_menus); actionToolbar.Menu.FindItem(Resource.Id.menu_next).SetVisible(false); actionToolbar.MenuItemClick += (sender, e) => { if (e.Item.ItemId == Resource.Id.menu_save) { if (signatureDriver.IsBlank) { // display the base line for the user to sign on. AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetMessage("Driver signature is required."); alert.SetNeutralButton("OK", delegate { }); alert.Create().Show(); } else { if (signatureCustomer.IsBlank) { // display the base line for the user to sign on. AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetMessage("Customer signature is required."); alert.SetNeutralButton("OK", delegate { }); alert.Create().Show(); } else { this.progressLayout.Visibility = ViewStates.Visible; //rentRunningTrans.DriverSignature = (byte[])signatureDriver.GetImage(); rentRunningTrans.DriverSignatureData = signatureDriver.Points.ToString(); //rentRunningTrans.CustomerSignature = (byte[])signatureCustomer.GetImage(); rentRunningTrans.CustomerSignatureData = signatureCustomer.Points.ToString(); DataManager dataManager = new DataManager(); if (dataManager.SaveRentRunningTransToLocal(rentRunningTrans) > 0) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetMessage("Vehicle transaction has been saved successfully."); alert.SetNeutralButton("OK", delegate { var intent = new Intent(this, typeof(MainMenuActivity)); StartActivity(intent); }); alert.Create().Show(); } } } } if (e.Item.ItemId == Resource.Id.menu_next) { } if (e.Item.ItemId == Resource.Id.menu_back) { //rentRunningTrans = null; var intent = new Intent(this, typeof(RentFlowSignatureActivity)); intent.PutExtra("RentRunningTrans", JsonConvert.SerializeObject(rentRunningTrans)); StartActivity(intent); } if (e.Item.ItemId == Resource.Id.menu_sendsms) { this.progressLayout.Visibility = ViewStates.Visible; var intentSendSMS = new Intent(this, typeof(SendSMSActivity)); intentSendSMS.PutExtra("MobileNo", rentRunningTrans.Mobile); intentSendSMS.PutExtra("FromActivity", "DriverSignatureActivity"); intentSendSMS.PutExtra("RentRunningTrans", JsonConvert.SerializeObject(rentRunningTrans)); StartActivity(intentSendSMS); } if (e.Item.ItemId == Resource.Id.menu_sendemail) { if (signatureDriver.IsBlank) { // display the base line for the user to sign on. AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetMessage("Driver signature is required."); alert.SetNeutralButton("OK", delegate { }); alert.Create().Show(); } else { if (signatureCustomer.IsBlank) { // display the base line for the user to sign on. AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetMessage("Customer signature is required."); alert.SetNeutralButton("OK", delegate { }); alert.Create().Show(); } else { this.progressLayout.Visibility = ViewStates.Visible; //rentRunningTrans.DriverSignature = (byte[])signatureDriver.GetImage(); rentRunningTrans.DriverSignatureData = signatureDriver.Points.ToString(); //rentRunningTrans.CustomerSignature = (byte[])signatureCustomer.GetImage(); rentRunningTrans.CustomerSignatureData = signatureCustomer.Points.ToString(); DataManager dataManager = new DataManager(); dataManager.SaveRentRunningTransToLocal(rentRunningTrans); var intentSendEmail = new Intent(this, typeof(SendEmailActivity)); intentSendEmail.PutExtra("EmailId", rentRunningTrans.Email); StartActivity(intentSendEmail); } } } if (e.Item.ItemId == Resource.Id.menu_video) { this.progressLayout.Visibility = ViewStates.Visible; var intentVideo = new Intent(this, typeof(CaptureVideoActivity)); StartActivity(intentVideo); } if (e.Item.ItemId == Resource.Id.menu_dashboard) { this.progressLayout.Visibility = ViewStates.Visible; rentRunningTrans = null; var intentMainMenu = new Intent(this, typeof(MainMenuActivity)); StartActivity(intentMainMenu); } }; //Recreate Object if (savedInstanceState != null) { rentRunningTrans = JsonConvert.DeserializeObject <RentRunningTrans>(savedInstanceState.GetString("RentRunningTrans", JsonConvert.SerializeObject(rentRunningTrans))); } else { rentRunningTrans = JsonConvert.DeserializeObject <RentRunningTrans>(Intent.GetStringExtra("RentRunningTrans")); } //Load details from existing object if (rentRunningTrans != null) { actionBar.Title = "Signature for " + rentRunningTrans.TransType; } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ActionBar actionBar = ((Activity)this).ActionBar; actionBar.SetDisplayShowHomeEnabled(true); actionBar.SetLogo(Resource.Drawable.ic_launcher); actionBar.SetDisplayUseLogoEnabled(true); // Create your application here SetContentView(Resource.Layout.RentFlowCheckList); this.progressLayout = FindViewById <LinearLayout>(Resource.Id.progressLayout); this.progressLayout.Visibility = ViewStates.Gone; chkAlloyWheel = FindViewById <CheckBox>(Resource.Id.chkAlloyWheel); CheckBox chkBonet = FindViewById <CheckBox>(Resource.Id.chkBonet); CheckBox chkBrakeFluid = FindViewById <CheckBox>(Resource.Id.chkBrakeFluid); CheckBox chkCoolant = FindViewById <CheckBox>(Resource.Id.chkCoolant); CheckBox chkDisc = FindViewById <CheckBox>(Resource.Id.chkDisc); CheckBox chkEngine = FindViewById <CheckBox>(Resource.Id.chkEngine); CheckBox chkFrontBumper = FindViewById <CheckBox>(Resource.Id.chkFrontBumper); CheckBox chkInterior = FindViewById <CheckBox>(Resource.Id.chkInterior); CheckBox chkNSDoor = FindViewById <CheckBox>(Resource.Id.chkNSDoor); CheckBox chkNSFWheel = FindViewById <CheckBox>(Resource.Id.chkNSFWheel); CheckBox chkNSRWheel = FindViewById <CheckBox>(Resource.Id.chkNSRWheel); CheckBox chkOil = FindViewById <CheckBox>(Resource.Id.chkOil); CheckBox chkOSDoor = FindViewById <CheckBox>(Resource.Id.chkOSDoor); CheckBox chkOSFWheel = FindViewById <CheckBox>(Resource.Id.chkOSFWheel); CheckBox chkOSRWheel = FindViewById <CheckBox>(Resource.Id.chkOSRWheel); CheckBox chkRearBumper = FindViewById <CheckBox>(Resource.Id.chkRearBumper); CheckBox chkRoof = FindViewById <CheckBox>(Resource.Id.chkRoof); CheckBox chkSpareTyre = FindViewById <CheckBox>(Resource.Id.chkSpareTyre); CheckBox chkTaligate = FindViewById <CheckBox>(Resource.Id.chkTaligate); CheckBox chkTools = FindViewById <CheckBox>(Resource.Id.chkTools); CheckBox chkTyres = FindViewById <CheckBox>(Resource.Id.chkTyres); CheckBox chkWasherFluid = FindViewById <CheckBox>(Resource.Id.chkWasherFluid); CheckBox chkWindScreen = FindViewById <CheckBox>(Resource.Id.chkWindScreen); EditText txtDamageDetails = FindViewById <EditText>(Resource.Id.txtDamageDetails); EditText txtLooseItems = FindViewById <EditText>(Resource.Id.txtLooseItems); var actionToolbar = FindViewById <Toolbar>(Resource.Id.action_toolbar); actionToolbar.SetNavigationIcon(Resource.Drawable.ic_action_account_circle); actionToolbar.Title = ApplicationClass.username; actionToolbar.SetPadding(0, 0, 0, 00); actionToolbar.InflateMenu(Resource.Menu.action_menus); actionToolbar.Menu.FindItem(Resource.Id.menu_save).SetVisible(false); actionToolbar.Menu.FindItem(Resource.Id.menu_sendemail).SetVisible(false); actionToolbar.MenuItemClick += (sender, e) => { if (e.Item.ItemId == Resource.Id.menu_next) { this.progressLayout.Visibility = ViewStates.Visible; var intent = new Intent(this, typeof(RentFlowSignatureActivity)); //Assign values from screen to running object rentRunningTrans.AlloyWheel = chkAlloyWheel.Checked; rentRunningTrans.Bonet = chkBonet.Checked; rentRunningTrans.BrakeFluid = chkBrakeFluid.Checked; rentRunningTrans.Coolant = chkCoolant.Checked; rentRunningTrans.Disc = chkDisc.Checked; rentRunningTrans.Engine = chkEngine.Checked; rentRunningTrans.FrontBumper = chkFrontBumper.Checked; rentRunningTrans.Interior = chkInterior.Checked; rentRunningTrans.NSDoor = chkNSDoor.Checked; rentRunningTrans.NSFWheel = chkNSFWheel.Checked; rentRunningTrans.NSRWheel = chkNSRWheel.Checked; rentRunningTrans.Oil = chkOil.Checked; rentRunningTrans.OSDoor = chkOSDoor.Checked; rentRunningTrans.OSFWheel = chkOSFWheel.Checked; rentRunningTrans.OSRWheel = chkOSRWheel.Checked; rentRunningTrans.RearBumper = chkRearBumper.Checked; rentRunningTrans.Roof = chkRoof.Checked; rentRunningTrans.SpareTyre = chkSpareTyre.Checked; rentRunningTrans.Taligate = chkTaligate.Checked; rentRunningTrans.Tools = chkTools.Checked; rentRunningTrans.Tyres = chkTyres.Checked; rentRunningTrans.WasherFluid = chkWasherFluid.Checked; rentRunningTrans.WindScreen = chkWindScreen.Checked; rentRunningTrans.DamageDetail = txtDamageDetails.Text; rentRunningTrans.LooseItemDetail = txtLooseItems.Text; intent.PutExtra("RentRunningTrans", JsonConvert.SerializeObject(rentRunningTrans)); StartActivity(intent); } if (e.Item.ItemId == Resource.Id.menu_back) { var intent = new Intent(this, typeof(RentFlowMarkDamageActivity)); intent.PutExtra("RentRunningTrans", JsonConvert.SerializeObject(rentRunningTrans)); StartActivity(intent); } if (e.Item.ItemId == Resource.Id.menu_sendsms) { this.progressLayout.Visibility = ViewStates.Visible; var intentSendSMS = new Intent(this, typeof(SendSMSActivity)); intentSendSMS.PutExtra("MobileNo", rentRunningTrans.Mobile); intentSendSMS.PutExtra("FromActivity", "CheckList"); intentSendSMS.PutExtra("RentRunningTrans", JsonConvert.SerializeObject(rentRunningTrans)); StartActivity(intentSendSMS); } if (e.Item.ItemId == Resource.Id.menu_sendemail) { this.progressLayout.Visibility = ViewStates.Visible; var intentMainMenu = new Intent(this, typeof(SendEmailActivity)); StartActivity(intentMainMenu); } if (e.Item.ItemId == Resource.Id.menu_video) { this.progressLayout.Visibility = ViewStates.Visible; var intentVideo = new Intent(this, typeof(CaptureVideoActivity)); StartActivity(intentVideo); } if (e.Item.ItemId == Resource.Id.menu_dashboard) { this.progressLayout.Visibility = ViewStates.Visible; rentRunningTrans = null; var intentMainMenu = new Intent(this, typeof(MainMenuActivity)); StartActivity(intentMainMenu); } // Toast.MakeText(this, "Bottom toolbar tapped: " + e.Item.TitleFormatted, ToastLength.Short).Show(); }; //Recreate Object if (savedInstanceState != null) { rentRunningTrans = JsonConvert.DeserializeObject <RentRunningTrans>(savedInstanceState.GetString("RentRunningTrans", JsonConvert.SerializeObject(rentRunningTrans))); } else { rentRunningTrans = JsonConvert.DeserializeObject <RentRunningTrans>(Intent.GetStringExtra("RentRunningTrans")); } //Load details from existing object if (rentRunningTrans != null) { actionBar.Title = "Check List for " + rentRunningTrans.TransType; chkAlloyWheel.Checked = rentRunningTrans.AlloyWheel; chkBonet.Checked = rentRunningTrans.Bonet; chkBrakeFluid.Checked = rentRunningTrans.BrakeFluid; chkCoolant.Checked = rentRunningTrans.Coolant; chkDisc.Checked = rentRunningTrans.Disc; chkEngine.Checked = rentRunningTrans.Engine; chkFrontBumper.Checked = rentRunningTrans.FrontBumper; chkInterior.Checked = rentRunningTrans.Interior; chkNSDoor.Checked = rentRunningTrans.NSDoor; chkNSFWheel.Checked = rentRunningTrans.NSFWheel; chkNSRWheel.Checked = rentRunningTrans.NSRWheel; chkOil.Checked = rentRunningTrans.Oil; chkOSDoor.Checked = rentRunningTrans.OSDoor; chkOSFWheel.Checked = rentRunningTrans.OSFWheel; chkOSRWheel.Checked = rentRunningTrans.OSRWheel; chkRearBumper.Checked = rentRunningTrans.RearBumper; chkRoof.Checked = rentRunningTrans.Roof; chkSpareTyre.Checked = rentRunningTrans.SpareTyre; chkTaligate.Checked = rentRunningTrans.Taligate; chkTools.Checked = rentRunningTrans.Tools; chkTyres.Checked = rentRunningTrans.Tyres; chkWasherFluid.Checked = rentRunningTrans.WasherFluid; chkWindScreen.Checked = rentRunningTrans.WindScreen; txtDamageDetails.Text = rentRunningTrans.DamageDetail; txtLooseItems.Text = rentRunningTrans.LooseItemDetail; } }
private void DisplayVehicleDetails(RentRunningTrans rentRunningTrans) { txtRegNo.Text = rentRunningTrans.RegNo; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ActionBar actionBar = ((Activity)this).ActionBar; actionBar.SetDisplayShowHomeEnabled(true); actionBar.SetLogo(Resource.Drawable.ic_launcher); actionBar.SetDisplayUseLogoEnabled(true); // Create your application here SetContentView(Resource.Layout.RentFlowSignature); lstInspection = FindViewById <Spinner>(Resource.Id.lstInspection); strInspectionConditions = Resources.GetStringArray(Resource.Array.strInspectionConditions); var adpInspectionType = ArrayAdapter.CreateFromResource(this, Resource.Array.strInspectionConditions, Resource.Layout.list_item); lstInspection.Adapter = adpInspectionType; lstCleanedBy = FindViewById <Spinner>(Resource.Id.lstCleanedBy); var adpCleanedBy = ArrayAdapter.CreateFromResource(this, Resource.Array.strCleanedBy, Resource.Layout.list_item); lstCleanedBy.Adapter = adpCleanedBy; lstEnteredBy = FindViewById <Spinner>(Resource.Id.lstEnteredBy); var adpEnteredBy = ArrayAdapter.CreateFromResource(this, Resource.Array.strEnteredBy, Resource.Layout.list_item); lstEnteredBy.Adapter = adpEnteredBy; this.progressLayout = FindViewById <ProgressBar>(Resource.Id.progressLayout); this.progressLayout.Visibility = ViewStates.Gone; var actionToolbar = FindViewById <Toolbar>(Resource.Id.action_toolbar); actionToolbar.SetNavigationIcon(Resource.Drawable.ic_action_account_circle); actionToolbar.Title = ApplicationClass.username; actionToolbar.SetPadding(0, 0, 0, 00); actionToolbar.InflateMenu(Resource.Menu.action_menus); actionToolbar.Menu.FindItem(Resource.Id.menu_save).SetVisible(false); actionToolbar.Menu.FindItem(Resource.Id.menu_sendemail).SetVisible(false); actionToolbar.MenuItemClick += (sender, e) => { if (e.Item.ItemId == Resource.Id.menu_next) { //if (lstInspection.SelectedItem.ToString() != "(Selact Inspection Conditions)" && lstCleanedBy.SelectedItem.ToString() != "(Select CleanedBy)" && lstEnteredBy.SelectedItem.ToString() != "(Select EnteredBy)") //{ Regex regxlstInspection = new Regex("(Select Inspection Conditions)"); Regex regxlstCleanedBy = new Regex("(Select CleanedBy)"); Regex regxlstEnteredBy = new Regex("(Select EnteredBy)"); if (regxlstInspection.Match(lstInspection.SelectedItem.ToString()).Success) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetMessage("Please select inspection conditions."); alert.SetNeutralButton("OK", delegate { }); alert.Create().Show(); lstInspection.Focusable = true; lstInspection.FocusableInTouchMode = true; lstInspection.RequestFocus(); lstInspection.PerformClick(); } else if (regxlstCleanedBy.Match(lstCleanedBy.SelectedItem.ToString()).Success) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetMessage("Please select select cleaned by."); alert.SetNeutralButton("OK", delegate { }); alert.Create().Show(); lstCleanedBy.Focusable = true; lstCleanedBy.FocusableInTouchMode = true; lstCleanedBy.RequestFocus(); lstCleanedBy.PerformClick(); } else if (regxlstEnteredBy.Match(lstEnteredBy.SelectedItem.ToString()).Success) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetMessage("Please select entered by."); alert.SetNeutralButton("OK", delegate { }); alert.Create().Show(); lstEnteredBy.Focusable = true; lstEnteredBy.FocusableInTouchMode = true; lstEnteredBy.RequestFocus(); lstEnteredBy.PerformClick(); } else { this.progressLayout.Visibility = ViewStates.Visible; var intent = new Intent(this, typeof(RentFlowDriverSignatureActivity)); //assing extra data rentRunningTrans.InspectionCondition = Convert.ToInt32(lstInspection.SelectedItemId); rentRunningTrans.CleanedBy = Convert.ToInt32(lstCleanedBy.SelectedItemId); rentRunningTrans.CheckedoutBy = Convert.ToInt32(lstEnteredBy.SelectedItemId); //rentRunningTrans. = chkAlloyWheel.Activated; intent.PutExtra("RentRunningTrans", JsonConvert.SerializeObject(rentRunningTrans)); StartActivity(intent); } //} //else //{ // AlertDialog.Builder alert = new AlertDialog.Builder(this); // alert.SetMessage("Please fill all mandatory details."); // alert.SetNeutralButton("OK", delegate { }); // alert.Create().Show(); // // Toast.MakeText(this, "Please fill all mandatory details", ToastLength.Short).Show(); //} } if (e.Item.ItemId == Resource.Id.menu_back) { var intent = new Intent(this, typeof(RentFlowCheckListActivity)); intent.PutExtra("RentRunningTrans", JsonConvert.SerializeObject(rentRunningTrans)); StartActivity(intent); } if (e.Item.ItemId == Resource.Id.menu_sendsms) { this.progressLayout.Visibility = ViewStates.Visible; var intentSendSMS = new Intent(this, typeof(SendSMSActivity)); intentSendSMS.PutExtra("MobileNo", rentRunningTrans.Mobile); intentSendSMS.PutExtra("FromActivity", "SignatureAvtivity"); intentSendSMS.PutExtra("RentRunningTrans", JsonConvert.SerializeObject(rentRunningTrans)); StartActivity(intentSendSMS); } if (e.Item.ItemId == Resource.Id.menu_sendemail) { this.progressLayout.Visibility = ViewStates.Visible; var intentMainMenu = new Intent(this, typeof(SendEmailActivity)); StartActivity(intentMainMenu); } if (e.Item.ItemId == Resource.Id.menu_video) { this.progressLayout.Visibility = ViewStates.Visible; var intentVideo = new Intent(this, typeof(CaptureVideoActivity)); StartActivity(intentVideo); } if (e.Item.ItemId == Resource.Id.menu_dashboard) { this.progressLayout.Visibility = ViewStates.Visible; rentRunningTrans = null; var intentMainMenu = new Intent(this, typeof(MainMenuActivity)); StartActivity(intentMainMenu); } //Toast.MakeText(this, "Bottom toolbar tapped: " + e.Item.TitleFormatted, ToastLength.Short).Show(); }; //Button btnDriverSignature = FindViewById<Button>(Resource.Id.btnDriverSignature); //Button btnCustomerSignature = FindViewById<Button>(Resource.Id.btnCustomerSignature); //btnDriverSignature.Click += btnDriverSignature_Click; //btnCustomerSignature.Click += btnCustomerSignature_Click; //Recreate Object if (savedInstanceState != null) { rentRunningTrans = JsonConvert.DeserializeObject <RentRunningTrans>(savedInstanceState.GetString("RentRunningTrans", JsonConvert.SerializeObject(rentRunningTrans))); } else { rentRunningTrans = JsonConvert.DeserializeObject <RentRunningTrans>(Intent.GetStringExtra("RentRunningTrans")); } //Load details from existing object if (rentRunningTrans != null) { actionBar.Title = "Inspection for " + rentRunningTrans.TransType; lstInspection.SetSelection(rentRunningTrans.InspectionCondition); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ActionBar actionBar = ((Activity)this).ActionBar; actionBar.SetDisplayShowHomeEnabled(true); actionBar.SetLogo(Resource.Drawable.ic_launcher); actionBar.SetDisplayUseLogoEnabled(true); // Create your application here SetContentView(Resource.Layout.RentFlowMarkDamage); this.progressLayout = FindViewById <ProgressBar>(Resource.Id.progressLayout); this.progressLayout.Visibility = ViewStates.Gone; _gestureDetector = new GestureDetector(BaseContext, this); try { var actionToolbar = FindViewById <Toolbar>(Resource.Id.action_toolbar); actionToolbar.SetNavigationIcon(Resource.Drawable.ic_action_account_circle); actionToolbar.Title = ApplicationClass.username; actionToolbar.SetPadding(0, 0, 0, 00); actionToolbar.InflateMenu(Resource.Menu.action_menus); actionToolbar.Menu.FindItem(Resource.Id.menu_save).SetVisible(false); actionToolbar.Menu.FindItem(Resource.Id.menu_sendemail).SetVisible(false); actionToolbar.MenuItemClick += (sender, e) => { if (e.Item.ItemId == Resource.Id.menu_next) { this.progressLayout.Visibility = ViewStates.Visible; SaveAndContinue(); } if (e.Item.ItemId == Resource.Id.menu_back) { var intentVehicle = new Intent(this, typeof(RentFlowVehicleActivity)); intentVehicle.PutExtra("RentRunningTrans", JsonConvert.SerializeObject(rentRunningTrans)); StartActivity(intentVehicle); } if (e.Item.ItemId == Resource.Id.menu_sendsms) { this.progressLayout.Visibility = ViewStates.Visible; var intentSendSMS = new Intent(this, typeof(SendSMSActivity)); intentSendSMS.PutExtra("MobileNo", rentRunningTrans.Mobile); intentSendSMS.PutExtra("FromActivity", "MarkDamage"); intentSendSMS.PutExtra("RentRunningTrans", JsonConvert.SerializeObject(rentRunningTrans)); StartActivity(intentSendSMS); } if (e.Item.ItemId == Resource.Id.menu_sendemail) { this.progressLayout.Visibility = ViewStates.Visible; var intentMainMenu = new Intent(this, typeof(SendEmailActivity)); StartActivity(intentMainMenu); } if (e.Item.ItemId == Resource.Id.menu_video) { this.progressLayout.Visibility = ViewStates.Visible; var intentVideo = new Intent(this, typeof(CaptureVideoActivity)); StartActivity(intentVideo); } if (e.Item.ItemId == Resource.Id.menu_dashboard) { this.progressLayout.Visibility = ViewStates.Visible; rentRunningTrans = null; var intentMainMenu = new Intent(this, typeof(MainMenuActivity)); StartActivity(intentMainMenu); } //Toast.MakeText(this, "Bottom toolbar tapped: " + e.Item.TitleFormatted, ToastLength.Short).Show(); }; _markdamage = FindViewById <FrameLayout>(Resource.Id.markdamage); // imgVehicle = FindViewById<ImageView>(Resource.Id.imgVehicle); //Recreate Object if (savedInstanceState != null) { rentRunningTrans = JsonConvert.DeserializeObject <RentRunningTrans>(savedInstanceState.GetString("RentRunningTrans", JsonConvert.SerializeObject(rentRunningTrans))); } else { rentRunningTrans = JsonConvert.DeserializeObject <RentRunningTrans>(Intent.GetStringExtra("RentRunningTrans")); } //Load details from existing object if (rentRunningTrans != null) { actionBar.Title = "Mark Damage for " + rentRunningTrans.TransType; //have to code here to call vehicle image API and bind thumbnail images BindVehicleImages(); } } catch (Exception ex) { } }