public void SetUsers(USERS UsersUp)
        {
            MaderaEntities MaderaEntities = new MaderaEntities();

            MaderaEntities.USERS.Add(UsersUp);
            MaderaEntities.SaveChanges();
        }
Example #2
0
 /// <summary>
 /// Inserts the user.
 /// </summary>
 /// <param name="user">The user.</param>
 /// <returns></returns>
 public int insertUser(USERS user)
 {
     //mã hóa pass
     EncryptPassword encryptPass = new EncryptPassword();
     string newPass = encryptPass.encrypt(user.password);
     //insert
     return dal.insertUser(user.email, 
         user.firstName, 
         user.lastName, 
         newPass, 
         user.type, 
         user.status);
 }
Example #3
0
        // GET: USERS/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            USERS uSERS = db.USERS.Find(id);

            if (uSERS == null)
            {
                return(HttpNotFound());
            }
            return(View(uSERS));
        }
Example #4
0
 public ActionResult UserEdit(string id, USERS _users)
 {
     if (!GLOBALS.CookieAuth())
     {
         return(RedirectToAction("Index", "Home"));
     }
     using (db)
     {
         db.Execute("update USERS set USERNAME='******',PASSWORD='******',CODE='" + _users.CODE + "'" +
                    ",TEL='" + _users.TEL + "',TEL2='" + _users.TEL2 + "',EMAIL='" + _users.EMAIL + "'" +
                    " where LOGICALREF=" + id + "");
     }
     return(RedirectToAction("UserList"));
 }
Example #5
0
        private void LoadForm(USERS user)
        {
            ResetForm();
            pnlSearch.Visible   = pnlResult.Visible = false;
            pnlUserInfo.Visible = true;

            hideUserId.Value        = user.USER_ID.ToString();
            txtUsername.Text        = user.USERNAME;
            txtFirstName.Text       = user.FIRST_NAME;
            txtMiddleName.Text      = user.MIDDLE_NAME;
            txtLastName.Text        = user.LAST_NAME;
            txtFullName.Text        = user.FULL_NAME;
            txtMaidenName.Text      = user.MAIDEN_NAME;
            txtEmployeeNumber.Text  = user.EMPLOYEE_NUMBER;
            txtJobTitle.Text        = user.JOB_TITLE;
            txtEmailAddress.Text    = user.EMAIL_ADDRESS;
            txtTelephoneNumber.Text = user.TELEPHONE_NUMBER;
            txtFaxNumber.Text       = user.FAX_NUMBER;

            if (user.RECEIVE_EMAIL != null)
            {
                chkEmailAlerts.Checked = user.RECEIVE_EMAIL.Value;
            }

            if (rblSystemRoles.Items.Count <= 0)
            {
                rblSystemRoles.DataBind();
            }
            if (rblSystemRoles.Items.Count > 0)
            {
                rblSystemRoles.SelectedIndex = 0;

                List <USER_ROLES> userRoles = ServiceInterfaceManager.USER_ROLES_GET_ALL_BY_USER(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, user.USER_ID);
                if (userRoles != null)
                {
                    foreach (USER_ROLES userRole in userRoles)
                    {
                        foreach (ListItem li in rblSystemRoles.Items)
                        {
                            if (userRole.STD_ROLE_ID.ToString() == li.Value && !userRole.INACTIVE_FLAG)
                            {
                                li.Selected = true;
                            }
                        }
                    }
                }

                UserRoles = userRoles;
            }
        }
Example #6
0
        public IHttpActionResult Delete(int id)
        {
            USERS item = db.USERS.Find(id);

            if (item == null)
            {
                return(NotFound());
            }

            db.USERS.Remove(item);
            db.SaveChanges();

            return(Ok());
        }
Example #7
0
 public ActionResult DeleteConfirmed(int id)
 {
     try
     {
         USERS uSERS = db.USERS.Find(id);
         db.USERS.Remove(uSERS);
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         return(View("Error", new HandleErrorInfo(ex, "Forbidden_Action", "Delete")));
     }
     return(RedirectToAction("Index"));
 }
Example #8
0
        public ActionResult UpdateUser(USERS p)
        {
            var ad = db.USERS.Find(p.User_ID);

            ad.User_ID       = p.User_ID;
            ad.User_Name     = p.User_Name;
            ad.User_Lastname = p.User_Lastname;
            ad.User_Nickname = p.User_Nickname;
            ad.User_Mail     = p.User_Mail;
            ad.User_Password = p.User_Password;
            ad.User_Phone    = p.User_Phone;

            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #9
0
        /// <summary>
        /// Gets the number of appointments for the specified employee in the specified year and month
        /// </summary>
        /// <param name="employee"></param>
        /// <param name="monthNr"></param>
        /// <param name="year"></param>
        /// <returns></returns>
        public int GetEmployeeNumberOfAppointments(USERS employee, int monthNr, int year)
        {
            var allAppointments = GetAppointments();
            List <APTDETAILS> appointmentsByEmployee = new List <APTDETAILS>();

            foreach (var a in allAppointments)
            {
                if (a.APD_USER == employee.US_STAMP && a.APD_DATE.Value.Month == monthNr && a.APD_DATE.Value.Year == year)
                {
                    appointmentsByEmployee.Add(a);
                }
            }

            return(appointmentsByEmployee.Count);
        }
Example #10
0
        public object check(USERS user)
        {
            var Data = db.USERS.Where(u => u.UserId == user.UserId).Select(s => s).FirstOrDefault();

            if (Data != null)
            {
                ls.que = Data.Question;
                ls.ans = Data.Answer;
                return(ls);
            }
            else
            {
                return("4000");
            }
        }
Example #11
0
        public ActionResult UserDelete(string id)
        {
            if (!GLOBALS.CookieAuth())
            {
                return(RedirectToAction("Index", "Home"));
            }
            USERS _users = new USERS();

            using (db)
            {
                _users = db.Query <USERS>("select * from USERS where LOGICALREF=" + id).SingleOrDefault();
            }

            return(View(_users));
        }
Example #12
0
        /// <summary>
        /// Gets the number of appointments for the specified employee
        /// </summary>
        /// <param name="employee"></param>
        /// <returns></returns>
        public int GetEmployeeNumberOfAppointments(USERS employee)
        {
            var allAppointments = GetAppointments();
            List <APTDETAILS> appointmentsByEmployee = new List <APTDETAILS>();

            foreach (var a in allAppointments)
            {
                if (a.APD_USER == employee.US_STAMP)
                {
                    appointmentsByEmployee.Add(a);
                }
            }

            return(appointmentsByEmployee.Count);
        }
Example #13
0
        public ActionResult Giris(USERS usr)
        {
            OyuncakciEntities db = new OyuncakciEntities();

            var model = db.USERS.Where(x => x.E_MAİL.Equals(usr.E_MAİL) && x.SIFRE.Equals(usr.SIFRE)).FirstOrDefault();

            if (model != null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                return(RedirectToAction("Index", "Login"));
            }
        }
Example #14
0
        static void ChangePasswordForUserForm()
        {
            string username = string.Empty;

            Console.Write("username:"******"no user found: {username}");
                return;
            }
            ChangePasswordForm(user);
        }
Example #15
0
        List <USERS> GetDataUsers(SqlCommand cmd)
        {
            cmd.Connection.Open();

            SqlDataReader reader = cmd.ExecuteReader();
            List <USERS>  list   = new List <USERS>();

            using (reader)
            {
                while (reader.Read())
                {
                    USERS obj = new USERS();
                    obj.ID        = reader.GetInt32(0);
                    Receiver_id   = obj.ID;
                    obj.NAME      = reader.GetString(1);
                    Receiver_name = obj.NAME;
                    receiverImage = (byte[])(reader[2]);
                    MemoryStream memoryStream = new MemoryStream(obj.IMAGE);
                    obj.IMAGE              = receiverImage;
                    obj.DOB                = reader.GetDateTime(3);
                    Receiver_dob           = obj.DOB;
                    obj.GENDER             = reader.GetString(4);
                    Receiver_gender        = obj.GENDER;
                    obj.BLOOD_GROUP        = reader.GetString(5);
                    Receiver_bloodGroup    = obj.BLOOD_GROUP;
                    obj.ADDRESS            = reader.GetString(6);
                    Receiver_address       = obj.ADDRESS;
                    obj.CELLPHONE          = reader.GetString(7);
                    Receiver_cellphone     = obj.CELLPHONE;
                    obj.EMAIL              = reader.GetString(8);
                    Receiver_email         = obj.EMAIL;
                    obj.HEIGHT             = reader.GetDouble(9);
                    Donor_height           = obj.HEIGHT;
                    obj.WEIGHT             = reader.GetDouble(10);
                    Donor_weight           = obj.WEIGHT;
                    obj.DRUG_ADDICTION     = reader.GetString(11);
                    Donor_drugAddiction    = obj.DRUG_ADDICTION;
                    obj.HIV_STATUS         = reader.GetString(12);
                    Donor_HIV              = obj.HIV_STATUS;
                    obj.LAST_DONATION_DATE = reader.GetDateTime(13);
                    Donor_lastDonationDate = obj.LAST_DONATION_DATE;
                    list.Add(obj);
                }
                reader.Close();
            }
            cmd.Connection.Close();
            return(list);
        }
Example #16
0
        public static LoginResponse Authenticate(Login login)
        {
            // Ensure that we have what we need
            if (login == null || string.IsNullOrEmpty(login.Email) || string.IsNullOrEmpty(login.Password))
            {
                return(null);
            }

            USERS loginUser = null;

            // Read directly from the database; UserManager does not read password and salt, in order to keep them more private
            using (var db = new CSET_Context())
            {
                loginUser = db.USERS.Where(x => x.PrimaryEmail == login.Email).FirstOrDefault();

                if (loginUser == null)
                {
                    return(null);
                }
            }

            // Validate the supplied password against the hashed password and its salt
            bool success = PasswordHash.ValidatePassword(login.Password, loginUser.Password, loginUser.Salt);

            if (!success)
            {
                return(null);
            }

            // Generate a token for this user
            string token = TransactionSecurity.GenerateToken(loginUser.UserId, login.TzOffset, -1, null, null, login.Scope);

            // Build response object
            LoginResponse resp = new LoginResponse
            {
                Token            = token,
                UserId           = loginUser.UserId,
                Email            = login.Email,
                UserFirstName    = loginUser.FirstName,
                UserLastName     = loginUser.LastName,
                IsSuperUser      = loginUser.IsSuperUser,
                ResetRequired    = loginUser.PasswordResetRequired ?? true,
                ExportExtension  = IOHelper.GetExportFileExtension(login.Scope),
                ImportExtensions = IOHelper.GetImportFileExtensions(login.Scope)
            };

            return(resp);
        }
Example #17
0
        public ActionResult AdminLogin(USERS model)
        {
            USERS user = new USERS();

            user = dbContext.USERS.Where(i => i.USERNAME == model.USERNAME & i.PASSWORD == model.PASSWORD).FirstOrDefault();
            if (user == null)
            {
                return(View());
            }
            else
            {
                Session["username"] = model.USERNAME;
                Session["id"]       = model.ID;
                return(RedirectToAction("ListProduct"));
            }
        }
Example #18
0
        public ActionResult UserDetails(USERS user)
        {
            if (user.Username == null)
            {
                ModelState.AddModelError(string.Empty, "Invalid USER Name");
            }

            if (ModelState.IsValid)
            {
                database.Entry(user).Entity.Inactive     = user.Inactive;
                database.Entry(user).Entity.LastModified = System.DateTime.Now;
                database.Entry(user).State = EntityState.Modified;
                database.SaveChanges();
            }
            return(View(user));
        }
Example #19
0
        public static USERS getUser(int idUser)
        {
            USERS user = null;

            try
            {
                using (goliazco_FWEntities entity = new goliazco_FWEntities())
                {
                    user = (from t in entity.USERS where t.idUser == idUser select t).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
            }
            return(user);
        }
Example #20
0
        // GET: USERS/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            USERS uSERS = db.USERS.Find(id);

            if (uSERS == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PROJECT_ID = new SelectList(db.PROJECT, "PROJECT_ID", "PROJECT_ID", uSERS.PROJECT_ID);
            ViewBag.ROLE_TYPE  = new SelectList(db.ROLES, "ROLE_TYPE", "ROLE_TYPE", uSERS.ROLE_TYPE);
            return(View(uSERS));
        }
        public async Task <ActionResult> Signup(FormCollection signupAccount)
        {
            string c = signupAccount["Username"];
            var    v = _meditech.USERS.Where(a => a.USERNAME.Equals(c)).FirstOrDefault();

            if (v == null)
            {
                USERS ac = new USERS();
                ac.USERNAME = signupAccount["Username"];
                ac.PASSWORD = c = GetMD5HashData(signupAccount["Password"]);
                _meditech.USERS.Add(ac);
                _meditech.SaveChanges();
                return(RedirectToAction("Login", "Account"));
            }
            return(View("Signup"));
        }
Example #22
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            //adding line of commented text for RTC Task 350744
            UserSession.Refresh();

            if (!Page.IsPostBack)
            {
                ServiceInterfaceManager.LogInformation("PAGE_LOAD", String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId);
            }

            try
            {
                base.Page_Load(sender, e);
                //BuildMenu();

                if (!Page.IsPostBack)
                {
                    USERS user = ServiceInterfaceManager.USERS_GET_BY_NAME(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, HttpContext.Current.User.Identity.Name);
                    if (user != null)
                    {
                        UserSession.DefautRegistryId = user.DEFAULT_REGISTRY_ID;
                    }
                    if (UserSession.DefautRegistryId > 0)
                    {
                        // UserSession.DefautRegistryId = user.DEFAULT_REGISTRY_ID;
                        Response.Redirect("~/Common/Default.aspx?id=" + UserSession.DefautRegistryId, false);
                    }
                    else
                    {
                        SETTINGS setting = ServiceInterfaceManager.GET_HOME_PAGE_SETTING();
                        if (setting != null && !string.IsNullOrEmpty(setting.VALUE))
                        {
                            lblDescription.Text = setting.VALUE;
                        }
                        else
                        {
                            lblDescription.Text = "Welcome to the Converged Registries Solution home page.";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ServiceInterfaceManager.LogError(ex.Message, String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId);
                throw ex;
            }
        }
Example #23
0
        /// <summary>
        /// Method that allow send a message to confirm email
        /// </summary>
        /// <returns>true or false if was sent</returns>
        public bool SendConfirmEmailMessage(USERS userNew, out string mensajeError)
        {
            //Mensaje de correo
            bool sentMessage = false;

            mensajeError = "";
            try
            {
                MailMessage mensaje = new MailMessage();
                mensaje.From = new MailAddress(infoEmail);
                MailAddress para = new MailAddress(userNew.email);

                mensaje.To.Add(para);
                mensaje.Subject = "Goliaz Challenge, Please Confirm your Email.";
                string codigo = GetRandomHexNumber(10);

                userNew = UserDao.updateUser(userNew, codigo);
                if (!string.IsNullOrEmpty(userNew.codeConfirm))
                {
                    mensaje.IsBodyHtml = true;

                    string urlConfirm = "http://goliaz.com/confirmEmail.aspx?code=" + HttpUtility.UrlEncode(codigo) + "&em=" + userNew.email;


                    //mensaje.Body = "<html><head><title>Please Confirm Email</title></head><body style='font-size: 15px !important;font-family: Arial,sans-serif;'>Dear " + userNew.name + ", <br/><br/> Congratulations and welcome to Goliaz Challenge. Please click <a href='http://goliaz.com/confirmEmail.aspx?code=" + codigo + "&em=" + userNew.email + "' >here</a> to confirm your email address to finish the register process.<br/><br/>Regards,<br/>Goliaz Challenge Team. <br/><br/><img alt='goliaz.com' src='http://goliaz.com/images/image.jpg' /></body></html>";
                    mensaje.Body = "<html><head><title>Please Confirm Email</title></head><body style='font-size: 15px !important;font-family: Arial,sans-serif;'>Dear " + userNew.name + ", <br/><br/> Congratulations and welcome to the Goliaz Challenge!<br/><br/>Please click <a href='" + urlConfirm + "' >here</a> to confirm your email address and to finish the registration process.<br/><br/>Regards,<br/>Goliaz Challenge Team. <br/><br/><img alt='goliaz.com' src='http://goliaz.com/images/logomask2.png'  style='width:200px;' /></body></html>";
                    //mensaje.Body = "<html><head><title>Please Confirm Email</title></head><body>Dear " + userNew.name + ", <br/> Please go to http://goliaz.com/confirmEmail.aspx?code=" + codigo + "&em=" + userNew.email + " to confirm your email.<br/><br/>Regards,<br/>Goliaz Challenge Team.</body></html>";

                    //Configuracion cliente SMTP
                    SmtpClient cliente = new SmtpClient(serverAddress, portSendmail);
                    //cliente.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
                    cliente.UseDefaultCredentials = false;
                    cliente.Credentials           = new System.Net.NetworkCredential(infoEmail, passEmail);
                    //Send message
                    cliente.Send(mensaje);

                    sentMessage = true;
                }
            }
            catch (SmtpException ex)
            {
                //throw new Exception(ex.Message);

                mensajeError = ex.InnerException.Message;
            }
            return(sentMessage);
        }
Example #24
0
        private void log_in_button_login_page_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(input_username_userlist_page.Text) &&
                !string.IsNullOrWhiteSpace(input_password_userlist_page.Text) &&
                !string.IsNullOrWhiteSpace(input_confirm_password_userlist_page.Text))
            {
                USERS user = null;
                using (testWinFormDBEntities dbcontext = new testWinFormDBEntities())
                {
                    user = dbcontext.USERS.Where(s => s.USERNAME == input_username_userlist_page.Text).FirstOrDefault <USERS>();

                    if (user != null)
                    {
                        if (input_password_userlist_page.Text == input_confirm_password_userlist_page.Text)
                        {
                            user.PASSWORD = input_password_userlist_page.Text;

                            try
                            {
                                dbcontext.Entry(user).State = System.Data.Entity.EntityState.Modified;
                                dbcontext.SaveChanges();
                                MessageBox.Show("Şifrəniz uğurla yeniləndi !");
                                input_username_userlist_page.Text         = "";
                                input_password_userlist_page.Text         = "";
                                input_confirm_password_userlist_page.Text = "";
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("Şifrə yenilənərkən xəta baş verdi ! " + ex.Message);
                            }
                        }
                        else if (input_password_userlist_page.Text != input_confirm_password_userlist_page.Text)
                        {
                            MessageBox.Show("Daxil etdiyiniz şifrələr bir biri ilə uyğun gəlmir. \nZəhmət olmasa şifrələri yoxlayın və yenidən cəhd edin");
                        }
                    }
                    else if (user == null)
                    {
                        MessageBox.Show("Daxil etdiyiniz adda istifadəçi yoxdur !");
                    }
                }
            }
            else
            {
                MessageBox.Show("Xanalar boşdur. Xanaları doldurub yenidən cəhd edin !");
            }
        }
Example #25
0
        /// <summary>
        /// Creates a new USER record.  Generates a temporary password and
        /// returns it as part of the response.
        /// If a User already exists for the specified email, an exception is throw
        /// please check for existence before calling this if you do not intent
        /// to create a user.
        /// </summary>
        /// <returns></returns>
        public UserCreateResponse CreateUser(UserDetail userDetail)
        {
            // see if this user already exists
            UserDetail existingUser = this.GetUserDetail(userDetail.Email);

            if (existingUser != null)
            {
                // USER ALREADY EXISTS ... return what we already have
                // NO we better return an error so that someone cannot just overwrite the account
                // prompt them to recover the password if the account already exists
                throw new ApplicationException("This user already exists. To recover a password user the forgot password link on the login page.");
            }


            // generate and hash a temporary password
            string temporaryPassword = System.Web.Security.Membership.GeneratePassword(10, 2);
            string hashedPassword;
            string salt;

            PasswordHash.HashPassword(temporaryPassword, out hashedPassword, out salt);


            // create new records for USER and USER_DETAIL_INFORMATION
            using (var db = new CSET_Context())
            {
                var u = new USERS()
                {
                    PrimaryEmail          = userDetail.Email,
                    FirstName             = userDetail.FirstName,
                    LastName              = userDetail.LastName,
                    Password              = hashedPassword,
                    Salt                  = salt,
                    IsSuperUser           = false,
                    PasswordResetRequired = true
                };
                db.USERS.Add(u);
                db.SaveChanges();

                UserCreateResponse resp = new UserCreateResponse
                {
                    UserId            = u.UserId == 0?1:u.UserId,
                    PrimaryEmail      = u.PrimaryEmail,
                    TemporaryPassword = temporaryPassword
                };
                return(resp);
            }
        }
Example #26
0
        public bool insertUsersReceiver(USERS obj)
        {
            int val = 0;

            try
            {
                SqlDbDataAccess da  = new SqlDbDataAccess();
                SqlCommand      cmd = da.GetCommand("INSERT INTO [dbo].[USERS] ([ID],[NAME],[IMAGE], [DOB], [GENDER], [BLOOD_GROUP], [ADDRESS], [CELLPHONE], [EMAIL]) VALUES (@ID, @NAME, @IMAGE, @DOB, @GENDER, @BLOOD_GROUP, @ADDRESS, @CELLPHONE, @EMAIL)");
                SqlParameter    p   = new SqlParameter("@ID", SqlDbType.Int);
                p.Value = obj.ID;
                SqlParameter p1 = new SqlParameter("@NAME", SqlDbType.VarChar, 50);
                p1.Value = obj.NAME;
                SqlParameter p2 = new SqlParameter("@IMAGE", SqlDbType.Image);
                p2.Value = obj.IMAGE;
                SqlParameter p3 = new SqlParameter("@DOB", SqlDbType.Date);
                p3.Value = obj.DOB;
                SqlParameter p4 = new SqlParameter("@GENDER", SqlDbType.VarChar, 6);
                p4.Value = obj.GENDER;
                SqlParameter p5 = new SqlParameter("@BLOOD_GROUP", SqlDbType.VarChar, 3);
                p5.Value = obj.BLOOD_GROUP;
                SqlParameter p6 = new SqlParameter("@ADDRESS", SqlDbType.VarChar, 50);
                p6.Value = obj.ADDRESS;
                SqlParameter p7 = new SqlParameter("@CELLPHONE", SqlDbType.VarChar, 11);
                p7.Value = obj.CELLPHONE;
                SqlParameter p8 = new SqlParameter("@EMAIL", SqlDbType.VarChar, 50);
                p8.Value = obj.EMAIL;

                cmd.Parameters.Add(p);
                cmd.Parameters.Add(p1);
                cmd.Parameters.Add(p2);
                cmd.Parameters.Add(p3);
                cmd.Parameters.Add(p4);
                cmd.Parameters.Add(p5);
                cmd.Parameters.Add(p6);
                cmd.Parameters.Add(p7);
                cmd.Parameters.Add(p8);

                cmd.Connection.Open();
                val = cmd.ExecuteNonQuery();
                cmd.Connection.Close();
            }
            catch (Exception ex)
            {
            }
            return(val > 0);
        }
Example #27
0
        private void setInstance(USERS user)
        {
            if (user == null)
            {
                return;
            }

            this.user = user;

            needApprove = user.NEED_APPROVE;
            parents     = GetParents();
            classes     = GetClasses();
            groups      = GetGroups();
            subjects    = GetSubjects();
            children    = GetChildren();
            students    = GetStudents();
        }
Example #28
0
        public ActionResult YeniUye(USERS usr)
        {
            if (usr.ID == 0)
            {
                using (OyuncakciEntities db = new OyuncakciEntities())
                {
                    db.USERS.Add(usr);
                    db.SaveChanges();
                }

                return(RedirectToAction("Index", "Login"));
            }
            else
            {
                return(RedirectToAction("Index", "Uyelik"));
            }
        }
Example #29
0
 public static USERS validateUser(USERS user)
 {
     try
     {
         using (goliazco_FWEntities entity = new goliazco_FWEntities())
         {
             user        = (from t in entity.USERS where t.idUser == user.idUser select t).FirstOrDefault();
             user.estado = "Confirmed";
             entity.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
     return(user);
 }
Example #30
0
        public static USERS loginUser(string email, string pass)
        {
            USERS getLogedUser = null;

            try
            {
                using (goliazco_FWEntities entity = new goliazco_FWEntities())
                {
                    getLogedUser = (from t in entity.USERS where t.email == email && t.pass == pass select t).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(getLogedUser);
        }
Example #31
0
        public ActionResult login(String nick, String password)
        {
            USERS user = repoLogin.GetUser(nick, password);

            if (user != null)
            {
                FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, user.ID, DateTime.Now, DateTime.Now.AddMinutes(30), true, user.ROLE);
                String     ticketEncrypt         = FormsAuthentication.Encrypt(ticket);
                HttpCookie cookie = new HttpCookie("PICTUREMANAGER", ticketEncrypt);
                Response.Cookies.Add(cookie);
                return(RedirectToAction("menu", "admin"));
            }
            else
            {
                ViewBag.Mensaje = "Usuario/Password incorrectos.";
            }
            return(View());
        }
Example #32
0
        public ActionResult UserEdit(string id, string fromAdd)
        {
            if (!GLOBALS.CookieAuth())
            {
                return(RedirectToAction("Index", "Home"));
            }
            USERS _users = new USERS();

            if (fromAdd == "1")
            {
                TempData["msg"] = "<script>alert('Bu Firmanın Kullanıcısı Mevcut Güncelleme Yapabilirsiniz!!!');</script>";
            }
            using (db)
            {
                _users = db.Query <USERS>("select * from USERS where LOGICALREF=" + id).SingleOrDefault();
            }
            return(View(_users));
        }