public ActionResult ManageEmployee(EmployeeViewModel model, Address address, bool changeLoginInfo) { if (ModelState.IsValid) { var user = db.Users.Find(model.ID); // transferir propiedaades entre el modelo de empleado y el objeto de usuario // exceptuando las propiedades especificadas en el último argumento. GlobalHelpers.Transfer<EmployeeViewModel, User>(model, user, "Address,Phones,password"); if (changeLoginInfo) // si se especificó cambiar los datos de inicio de sesión { if (user.password != model.password) // si se cambió la contraseña { var passwordHelper = new PasswordHelper(); if (!passwordHelper.HashPassword(model.password)) { model.Address = address; ModelState.AddModelError("", _("lblPasswordPolicyErr")); return View(model); } user.password = PWDTK.HashBytesToHexString(passwordHelper.Hash); user.salt = PWDTK.HashBytesToHexString(passwordHelper.Salt); } } GlobalHelpers.Transfer<Address, Address>(address, user.Address, "ID,Insurers,Users"); user.gender = ((char)model.gender).ToString(); user.maritalStatus = ((char)model.maritalStatus).ToString(); db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index", "Home"); } model.Address = address; return View(model); }
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) { ContentService.Published += ContentServicePublished; ContentService.Created += ContentServiceCreate; //Umbraco App has started if (!_ran) { lock (_lockObj) { if (!_ran) { var helper = GlobalHelpers.GetDatabaseSchemeInstance(); //Check if the DB table does NOT exist if (!helper.TableExist("ContactFormLogs")) { //Create DB table - and set overwrite to false helper.CreateTable <ContactForm>(false); } if (!helper.TableExist("Comments")) { //Create DB table - and set overwrite to false helper.CreateTable <CommentModel>(false); } _ran = true; } } } }
private void LogContactForm(int nodeId, NameValueCollection form, ContactModel model) { try { DateTime date = DateTime.Now; var db = ApplicationContext.DatabaseContext.Database; ContactForm c = new ContactForm { Name = model.Name, Email = model.Email, Date = DateTime.Now, Message = model.Comment }; var helper = GlobalHelpers.GetDatabaseSchemeInstance(); if (helper.TableExist("ContactFormLogs")) { db.Insert(c); } //var contentService = Services.ContentService; //contentService. } catch (Exception ex) { LogHelper.Error <ContactController>("There was an error logging the contact form data.", ex); } }
public ActionResult SendContactForm(ContactModel model) { if (!ModelState.IsValid) { return(CurrentUmbracoPage()); } var um = new UmbracoHelper(UmbracoContext); var email = um.TypedContentAtXPath("//emailTemplate[@nodeName= 'Contact Form']").FirstOrDefault(); // process the form var emailFrom = email.HasValue("emailFrom") ? email.GetPropertyValue("emailFrom").ToString() : "*****@*****.**"; var emailTo = email.GetPropertyValue("emailTo").ToString(); var emailSubject = email.GetPropertyValue("emailSubject").ToString(); var emailBody = email.GetPropertyValue("emailBody").ToString(); if (!string.IsNullOrEmpty(emailTo) && !string.IsNullOrEmpty(emailSubject)) { // process the email body text emailBody = ReplaceShortcodes(emailBody, model); // send the email GlobalHelpers.SendGridEmailMessage(emailFrom, emailTo, emailSubject, emailBody); // store data locally LogContactForm(CurrentPage.Id, Request.Form, model); } return(Redirect(CurrentPage.Url + "?=success")); }
public ActionResult ManageDoctor(DoctorViewModel model, Address address, bool changeLoginInfo) { if (ModelState.IsValid) { var doctor = db.Users.Find(model.ID); GlobalHelpers.Transfer<DoctorViewModel, User>(model, doctor, "Address,Phones,password"); if (changeLoginInfo) { if (doctor.password != model.password) { var passwordHelper = new PasswordHelper(); if (!passwordHelper.HashPassword(model.password)) { model.Address = address; ModelState.AddModelError("", _("lblPasswordPolicyErr")); return View(model); } doctor.password = PWDTK.HashBytesToHexString(passwordHelper.Hash); doctor.salt = PWDTK.HashBytesToHexString(passwordHelper.Salt); } } GlobalHelpers.Transfer<Address, Address>(address, doctor.Address, "ID,Insurers,Users"); doctor.gender = ((char)model.gender).ToString(); doctor.maritalStatus = ((char)model.maritalStatus).ToString(); var doctorData = db.Doctors.FirstOrDefault(d => d.userID == model.ID); doctorData.speciality = model.speciality; db.Entry(doctor).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index", "Home"); } model.Address = address; return View(model); }
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { Console.WriteLine("OnElementPropertyChanged : " + e.PropertyName + System.Environment.NewLine); base.OnElementPropertyChanged(sender, e); var image = (SelfControl.Helpers.PracticeImageView)sender; var bytes = image.ImageByte; var increaseSaturation = image.IncreaseSaturation; if ((Element.Width > 0 && Element.Height > 0)) { if (bytes != null) { uiImage = GlobalHelpers.ImageFromByteArray(bytes); uiImage = uiImage.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate); Control.Image = uiImage; Control.TintColor = new UIColor(0, 0, 0, 1); } } if (increaseSaturation > 0 && !isHeating) { } else if (increaseSaturation < 0 && !isCooling) { } }
public async Task <IActionResult> GPSFormPartial([FromBody] DeviceModel device) { try { UserDetailModel user = HttpContext.Session.SessionGet <UserDetailModel>("user"); if (user == null) { return(PartialView("_ErrorPartial", new ErrorViewModel { ErrorMessage = "Session expired. Please login to continue.", ErrorCode = 1 })); } GPSDeviceViewModel GPSViewModel = new GPSDeviceViewModel(device); GPSViewModel.Lines.AddRange(GlobalHelpers.GenerateSelectListForLines(await _lineRepository.GetLines(user.ID), GPSViewModel.DevicePHP)); GPSViewModel.Drivers.AddRange(GlobalHelpers.GenerateSelectListForDrivers(await _driverRepository.GetDrivers(user.ID))); return(PartialView(GPSViewModel)); } catch (Exception ex) { return(PartialView("_ErrorPartial", new ErrorViewModel { ErrorMessage = ex.GetBaseException().Message, ErrorCode = 2 })); } }
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); mActivity = Context as Activity; var image = (SelfControl.Helpers.ImageDisplay)Element; var file = image.ImageFile; var bytes = image.ImageByte; var IsSelected = image.IsSelected; if ((Element.Width > 0 && Element.Height > 0)) { if (file != null) { rotatedBitmap = null; rotatedBitmap = GlobalHelpers.LoadBitmap(mActivity, file); } else if (bytes != null) { rotatedBitmap = null; BitmapFactory.Options options = new BitmapFactory.Options(); options.InMutable = true; rotatedBitmap = BitmapFactory.DecodeByteArray(bytes, 0, bytes.Length, options); Control.SetImageBitmap(rotatedBitmap); } if (rotatedBitmap != null && IsSelected) { Canvas canvas = new Canvas(rotatedBitmap); Paint paint = new Paint(); paint.SetARGB(165, 0, 0, 0); paint.SetStyle(Paint.Style.Fill); paint.StrokeWidth = 2; canvas.DrawRect(0, 0, rotatedBitmap.Width, rotatedBitmap.Height, paint); } } }
public static async Task SetUserStatusAsync(string uid) { try { var result = await DoubanWebProcess.GetAPIResponseAsync( path : "https://m.douban.com/rexxar/api/v2/user/" + uid, host : "m.douban.com", reffer : "https://m.douban.com/mine/"); LoginStatus = GlobalHelpers.GetLoginStatus(result); Current.LoginUserBlock.Text = LoginStatus.UserName; Current.LoginUserText.SetVisibility(false); var succeed = Uri.TryCreate(LoginStatus.APIUserinfos.LargeAvatar, UriKind.Absolute, out var img_uri); if (!succeed) { succeed = Uri.TryCreate(LoginStatus.APIUserinfos.Avatar, UriKind.Absolute, out img_uri); } if (succeed) { Current.LoginUserIcon.Fill = new ImageBrush { ImageSource = new BitmapImage(img_uri) } } ; IsLogined = true; } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message + "\n" + e.StackTrace); SettingsHelper.SaveSettingsValue(SettingsSelect.UserID, "LOGOUT"); IsLogined = false; } }
public ActionResult Create(Insurer insurer, Address address, string[] Uphones) { if (ModelState.IsValid) { if (Uphones != null) { foreach (string n in Uphones) { var phone = new Phone(); var data = n.Split('|'); phone.number = data[0]; phone.type = (int)GlobalHelpers.ParseEnum <PhoneTypes>(data[1]); phone.notes = data[2]; db.Phones.Add(phone); insurer.Phones.Add(phone); } } insurer.createdBy = WebSecurity.CurrentUserId; insurer.status = true; insurer.Address = address; db.Insurers.Add(insurer); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(insurer)); }
private void AdaptForFrameDivide(object content, double divideNum, bool isDivide) { GlobalHelpers.DivideWindowRange( content as Page, divideNum: DivideNumber, isDivideScreen: IsDivideScreen); }
private void Grid_SizeChanged(object sender, SizeChangedEventArgs e) { GlobalHelpers.SetChildPageMargin( currentPage: this, matchNumber: VisibleWidth, isDivideScreen: IsDivideScreen); }
public void Set(CelestialBody celestialBody, Vector3 cameraPosition, bool selected) { string distanceString = ""; string name = ""; if (celestialBody != null) { name = celestialBody.name; if (m_ParentControlPanel != null) { float distance = (cameraPosition - celestialBody.transform.position).magnitude; distanceString = GlobalHelpers.MakeSpaceDistanceString(distance); } } if (m_NameTextField != null) { m_NameTextField.text = name; } if (m_DistanceTextField != null) { m_DistanceTextField.text = distanceString; } m_CelestialBody = celestialBody; SetSelected(selected); }
public ActionResult Edit(PatientViewModel model, Address address, bool changeLoginInfo) { if (ModelState.IsValid) { var user = db.Users.Find(model.ID); GlobalHelpers.Transfer <PatientViewModel, User>(model, user, "Address,Phones,password"); if (changeLoginInfo) { if (user.password != model.password) { var passwordHelper = new PasswordHelper(); if (!passwordHelper.HashPassword(model.password)) { model.Address = address; ModelState.AddModelError("", _("lblPasswordPolicyErr")); return(View(model)); } user.password = PWDTK.HashBytesToHexString(passwordHelper.Hash); user.salt = PWDTK.HashBytesToHexString(passwordHelper.Salt); } } GlobalHelpers.Transfer <Address, Address>(address, user.Address, "ID,Insurers,Users"); user.gender = ((char)model.gender).ToString(); user.maritalStatus = ((char)model.maritalStatus).ToString(); db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } model.Address = address; return(View(model)); }
public ActionResult MedicalHistory(int id) { var patient = db.Patients.Find(id); if (patient == null) { return(this.InvokeHttp404(HttpContext)); } var history = db.MedicalHistories .FirstOrDefault(mh => mh.patientID == id); if (history == null) { history = new MedicalHistory(); history.patientID = id; history.completed = false; db.MedicalHistories.Add(history); db.SaveChanges(); } var model = new MedicalHistoryViewModel(); model.patientID = id; model.Patient = patient; GlobalHelpers.Transfer <MedicalHistory, MedicalHistoryViewModel>(history, model); model.medicalhistoryID = history.ID; return(View(model)); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); SetPageLoadingStatus(); var args = e.Parameter as NavigateParameter; frameType = args.FrameType; if (isFromInfoClick = args.IsFromInfoClick) { GlobalHelpers.SetChildPageMargin(this, matchNumber: VisibleWidth, isDivideScreen: IsDivideScreen); } if (args == null) { return; } if (args.Title != null) { navigateTitlePath.Text = args.Title; } if (isNative = args.IsNative) { SetWebViewSourceAsync(currentUri = args.ToUri); } else { WebView.Source = currentUri = args.ToUri; } }
private ResourceObject GetResource(string deploymentId, string resourceId) { var req = GlobalHelpers.GetCamundaClient(Client) .Deployment.GetResource(deploymentId, resourceId); return(req.GetAwaiter().GetResult()); }
/// <summary> /// Método utilitario que obtiene los datos de lso teléfonos /// registrados en la base de datos de un usuario o de una /// aseguradora, y los retorna en notación javascript para /// ser mostrados en una tabla html. /// </summary> /// <param name="id"> /// ID de la entidad a la que pertenecen dichos teléfonos (Usuario, Aseguradora) /// </param> /// <param name="isUser">valor que indica si los teléfonos son de un usuario.</param> /// <returns>un JsonResult de los datos de los teléfonos en notación javascript.</returns> public ActionResult UpdatePhonesTable(int id, bool isUser) { var phones = new List <Phone>(); if (isUser) { phones = db.Users.Find(id).Phones.ToList(); } else { phones = db.Insurers.Find(id).Phones.ToList(); } return(Json( new { aaData = phones.Select( p => new[] { p.number.CFormat("phone"), GlobalHelpers.t(((PhoneTypes)p.type).ToString()), p.notes, p.ID.ToString() } ) }, JsonRequestBehavior.AllowGet )); }
public static void SetUserStatus(HtmlDocument doc) { LoginStatus = GlobalHelpers.GetLoginStatus(doc); Current.LoginUserBlock.Text = LoginStatus.UserName; Current.LoginUserText.SetVisibility(false); Current.LoginUserIcon.Fill = new ImageBrush { ImageSource = new BitmapImage(new Uri(LoginStatus.ImageUrl)) }; }
protected override void ProcessRecord() { var exTasks = GlobalHelpers.GetCamundaClient(Client).ExternalTask; var result = exTasks.FetchAndLock(Options).GetAwaiter().GetResult(); WriteObject(result, true); }
private async void LogoutButton_ClickAsync(object sender, RoutedEventArgs e) { var path = "https://www.douban.com/accounts/logout?source=main"; await DoubanWebProcess.GetDoubanResponseAsync(path); SettingsHelper.SaveSettingsValue(SettingsSelect.UserID, "LOGOUT"); GlobalHelpers.ResetLoginStatus(); PageSlideOutStart(VisibleWidth > FormatNumber ? false : true); }
public static void GetHeliocentricEclipticalCoordinates(List <List <float> > meanEquinoxData, double julianDate, out double radiusVector, out double eclipticalLongitude, out double eclipticLatitude) { // Calculate time in Julian centuries of 36525 ephemeris days from the epoch 1900 January 0.5 ET double t = (julianDate - 2415020.0) / 36525.0; // Mean longitude of the planet in degrees double meanLongitude = GlobalHelpers.RotationClamp(GlobalHelpers.Polynomial(t, meanEquinoxData[(int)OrbitalElements.MEAN_LONGITUDE_OF_PLANET]), GlobalConstants.MaxDegrees); // Semi major axis of the orbit( this element is a constant for each planet) double semiMajorAxis = GlobalHelpers.Polynomial(t, meanEquinoxData[(int)OrbitalElements.SEMI_MAJOR_AXIS_OF_ORBIT]); // Eccentricity of the orbit double eccentricityOfOrbit = GlobalHelpers.Polynomial(t, meanEquinoxData[(int)OrbitalElements.ECCENTRICITY_OF_THE_ORBIT]); // Inclination on the plane of the ecliptic in radians double inclinationOnPlaneOfEcliptic = GlobalHelpers.RotationClamp(GlobalHelpers.Polynomial(t, meanEquinoxData[(int)OrbitalElements.INCLINATION_ON_PLANE_OF_ECLIPTIC]), GlobalConstants.MaxDegrees) * GlobalConstants.DegreesToRadians; // Argument of perihelion in degrees double argumentOfPerihelion = GlobalHelpers.RotationClamp(GlobalHelpers.Polynomial(t, meanEquinoxData[(int)OrbitalElements.ARGUMENT_OF_PERIHELION]), GlobalConstants.MaxDegrees); // Longitude of ascending node in degrees double longitudeOfAscendingNode = GlobalHelpers.RotationClamp(GlobalHelpers.Polynomial(t, meanEquinoxData[(int)OrbitalElements.LONGITUDE_OF_ASCENDING_NODE]), GlobalConstants.MaxDegrees); double longitudeOfPerihelion = argumentOfPerihelion + longitudeOfAscendingNode; double meanAnomaly = GlobalHelpers.RotationClamp(meanLongitude - longitudeOfPerihelion, GlobalConstants.MaxDegrees); // Calculate the heliocentric ecliptical coordinates // Determine eccentric anomaly double E = SolveEccentricAnomaly(meanAnomaly * GlobalConstants.DegreesToRadians, eccentricityOfOrbit); // Determine true anomaly in degrees // tan(v/2) = [ (1 + eccentricityOfOrbit) / (1 – eccentricityOfOrbit) ]1/2 × tan(E/2) // v is true anomaly double trueAnomaly = GlobalHelpers.RotationClamp(2.0 * GlobalConstants.RadiansToDegrees * Math.Atan(Math.Pow((1.0 + eccentricityOfOrbit) / (1.0 - eccentricityOfOrbit), 0.5) * Math.Tan(E * 0.5)), GlobalConstants.MaxDegrees); // Determine argument of latitude in radians // u = meanLongitude + v – M – W // u is argument of latitude double argumentOfLatitude = GlobalHelpers.RotationClamp((meanLongitude + trueAnomaly - meanAnomaly - longitudeOfAscendingNode), GlobalConstants.MaxDegrees) * GlobalConstants.DegreesToRadians; // Radius vector of planet in AU // r = semiMajorAxis × ( 1 – eccentricityOfOrbit × cos E ) OR r = semiMajorAxis × ( 1 – e2 ) / ( 1 + eccentricityOfOrbit × cos n ) radiusVector = semiMajorAxis * (1.0 - eccentricityOfOrbit * Math.Cos(E)); // Determine ecliptical longitude in degrees // l is ecliptical longitude // The ecliptical longitude l can be deduced from (l – W), which is given by tan( l – W ) = cos inclinationOnPlaneOfEcliptic × tan u // To deal with the correct quadrants we use instead: tan(l – W) = cos inclinationOnPlaneOfEcliptic × sin u / cos u and use ATan2 on the RHS to resolve l eclipticalLongitude = Math.Atan2(Math.Cos(inclinationOnPlaneOfEcliptic) * Math.Sin(argumentOfLatitude), Math.Cos(argumentOfLatitude)) * GlobalConstants.RadiansToDegrees + longitudeOfAscendingNode; // Determine ecliptic latitude in degrees // b is ecliptic latitude // sin b = sin u × sin inclinationOnPlaneOfEcliptic eclipticLatitude = Math.Asin(Math.Sin(argumentOfLatitude) * Math.Sin(inclinationOnPlaneOfEcliptic)) * GlobalConstants.RadiansToDegrees; }
private async void BtnAddDriver_Click(object sender, RoutedEventArgs e) { progressBar.Visibility = Visibility.Visible; try { var selectedVehicle = comboVehicles.SelectedItem as VehicleEntity; var driver = new DriverEntity { Firstname = txtFirstname.Text, Address = txtAddress.Text, DoB = GlobalHelpers.GetDate(txtDob.Text), Lastname = txtLastname.Text, UploadDate = DateTime.Now, Phone = txtPhone.Text, DriverStatus = Core.Enumerations.EnumStatus.Active, VehicleId = selectedVehicle.Id }; var userDriver = new UserEntity { Address = driver.Address, DoB = driver.DoB, UploadDate = driver.UploadDate, Firstname = driver.Firstname, Lastname = driver.Lastname, Password = "******", Role = Core.Enumerations.EnumRole.Driver, Phone = driver.Phone }; var response = await _httpClientService.PostAsync(userDriver, "Users/register"); if (response.IsSuccessStatusCode) { response = await _httpClientService.PostAsync(driver, "Drivers/add"); if (response.IsSuccessStatusCode) { MessageDialog messageDialog = new MessageDialog($"{driver.Firstname} {driver.Lastname} has been registered as driver"); await messageDialog.ShowAsync(); } else { txtError.Text = await response.Content.ReadAsStringAsync(); } } else { txtError.Text = await response.Content.ReadAsStringAsync(); } } catch (Exception ex) { txtError.Text = ex.Message; } progressBar.Visibility = Visibility.Collapsed; }
public ActionResult Create(AppointmentViewModel model) { if (ModelState.IsValid) { var doctor = db.Doctors.Find(model.doctorID); var patient = db.Patients.Find(model.patientID); // verificar si el doctor no ha definido sus reglas para consulta if (doctor.DoctorRules.Count() == 0) { ModelState.AddModelError("", _("lblDcotorAPErr")); // Agregar error al modelo. } // verificar si el doctor consulta ese día. else if (!doctor.DoctorRules .ElementAt(0).availableDays.Split(',') .Contains(((int)model.appointmentDate.DayOfWeek).ToString())) { ModelState.AddModelError("", _("lblDoctorConsDayErr")); } // verificar la cantidad de pacientes que han reservado cita ese día. else if (doctor.Appointments .Where(a => a.appointmentDate.Date == model.appointmentDate.Date).Count() >= doctor.DoctorRules.ElementAt(0).maxPatients) { ModelState.AddModelError( "", string.Format( _("lblDoctorMaxPatientsErr"), doctor.DoctorRules.ElementAt(0).maxPatients ) ); } // verificar si el paciente tiene una cita con este doctor. else if (patient.Appointments.Where(a => a.status == true && a.doctorID == model.doctorID && a.finalStatus == null).Count() > 0) { ModelState.AddModelError("", _("lblPatientAASErr")); } else { var appointment = new Appointment(); GlobalHelpers.Transfer <AppointmentViewModel, Appointment>(model, appointment); appointment.createUser = WebSecurity.CurrentUserId; appointment.status = true; db.Appointments.Add(appointment); db.SaveChanges(); return(RedirectToAction("Index")); } } var patients = db.Patients.Where(p => p.User1.status == true).ToList(); var doctors = db.Doctors.Where(d => d.User.status == true).ToList(); ViewBag.patientID = patients.ToSelectListItems(p => p.User1.CompleteName, p => p.ID.ToString()); ViewBag.doctorID = doctors.ToSelectListItems(d => d.User.CompleteName, d => d.ID.ToString()); ViewBag.patients = patients; return(View(model)); }
internal void InitCards() { ThreeLetterFunSaveInfo saveRoot = cons !.Resolve <ThreeLetterFunSaveInfo>(); GlobalHelpers global = cons !.Resolve <GlobalHelpers>(); if (saveRoot.Level == EnumLevel.None) { throw new BasicBlankException("Must choose the level before you can initialize the cards"); } PrivateSavedList = global.SavedCardList.Where(items => items.Level == saveRoot.Level).ToCustomBasicList(); }
public ActionResult Edit(MedicineViewModel model) { if (ModelState.IsValid) { var medicine = db.Medicines.Find(model.ID); GlobalHelpers.Transfer <MedicineViewModel, Medicine>(model, medicine); db.Entry(medicine).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult ResetPassword(ResetModel model) { if (ModelState.IsValid) { var user = db.Users .FirstOrDefault(u => u.email == model.email); if (user == null) { ModelState.AddModelError("", _("lblInvalidMailErr")); } else { try { var fromAddress = new MailAddress(Settings.Default.SMTP_Mail, Settings.Default.SMTP_FromName); var toAddress = new MailAddress(model.email, user.firstName); string fromPassword = Settings.Default.SMTP_Password; string subject = Language.ResetPasword_SubjectMsg; var passwordHelper = new PasswordHelper(); var password = GlobalHelpers.CreateRandomPassword(10); passwordHelper.HashGeneratedPassword(password); user.password = PWDTK.HashBytesToHexString(passwordHelper.Hash); user.salt = PWDTK.HashBytesToHexString(passwordHelper.Salt); db.SaveChanges(); string body = string.Format( Language.ResetPassword_BodyMsg, user.CompleteName, user.username, password ); var smtp = new SmtpClient { Host = Settings.Default.SMTP_Host, Port = Convert.ToInt16(Settings.Default.SMTP_Port), EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new NetworkCredential(fromAddress.Address, fromPassword) }; using (var message = new MailMessage(fromAddress, toAddress) { Subject = subject, Body = body, IsBodyHtml = true }) { smtp.Send(message); } TempData["success"] = _("lblSendMailSuccess"); } catch { ModelState.AddModelError("", _("lblSendMailErr")); } } } return View(model); }
public ActionResult Edit(StudyViewModel study) { if (ModelState.IsValid) { var model = db.Studies.Find(study.ID); GlobalHelpers.Transfer <StudyViewModel, Study>(study, model); db.Entry(model).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Details", new { id = model.ID })); } return(View(study)); }
public ActionResult Edit(ProcedureViewModel procedure) { if (ModelState.IsValid) { var model = db.Procedures.Find(procedure.ID); GlobalHelpers.Transfer <ProcedureViewModel, Procedure>(procedure, model); db.Entry(model).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(procedure)); }
public MainPage() { this.InitializeComponent(); BtnUser.Click += BtnUser_Click; GlobalHelpers globalHelpers = new GlobalHelpers(); _googleMapsApi = new GoogleMapsServices(); _placesService = new PlacesService(); //GoogleMapsServices.Initialize("AIzaSyAPbw5REd81rKh2BE3XbLoazyzKU859qHA"); Suggestions = new ObservableCollection <string>(_placesService.GetMatrackPlaces().Select(p => p.Name)); _requestMatatuResponses = new List <RequestMatatuResponse>(); listResponse.SelectionChanged }