public async Task <IActionResult> Save(Appuser appuser) { var newperson = await _appuserService.AddAsync(appuser); return(Ok(newperson)); }
private void btnCrearUsuario_Click(object sender, EventArgs e) { Appuser c = new Appuser(); c.fullname = txtfullname.Text; c.username = txtusername.Text; c.password = txtpassword.Text; try { // Enviar a modelo, el se encargara de almacenarlo en la BDD ConsultarAppuser.agregarAppuser(c); MessageBox.Show("Cliente agregado exitosamente", "Clase GUI 04", MessageBoxButtons.OK, MessageBoxIcon.Information); // Actualizar la vista, los ComboBox de la primer pestana actualizarControles(); } catch (Exception exception) { MessageBox.Show("Error: " + exception.Message, "Clase GUI 04", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public async Task <Coordinates> Handle(PostCoordinatesCommand request, CancellationToken cancellationToken) { var user = await _dbContext.FindAsync <Appuser>(request.Coordinates.Id); if (user == null) { //create new user var appUser = new Appuser() { Id = request.Coordinates.Id }; _dbContext.Add(appUser); await _dbContext.SaveChangesAsync(); } var addedTime = UnixTimeStampToDateTime(request.Coordinates.TimeStamp); var coordInfo = new Coordinatesinfo() { Id = Guid.NewGuid(), Latitude = request.Coordinates.Latitude, Longitude = request.Coordinates.Longitude, Addedtime = addedTime, Appuserid = request.Coordinates.Id }; _dbContext.Add(coordInfo); await _dbContext.SaveChangesAsync(); return(request.Coordinates); }
private void btnIniciarSesion_Click(object sender, EventArgs e) { if (Encriptador.CompararMD5(txtpassword.Text, cmbUsuario.SelectedValue.ToString())) { Appuser c = (Appuser)cmbUsuario.SelectedItem; if (c.userType) { RegistroDAO.iniciarSesion(c.username); MessageBox.Show("¡Bienvenido!", "apphugo", MessageBoxButtons.OK, MessageBoxIcon.Information); frmPrincipal ventana = new frmPrincipal(); ventana.Show(); this.Hide(); } } else { MessageBox.Show("¡Bienvenido!", "hugoapp", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } frmPrincipal aventana = new frmPrincipal(); aventana.Show(); this.Hide(); }
public async Task <CommonResponce> ResetUserPassByAdminAsync(long UID, string ResetContext, DateTime PasswordValidity) { CommonResponce result = new CommonResponce { Stat = false, StatusMsg = "" }; Appuser oUser = await _DBUserRepository.GetUserByID(UID).ConfigureAwait(false); if (oUser != null) { oUser.IsPassReset = 1; oUser.ResetPassContext = ResetContext; oUser.ResetPassValidity = PasswordValidity; await _DBUserRepository.Update(oUser).ConfigureAwait(false); result.Stat = true; result.StatusMsg = "Successfully reset User password"; result.StatusObj = oUser; } else { result.StatusMsg = "Not a valid User"; } return(result); }
private void btnCambiarContra_Click(object sender, EventArgs e) { bool actualIgual = txtActual.Text.Equals(cmbUsuario.SelectedValue.ToString()); bool nuevaIgual = txtNueva.Text.Equals(txtRepetir.Text); bool nuevaValida = txtNueva.Text.Length > 0; if (actualIgual && nuevaIgual && nuevaValida) { try { Appuser u = (Appuser)cmbUsuario.SelectedItem; AppuserDAO.updateAppuser(u.IdUser, txtNueva.Text); MessageBox.Show("¡Contraseña actualizada exitosamente!", "Hugo App", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } catch (Exception) { MessageBox.Show("¡Contraseña no actualizada! Favor intente mas tarde.", "Hugo App", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("¡¡Favor verifique que los datos sean correctos!", "Hugo App", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public async Task <IActionResult> Login(LoginModel loginModel) { if (ModelState.IsValid) { Appuser user = await userManager.FindByNameAsync(loginModel.Name); if (user != null) { await signInManager.SignOutAsync(); if ((await signInManager.PasswordSignInAsync(user, loginModel.Password, false, false)).Succeeded) { string mainurl = "/Product/Add"; //return RedirectToAction("Add", "Product"); //return Redirect("/Product/Add"); var rolename = await userManager.GetRolesAsync(user); return(LocalRedirect(mainurl)); var s = User.Identity.IsAuthenticated; string x = loginModel?.ReturnUrl ?? "/Admin/Index"; return(Redirect(x)); } } } ModelState.AddModelError("", "Invalid name or password"); return(View(loginModel)); }
public MainForm(Appuser Puser) { InitializeComponent(); user = Puser; current = new User(user); tbl1.Controls.Add(current, 0, 1); current.Dock = DockStyle.Fill; }
public frmPrincipal(Appuser u) { InitializeComponent(); user = u; //inicializar grafico graficoProductos = new CartesianChart(); this.Controls.Add(graficoProductos); graficoProductos.Parent = tabControl1.TabPages[3]; }
public async Task Update(Appuser entity) { if (entity == null) { throw new ArgumentNullException("entity"); } entities.Attach(entity); _DBContext.Entry(entity).State = EntityState.Modified; await _DBContext.SaveChangesAsync(); }
public async Task <int> Insert(Appuser entity) { if (entity == null) { throw new ArgumentNullException("entity"); } entities.Add(entity); int result = await _DBContext.SaveChangesAsync(); return(result); }
public IActionResult AddUser(string userName, string password)//view result { userName = "******"; password = "******"; var user = new Appuser { UserName = userName }; var res = userManager.CreateAsync(user, password).Result; var ss = res.Succeeded; return(RedirectToAction("Login")); }
private void button1_Click_1(object sender, EventArgs e) { Appuser u = (Appuser)cmbAlterAppuser.SelectedItem; if (MessageBox.Show("¿Seguro que desea eliminar al usuario ?", "Hugo App", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { AppuserDAO.delete(u.IdUser); MessageBox.Show("¡Usuario eliminado exitosamente!", "Hugo App", MessageBoxButtons.OK, MessageBoxIcon.Information); } actualizarControles(); }
private void btnLogin_Click(object sender, EventArgs e) { if (txtPassword.Text.Equals(cmbUsername.SelectedValue.ToString())) { Appuser u = (Appuser)cmbUsername.SelectedItem; MainForm ventana = new MainForm(u); ventana.Show(); this.Hide(); } else { MessageBox.Show("¡Incorrect Password, try again!", "Hugo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public async Task <CommonResponce> ResetUserPassAsync(UserResetVM oModel) { CommonResponce result = new CommonResponce { Stat = false, StatusMsg = "" }; try { Appuser oUser = await _DBUserRepository.GetUserByPassResetContext(oModel.UserResetContext).ConfigureAwait(false); if (oUser != null) { if (oUser.ResetPassValidity < DateTime.Now) { result.StatusMsg = "Reset Password Link has expired"; } else { if (oUser.IsActive == 1) { oUser.IsPassReset = 0; oUser.ResetPassContext = ""; oUser.Password = _AppEncription.EncriptWithPrivateKey(oModel.Password); await _DBUserRepository.Update(oUser).ConfigureAwait(false); result.Stat = true; result.StatusMsg = "Successfully reset user Password"; } else { result.StatusMsg = "User not valid or expired"; } } } else { result.StatusMsg = "Not a valid password reset link."; } } catch (Exception) { result.StatusMsg = "Not a valid password reset link (ex)."; } return(result); }
private void btnChangeP_Click(object sender, EventArgs e) { Appuser u = (Appuser)cmbUsername.SelectedItem; bool actualIgual = txtCurrent.Text.Equals(cmbUsername.SelectedValue.ToString()); bool nuevaIgual = txtNew.Text.Equals(txtConfirm.Text); bool nuevavalida = false; try { if (txtNew.Text.Length < 3) { throw new InvalidPasswordException(); } else { nuevavalida = true; } } catch (InvalidPasswordException) { MessageBox.Show("¡Ups! the password is too short!.", "Hugo", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (actualIgual && nuevaIgual && nuevavalida) { try { AppuserDAO.updatePassword(u.idUser, txtNew.Text); MessageBox.Show("¡The password has been changed succesfully!", "Hugo", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } catch (Exception) { MessageBox.Show("¡Ups! Please try later.", "Hugo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("¡Verify if the password is correct!", "Hugo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public async Task <JsonResult> ResetUserPassByAdmin(long id) { string ResetContext = Guid.NewGuid().ToString().Replace("-", "RP"); DateTime PassValidity = DateTime.Now.AddDays(3); //validity for 3 day var result = await _AppUserService.ResetUserPassByAdminAsync(id, ResetContext, PassValidity).ConfigureAwait(false); if (result.Stat) { var oLoginUser = GetLoginUserInfo(); Appuser oUser = (Appuser)result.StatusObj; await _JobService.UserPassResetEmailJob(Convert.ToInt64(oLoginUser.ID), oUser.Name, oUser.Email, GetAppRootUrl(), ResetContext); return(Json(new { stat = true, msg = "Successfully reset user password" })); } else { return(Json(new { stat = false, msg = result.StatusMsg })); } }
private void btnIniciarSesion_Click(object sender, EventArgs e) { if (txtContrasena.Text.Equals(cmbUsuario.SelectedValue.ToString())) { Appuser u = (Appuser)cmbUsuario.SelectedItem; MessageBox.Show("¡Bienvenido!", "Hugo App", MessageBoxButtons.OK, MessageBoxIcon.Information); frmPrincipal ventana = new frmPrincipal(u); ventana.Show(); this.Hide(); } else { MessageBox.Show("¡Contraseña incorrecta!", "Hugo App", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void button2_Click(object sender, EventArgs e) { Appuser u = new Appuser(); u.Fullname = txtAdminUserFull.Text; u.Username = txtAdminUserName.Text; u.Password = "******"; u.UserType = chbAdmin.Checked; if (MessageBox.Show("¿Seguro que desea agregar al usuario ?", "Hugo App", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { AppuserDAO.addAppuser(u); MessageBox.Show("¡Usuario agregado exitosamente; la contrasena es password!", "Hugo App", MessageBoxButtons.OK, MessageBoxIcon.Information); } actualizarControles(); }
public IActionResult Creat(CreatUserViewModel model) { string Errortxt = null; if (ModelState.IsValid) { Appuser user = new Appuser(); user.UserName = model.username; // user.PasswordHash = model.username; user.Email = model.Email; //.resule وایمیسته تا نتیجه بیاد var save = UserManager.CreateAsync(user, model.username).Result; if (save.Succeeded) { return(RedirectToAction("Index")); } else { foreach (var item in save.Errors) { Errortxt = Errortxt + " " + item.Description; ModelState.AddModelError(item.Code, item.Description); } } //اگر postBack باشه ب f**k میره ViewBag.Error = Errortxt; //UserManager.add //repoditory or savind here } else { return(View(model)); } return(View()); }
public async Task <IActionResult> OnPostAsync(string returnUrl = null) { returnUrl = returnUrl ?? Url.Content("~/"); ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList(); if (ModelState.IsValid) { var user = new Appuser { UserName = Input.StaffID, Email = Input.StaffID }; var result = await _userManager.CreateAsync(user, Input.Password); if (result.Succeeded) { _logger.LogInformation("User created a new account with password."); if (_userManager.Options.SignIn.RequireConfirmedAccount) { return(RedirectToPage("RegisterConfirmation", new { email = Input.StaffID, returnUrl = returnUrl })); } else { await _signInManager.SignInAsync(user, isPersistent : false); return(LocalRedirect(returnUrl)); } } foreach (var error in result.Errors) { ModelState.AddModelError(string.Empty, error.Description); } } // If we got this far, something failed, redisplay form return(Page()); }
public User(Appuser pUser) { InitializeComponent(); user = pUser; }
public frmAddAddress(Appuser u) { InitializeComponent(); user = u; }
protected override void Seed(LicenseServer.Core.DbContext.AppDbContext context) { var dbIntialize = Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings.Get("IsDbIntialize")); if (dbIntialize) { LicUserManager usermanager = LicUserManager.Create(context); LicRoleManager roleManager = LicRoleManager.Create(context); Organization org = new Organization(); org.Name = "Fluke"; org = context.Organization.Add(org); context.SaveChanges(); Appuser user = new Appuser(); string roleName = "BackendAdmin"; user.FirstName = "admin"; user.Email = System.Configuration.ConfigurationSettings.AppSettings.Get("AdminUserName"); user.UserName = user.Email; user.OrganizationId = org.Id; var result = usermanager.Create(user, System.Configuration.ConfigurationSettings.AppSettings.Get("AdminPassword")); if (roleManager.FindByName(roleName) == null) { roleManager.Create(new AppRole() { Name = roleName }); } user = usermanager.FindByEmail(user.Email); usermanager.AddToRole(user.UserId, roleName); var category1 = new ProductCategory() { Name = "Calibration", Description = "Best in class calibration solution." }; var category2 = new ProductCategory() { Name = "Bio Medical", Description = "Best in class biomedical automation solution." }; context.ProductCategory.Add(category1); context.ProductCategory.Add(category2); context.SaveChanges(); #region Biomedical Feature List var biomedicalFeature_01 = new LicenseServer.Core.Model.Feature() { Name = "Full Suite", Description = "It Contains full suite functionalities", Version = "v1.0", price = 30, Caategory = category2, }; context.Feature.Add(biomedicalFeature_01); var biomedicalFeature_02 = new LicenseServer.Core.Model.Feature() { Name = "Electrical Safety", Description = "It contains electrical safety functionalities", Version = "v1.0", price = 40, Caategory = category2 }; context.Feature.Add(biomedicalFeature_02); var biomedicalFeature_04 = new LicenseServer.Core.Model.Feature() { Name = "Patient Simulation", Description = "It contains patient simulation functionalities", Version = "v1.0", price = 50, Caategory = category2 }; context.Feature.Add(biomedicalFeature_04); var biomedicalFeature_08 = new LicenseServer.Core.Model.Feature() { Name = "Infusion Pump Verification", Description = "It contains infusion pump verification functionalities", Version = "v1.0", price = 70, Caategory = category2 }; context.Feature.Add(biomedicalFeature_08); #endregion Biomedical Feature List #region Calibration feature List var calibrationFeature_01 = new LicenseServer.Core.Model.Feature() { Name = "Pressure Calibration", Description = "It contains pressure calibration functionalities", Version = "v1.0", price = 30, Caategory = category1 }; context.Feature.Add(calibrationFeature_01); var calibrationFeature_02 = new LicenseServer.Core.Model.Feature() { Name = "Temperature Calibration", Description = "It contains temperature calibration functionalities", Version = "v1.0", price = 40, Caategory = category1 }; context.Feature.Add(calibrationFeature_02); var calibrationFeature_04 = new LicenseServer.Core.Model.Feature() { Name = "Electrical Calibration", Description = "It contains electrical calibration functionalities", Version = "v1.0", price = 50, Caategory = category1 }; context.Feature.Add(calibrationFeature_04); var calibrationFeature_08 = new LicenseServer.Core.Model.Feature() { Name = "Fluke 2638A Bundle", Description = "It contains fluke 2638A functionalities", Version = "v1.0", price = 70, Caategory = category1 }; context.Feature.Add(calibrationFeature_08); #endregion Calibration feature List #region CMMS Solution feature list var CMMSSolutionFeature_01 = new LicenseServer.Core.Model.Feature() { Name = "CMMSSolutionFeature_01", Description = "It contains CMMSSolution Feature_01 functionalities", price = 30, Version = "v1.0" }; context.Feature.Add(CMMSSolutionFeature_01); var CMMSSolutionFeature_02 = new LicenseServer.Core.Model.Feature() { Name = "CMMSSolutionFeature_02", Description = "It contains CMMSSolution Feature_02 functionalities", price = 50, Version = "v1.0" }; context.Feature.Add(CMMSSolutionFeature_02); var CMMSSolutionFeature_04 = new LicenseServer.Core.Model.Feature() { Name = "CMMSSolutionFeature_04", Description = "It contains CMMSSolution Feature_04 functionalities", price = 70, Version = "v1.0" }; context.Feature.Add(CMMSSolutionFeature_04); #endregion CMMS Solution feature list context.SaveChanges(); #region Biomedical Product var biomedicalProduct_01 = new LicenseServer.Core.Model.Product() { Name = "biomedicalProduct_01", Description = "biomedicalProduct_01", ImagePath = "P1.png", Price = 50, ProductCode = "Pro_O1", AssociatedFeatures = new List <Feature> { biomedicalFeature_01 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; biomedicalProduct_01.Categories = new List <ProductCategory>(); biomedicalProduct_01.Categories.Add(category2); context.Product.Add(biomedicalProduct_01); var biomedicalProduct_02 = new LicenseServer.Core.Model.Product() { Name = "biomedicalProduct_02", Description = "biomedicalProduct_02", ImagePath = "P1.png", Price = 100, ProductCode = "Pro_O2", AssociatedFeatures = new List <Feature> { biomedicalFeature_02 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; biomedicalProduct_02.Categories = new List <ProductCategory>(); biomedicalProduct_02.Categories.Add(category2); context.Product.Add(biomedicalProduct_02); var biomedicalProduct_03 = new LicenseServer.Core.Model.Product() { Name = "biomedicalProduct_03", Description = "biomedicalProduct_03", ImagePath = "P1.png", Price = 150, ProductCode = "Pro_O3", AssociatedFeatures = new List <Feature> { biomedicalFeature_02, biomedicalFeature_01 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; biomedicalProduct_03.Categories = new List <ProductCategory>(); biomedicalProduct_03.Categories.Add(category2); context.Product.Add(biomedicalProduct_03); var biomedicalProduct_04 = new LicenseServer.Core.Model.Product() { Name = "biomedicalProduct_04", Description = "biomedicalProduct_04", ImagePath = "P1.png", Price = 200, ProductCode = "Pro_O4", AssociatedFeatures = new List <Feature> { biomedicalFeature_04 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; biomedicalProduct_04.Categories = new List <ProductCategory>(); biomedicalProduct_04.Categories.Add(category2); context.Product.Add(biomedicalProduct_04); var biomedicalProduct_05 = new LicenseServer.Core.Model.Product() { Name = "biomedicalProduct_05", Description = "biomedicalProduct_05", ImagePath = "P1.png", Price = 250, ProductCode = "Pro_O5", AssociatedFeatures = new List <Feature> { biomedicalFeature_04, biomedicalFeature_01 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; biomedicalProduct_05.Categories = new List <ProductCategory>(); biomedicalProduct_05.Categories.Add(category2); context.Product.Add(biomedicalProduct_05); var biomedicalProduct_06 = new LicenseServer.Core.Model.Product() { Name = "biomedicalProduct_06", Description = "biomedicalProduct_06", ImagePath = "P1.png", Price = 300, ProductCode = "Pro_O6", AssociatedFeatures = new List <Feature> { biomedicalFeature_04, biomedicalFeature_02 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; biomedicalProduct_06.Categories = new List <ProductCategory>(); biomedicalProduct_06.Categories.Add(category2); context.Product.Add(biomedicalProduct_06); var biomedicalProduct_07 = new LicenseServer.Core.Model.Product() { Name = "biomedicalProduct_07", Description = "biomedicalProduct_07", ImagePath = "P1.png", Price = 350, ProductCode = "Pro_O7", AssociatedFeatures = new List <Feature> { biomedicalFeature_04, biomedicalFeature_02, biomedicalFeature_01 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; biomedicalProduct_07.Categories = new List <ProductCategory>(); biomedicalProduct_07.Categories.Add(category2); context.Product.Add(biomedicalProduct_07); var biomedicalProduct_08 = new LicenseServer.Core.Model.Product() { Name = "biomedicalProduct_08", Description = "biomedicalProduct_08", ImagePath = "P1.png", Price = 400, ProductCode = "Pro_O8", AssociatedFeatures = new List <Feature> { biomedicalFeature_08 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; biomedicalProduct_08.Categories = new List <ProductCategory>(); biomedicalProduct_08.Categories.Add(category2); context.Product.Add(biomedicalProduct_08); var biomedicalProduct_09 = new LicenseServer.Core.Model.Product() { Name = "biomedicalProduct_09", Description = "biomedicalProduct_09", ImagePath = "P1.png", Price = 450, ProductCode = "Pro_O9", AssociatedFeatures = new List <Feature> { biomedicalFeature_08, biomedicalFeature_01 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; biomedicalProduct_09.Categories = new List <ProductCategory>(); biomedicalProduct_09.Categories.Add(category2); context.Product.Add(biomedicalProduct_09); var biomedicalProduct_10 = new LicenseServer.Core.Model.Product() { Name = "biomedicalProduct_10", Description = "biomedicalProduct_10", ImagePath = "P1.png", Price = 500, ProductCode = "Pro_10", AssociatedFeatures = new List <Feature> { biomedicalFeature_08, biomedicalFeature_02 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; biomedicalProduct_10.Categories = new List <ProductCategory>(); biomedicalProduct_10.Categories.Add(category2); context.Product.Add(biomedicalProduct_10); var biomedicalProduct_11 = new LicenseServer.Core.Model.Product() { Name = "biomedicalProduct_11", Description = "biomedicalProduct_11", ImagePath = "P1.png", Price = 550, ProductCode = "Pro_11", AssociatedFeatures = new List <Feature> { biomedicalFeature_08, biomedicalFeature_02, biomedicalFeature_01 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; biomedicalProduct_11.Categories = new List <ProductCategory>(); biomedicalProduct_11.Categories.Add(category2); context.Product.Add(biomedicalProduct_11); var biomedicalProduct_12 = new LicenseServer.Core.Model.Product() { Name = "biomedicalProduct_12", Description = "biomedicalProduct_12", ImagePath = "P1.png", Price = 600, ProductCode = "Pro_12", AssociatedFeatures = new List <Feature> { biomedicalFeature_08, biomedicalFeature_04 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; biomedicalProduct_12.Categories = new List <ProductCategory>(); biomedicalProduct_12.Categories.Add(category2); context.Product.Add(biomedicalProduct_12); var biomedicalProduct_13 = new LicenseServer.Core.Model.Product() { Name = "biomedicalProduct_13", Description = "biomedicalProduct_13", ImagePath = "P1.png", Price = 650, ProductCode = "Pro_13", AssociatedFeatures = new List <Feature> { biomedicalFeature_08, biomedicalFeature_04, biomedicalFeature_01 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; biomedicalProduct_13.Categories = new List <ProductCategory>(); biomedicalProduct_13.Categories.Add(category2); context.Product.Add(biomedicalProduct_13); var biomedicalProduct_14 = new LicenseServer.Core.Model.Product() { Name = "biomedicalProduct_14", Description = "biomedicalProduct_14", ImagePath = "P1.png", Price = 700, ProductCode = "Pro_14", AssociatedFeatures = new List <Feature> { biomedicalFeature_08, biomedicalFeature_04, biomedicalFeature_02 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; biomedicalProduct_14.Categories = new List <ProductCategory>(); biomedicalProduct_14.Categories.Add(category2); context.Product.Add(biomedicalProduct_14); var biomedicalProduct_15 = new LicenseServer.Core.Model.Product() { Name = "biomedicalProduct_15", Description = "biomedicalProduct_15", ImagePath = "P1.png", Price = 750, ProductCode = "Pro_15", AssociatedFeatures = new List <Feature> { biomedicalFeature_08, biomedicalFeature_04, biomedicalFeature_02, biomedicalFeature_01 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; biomedicalProduct_15.Categories = new List <ProductCategory>(); biomedicalProduct_15.Categories.Add(category2); context.Product.Add(biomedicalProduct_15); #endregion Biomedical Product #region Calibration Product var calibrationProduct_01 = new LicenseServer.Core.Model.Product() { Name = "calibrationProduct_01", Description = "calibrationProduct_01", ImagePath = "P1.png", Price = 50, ProductCode = "Pro_16", AssociatedFeatures = new List <Feature> { calibrationFeature_01 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; calibrationProduct_01.Categories = new List <ProductCategory>(); calibrationProduct_01.Categories.Add(category1); context.Product.Add(calibrationProduct_01); var calibrationProduct_02 = new LicenseServer.Core.Model.Product() { Name = "calibrationProduct_02", Description = "calibrationProduct_02", ImagePath = "P1.png", Price = 100, ProductCode = "Pro_17", AssociatedFeatures = new List <Feature> { calibrationFeature_02 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; calibrationProduct_02.Categories = new List <ProductCategory>(); calibrationProduct_02.Categories.Add(category1); context.Product.Add(calibrationProduct_02); var calibrationProduct_03 = new LicenseServer.Core.Model.Product() { Name = "calibrationProduct_03", Description = "calibrationProduct_03", ImagePath = "P1.png", Price = 150, ProductCode = "Pro_18", AssociatedFeatures = new List <Feature> { calibrationFeature_02, calibrationFeature_01 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; calibrationProduct_03.Categories = new List <ProductCategory>(); calibrationProduct_03.Categories.Add(category1); context.Product.Add(calibrationProduct_03); var calibrationProduct_04 = new LicenseServer.Core.Model.Product() { Name = "calibrationProduct_04", Description = "calibrationProduct_04", ImagePath = "P1.png", Price = 200, ProductCode = "Pro_19", AssociatedFeatures = new List <Feature> { calibrationFeature_04 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; calibrationProduct_04.Categories = new List <ProductCategory>(); calibrationProduct_04.Categories.Add(category1); context.Product.Add(calibrationProduct_04); var calibrationProduct_05 = new LicenseServer.Core.Model.Product() { Name = "calibrationProduct_05", Description = "calibrationProduct_05", ImagePath = "P1.png", Price = 250, ProductCode = "Pro_20", AssociatedFeatures = new List <Feature> { calibrationFeature_04, calibrationFeature_01 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; calibrationProduct_05.Categories = new List <ProductCategory>(); calibrationProduct_05.Categories.Add(category1); context.Product.Add(calibrationProduct_05); var calibrationProduct_06 = new LicenseServer.Core.Model.Product() { Name = "calibrationProduct_06", Description = "calibrationProduct_06", ImagePath = "P1.png", Price = 300, ProductCode = "Pro_21", AssociatedFeatures = new List <Feature> { calibrationFeature_04, calibrationFeature_02 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; calibrationProduct_06.Categories = new List <ProductCategory>(); calibrationProduct_06.Categories.Add(category1); context.Product.Add(calibrationProduct_06); var calibrationProduct_07 = new LicenseServer.Core.Model.Product() { Name = "calibrationProduct_07", Description = "calibrationProduct_07", ImagePath = "P1.png", Price = 350, ProductCode = "Pro_22", AssociatedFeatures = new List <Feature> { calibrationFeature_04, calibrationFeature_02, calibrationFeature_01 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; calibrationProduct_07.Categories = new List <ProductCategory>(); calibrationProduct_07.Categories.Add(category1); context.Product.Add(calibrationProduct_07); var calibrationProduct_08 = new LicenseServer.Core.Model.Product() { Name = "calibrationProduct_08", Description = "calibrationProduct_08", ImagePath = "P1.png", Price = 400, ProductCode = "Pro_23", AssociatedFeatures = new List <Feature> { calibrationFeature_08 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; calibrationProduct_08.Categories = new List <ProductCategory>(); calibrationProduct_08.Categories.Add(category1); context.Product.Add(calibrationProduct_08); var calibrationProduct_09 = new LicenseServer.Core.Model.Product() { Name = "calibrationProduct_09", Description = "calibrationProduct_09", ImagePath = "P1.png", Price = 450, ProductCode = "Pro_24", AssociatedFeatures = new List <Feature> { calibrationFeature_08, calibrationFeature_01 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; calibrationProduct_09.Categories = new List <ProductCategory>(); calibrationProduct_09.Categories.Add(category1); context.Product.Add(calibrationProduct_09); var calibrationProduct_10 = new LicenseServer.Core.Model.Product() { Name = "calibrationProduct_10", Description = "calibrationProduct_10", ImagePath = "P1.png", Price = 500, ProductCode = "Pro_25", AssociatedFeatures = new List <Feature> { calibrationFeature_08, calibrationFeature_02 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; calibrationProduct_10.Categories = new List <ProductCategory>(); calibrationProduct_10.Categories.Add(category1); context.Product.Add(calibrationProduct_10); var calibrationProduct_11 = new LicenseServer.Core.Model.Product() { Name = "calibrationProduct_11", Description = "calibrationProduct_11", ImagePath = "P1.png", Price = 550, ProductCode = "Pro_26", AssociatedFeatures = new List <Feature> { calibrationFeature_08, calibrationFeature_02, calibrationFeature_01 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; calibrationProduct_11.Categories = new List <ProductCategory>(); calibrationProduct_11.Categories.Add(category1); context.Product.Add(calibrationProduct_11); var calibrationProduct_12 = new LicenseServer.Core.Model.Product() { Name = "calibrationProduct_12", Description = "calibrationProduct_12", ImagePath = "P1.png", Price = 600, ProductCode = "Pro_27", AssociatedFeatures = new List <Feature> { calibrationFeature_08, calibrationFeature_04 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; calibrationProduct_12.Categories = new List <ProductCategory>(); calibrationProduct_12.Categories.Add(category1); context.Product.Add(calibrationProduct_12); var calibrationProduct_13 = new LicenseServer.Core.Model.Product() { Name = "calibrationProduct_13", Description = "calibrationProduct_13", ImagePath = "P1.png", Price = 650, ProductCode = "Pro_28", AssociatedFeatures = new List <Feature> { calibrationFeature_08, calibrationFeature_04, calibrationFeature_01 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; calibrationProduct_13.Categories = new List <ProductCategory>(); calibrationProduct_13.Categories.Add(category1); context.Product.Add(calibrationProduct_13); var calibrationProduct_14 = new LicenseServer.Core.Model.Product() { Name = "calibrationProduct_14", Description = "calibrationProduct_14", ImagePath = "P1.png", Price = 700, ProductCode = "Pro_29", AssociatedFeatures = new List <Feature> { calibrationFeature_08, calibrationFeature_04, calibrationFeature_02 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; calibrationProduct_14.Categories = new List <ProductCategory>(); calibrationProduct_14.Categories.Add(category1); context.Product.Add(calibrationProduct_14); var calibrationProduct_15 = new LicenseServer.Core.Model.Product() { Name = "calibrationProduct_15", Description = "calibrationProduct_15", ImagePath = "P1.png", Price = 750, ProductCode = "Pro_30", AssociatedFeatures = new List <Feature> { calibrationFeature_08, calibrationFeature_04, calibrationFeature_02, calibrationFeature_01 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; calibrationProduct_15.Categories = new List <ProductCategory>(); calibrationProduct_15.Categories.Add(category1); context.Product.Add(calibrationProduct_15); #endregion Calibration Product #region CMMS Solution Product var CMMSSolutionAPIPlugIn = new LicenseServer.Core.Model.Product() { Name = "CMMSSolutionAPI PlugIn", Description = "CMMSSolution API PlugIn product", ImagePath = "P1.png", Price = 50, ProductCode = "Pro_31", AssociatedFeatures = new List <Feature> { CMMSSolutionFeature_01 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; context.Product.Add(CMMSSolutionAPIPlugIn); var CMMSSolutionMETorTEAM = new LicenseServer.Core.Model.Product() { Name = "CMMSSolution MET/TEAM", Description = "CMMSSolution MET/TEAM product", ImagePath = "P1.png", Price = 100, ProductCode = "Pro_32", AssociatedFeatures = new List <Feature> { CMMSSolutionFeature_02 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; context.Product.Add(CMMSSolutionMETorTEAM); var CMMSSolutionEMaintLink = new LicenseServer.Core.Model.Product() { Name = "CMMSSolutionEMaintLink", Description = "CMMSSolution EMaint Link Product", ImagePath = "P1.png", Price = 150, ProductCode = "Pro_33", AssociatedFeatures = new List <Feature> { CMMSSolutionFeature_02, CMMSSolutionFeature_01 }, ModifiedDate = DateTime.Now, CreatedDate = DateTime.Now }; context.Product.Add(CMMSSolutionEMaintLink); #endregion CMMS Solution Product context.SaveChanges(); } }
public async Task <CommonResponce> SaveAppUserAsync(AppUserVM oModel, string ResetContext, DateTime PasswordValidity) { CommonResponce result = new CommonResponce { Stat = false, StatusMsg = "" }; Appuser oUser = null; int RowEffect = 0; if (oModel.Id == 0) // for new user { oUser = await _DBUserRepository.GetUserByUserID(oModel.UserId).ConfigureAwait(false); if (oUser != null) { result.StatusMsg = "User ID is already in use."; } else { oUser = new Appuser { Id = oModel.Id, Name = oModel.Name, UserId = oModel.UserId, UserType = oModel.UserType, Gender = oModel.Gender, IsActive = (ulong)(oModel.IsActive ? 1 : 0), Mobile = oModel.Mobile, Dob = oModel.Dob, UserPerm = oModel.UserPerm, Email = oModel.Email, IsPassReset = 1, ResetPassContext = ResetContext, ResetPassValidity = PasswordValidity, Password = "******" }; RowEffect = await _DBUserRepository.Insert(oUser).ConfigureAwait(false); if (RowEffect > 0) { result.Stat = true; result.StatusMsg = "Successfully Save User."; result.StatusObj = oUser.Id; } else { result.StatusMsg = "Error on saving user."; } } } // for existing user else { bool IsSameUserIDFound = await _DBUserRepository.FindOtherSameUserID(oModel.Id, oModel.UserId).ConfigureAwait(false); if (IsSameUserIDFound) { result.StatusMsg = "User ID is already in use."; } else { oUser = await _DBUserRepository.GetUserByID(oModel.Id).ConfigureAwait(false); if (oUser != null) { oUser.Name = oModel.Name; oUser.UserId = oModel.UserId; oUser.UserType = oModel.UserType; oUser.Gender = oModel.Gender; oUser.IsActive = (ulong)(oModel.IsActive ? 1 : 0); oUser.Mobile = oModel.Mobile; oUser.Dob = oModel.Dob; oUser.UserPerm = oModel.UserPerm; oUser.Email = oModel.Email; await _DBUserRepository.Update(oUser).ConfigureAwait(false); result.Stat = true; result.StatusMsg = "Successfully Save User"; } else { result.StatusMsg = "Error on saving user or user not valid"; } } } return(result); }