예제 #1
0
        public ActionResult updateDetails()
        {
            string         id             = Session["EmailID"].ToString();
            InventoryLogin inventoryLogin = db.InventoryLogins.Find(id);

            return(PartialView(inventoryLogin));
        }
예제 #2
0
        public ActionResult DeleteConfirmed(string id)
        {
            InventoryLogin inventoryLogin = db.InventoryLogins.Find(id);

            db.InventoryLogins.Remove(inventoryLogin);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #3
0
 public ActionResult Edit([Bind(Include = "EmailID,Username,Role,FirstName,LastName,PhoneNo,Department")] InventoryLogin inventoryLogin)
 {
     if (ModelState.IsValid)
     {
         db.Entry(inventoryLogin).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("List", "UserAccount"));
     }
     return(RedirectToAction("List", "UserAccount"));
 }
예제 #4
0
 public ActionResult updateDetails([Bind(Include = "EmailID,Username,FirstName,LastName,PhoneNo,Department")] InventoryLogin inventoryLogin)
 {
     if (ModelState.IsValid)
     {
         db.Entry(inventoryLogin).State = EntityState.Modified;
         db.Entry(inventoryLogin).Property(x => x.Password).IsModified = false;
         db.Entry(inventoryLogin).Property(x => x.Role).IsModified     = false;
         TempData["Success"] = "Details updated successfully";
         db.SaveChanges();
         return(RedirectToAction("Settings", "UserAccount"));
     }
     return(RedirectToAction("Settings", "UserAccount"));
 }
예제 #5
0
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            InventoryLogin inventoryLogin = db.InventoryLogins.Find(id);

            if (inventoryLogin == null)
            {
                return(HttpNotFound());
            }
            return(View(inventoryLogin));
        }
예제 #6
0
        public ActionResult Create([Bind(Include = "EmailID,Username,Role,FirstName,LastName,PhoneNo,Department")] InventoryLogin inventoryLogin)
        {
            if (ModelState.IsValid)
            {
                if (!db.InventoryLogins.Any(x => x.EmailID.Equals(inventoryLogin.EmailID)))
                {
                    db.InventoryLogins.Add(inventoryLogin);
                    db.SaveChanges();
                    return(RedirectToAction("List"));
                }

                TempData["Error"] = "Email ID is already registered";
                return(RedirectToAction("Create"));
            }

            return(View(inventoryLogin));
        }
예제 #7
0
        private (bool, AdminDTO) ValidateLoginUser()
        {
            var adminDto = InventoryLogin.IsValidLogin(loginUserName.Text, loginPassword.Text);

            if (adminDto != null)
            {
                if (!adminDto.IsActive)
                {
                    MessageBox.Show("Inactive user");
                }
                else
                {
                    return(true, adminDto);
                }
            }
            else
            {
                MessageBox.Show("Incorrect userName or password");
            }
            return(false, null);
        }
예제 #8
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtCuPsw.Text) || string.IsNullOrEmpty(txtNwPsw.Text) ||
         string.IsNullOrEmpty(txtNwPsw2.Text))
     {
         MessageBox.Show("Values cannot be null");
     }
     else if (txtNwPsw.Text != txtNwPsw2.Text)
     {
         errorProvider.SetError(txtNwPsw2, "Passwords not match");
     }
     else
     {
         int status = InventoryLogin.UpdatePassword(adminId, txtNwPsw.Text);
         if (status > 0)
         {
             MessageBox.Show("Successfully update");
             txtCuPsw.Text  = "";
             txtNwPsw.Text  = "";
             txtNwPsw2.Text = "";
         }
     }
 }
예제 #9
0
        public ActionResult User(string id)
        {
            InventoryLogin inventoryLogin = db.InventoryLogins.Find(id);

            return(View(inventoryLogin));
        }