Example #1
0
        public async Task <SigninStatus> SigninUserAsync(string userName, string password, string custid)
        {
            usermaster user;

            using (frssdbEntities entities = new frssdbEntities())
            {
                Task <usermaster> objlogin = entities.usermasters.FirstOrDefaultAsync(s => s.username == userName && s.userpwd == password && s.custid == custid);

                user = await objlogin;
                if (user != null)
                {
                    user.lockuser = "******";
                    await entities.SaveChangesAsync();
                }
            }

            if (user == null)
            {
                return(SigninStatus);
            }
            else
            {
                SigninStatus = SigninStatus.Success;
            }
            User         = user;
            User.userpwd = string.Empty;
            return(SigninStatus);
        }
Example #2
0
        public SigninStatus SigninUser(string userName, string password)
        {
            usermaster user;

            using (frssdbEntities entities = new frssdbEntities())
            {
                //password = CryptograpyHelper.ToSha256(password);
                user = entities.usermasters.FirstOrDefault(s => s.username == userName && s.userpwd == password);
                if (user != null)
                {
                    user.lockuser = "******";
                    entities.SaveChanges();
                }
                if (user == null)
                {
                    return(SigninStatus);
                }
                else
                {
                    SigninStatus = SigninStatus.Success;
                }
                User         = user;
                User.userpwd = string.Empty;

                return(SigninStatus);
            }
        }
Example #3
0
        public bool UserEmailExist(string useremail, string custid)
        {
            frssdbEntities entities = new frssdbEntities();
            usermaster     usermstr = entities.usermasters.FirstOrDefault(s => s.useremail == useremail && s.custid == custid);

            if (usermstr == null)
            {
                return(false);
            }
            return(true);
        }
Example #4
0
        public usermaster GetUserbyId(string userid, string custid)
        {
            frssdbEntities entities = new frssdbEntities();
            usermaster     usermstr = entities.usermasters.FirstOrDefault(s => s.userid == userid && s.custid == custid);

            if (usermstr == null)
            {
                return(null);
            }
            return(usermstr);
        }
Example #5
0
        public void Changepassword(string userid, string userpwd, string custid)
        {
            using (frssdbEntities entities = new frssdbEntities())
            {
                usermaster entry = entities.usermasters.FirstOrDefault(p => p.userid == userid && p.custid == custid);

                if (entry != null)
                {
                    entry.userpwd = userpwd;
                    entry.custid  = custid;
                }
                entities.SaveChanges();
            }
        }
Example #6
0
 public SigninManager()
 {
     IsAuthenticated = false;
     SigninStatus    = SigninStatus.Undefine;
     User            = new usermaster();
 }
Example #7
0
        public void AddUpdateUserMaster(bool addmode, string userid, string username, string userpwd, string usermobile, string useremail, string userstatus, string custid, bool?addrights, bool?editrights, bool?deleterights, bool?uploadrights, bool?downloadrights, bool?sendmailrights)
        {
            string result    = string.Empty;
            string ip        = Common.GetUserIp;
            long?  userid1_1 = 0;
            string userid_1  = "";

            if (addmode == true)
            {
                userid1_1 = GetMaxNo(custid);
                userid_1  = custid + "-" + userid1_1.ToString();

                using (frssdbEntities entities = new frssdbEntities())
                {
                    usermaster entry = new usermaster
                    {
                        userid         = userid_1,
                        userid1        = userid1_1,
                        username       = username,
                        userpwd        = userpwd,
                        usermobile     = usermobile,
                        useremail      = useremail,
                        userstatus     = userstatus,
                        syncflg        = '0',
                        addrights      = addrights,
                        editrights     = editrights,
                        deleterights   = deleterights,
                        uploadrights   = uploadrights,
                        downloadrights = downloadrights,
                        sendmailrights = sendmailrights,
                        custid         = custid
                    };
                    entities.usermasters.Add(entry);
                    entities.SaveChanges();
                }
            }
            else
            {
                using (frssdbEntities entities = new frssdbEntities())
                {
                    usermaster entry = entities.usermasters.FirstOrDefault(p => p.userid == userid && p.custid == custid);

                    if (entry != null)
                    {
                        entry.username       = username;
                        entry.userpwd        = userpwd;
                        entry.usermobile     = usermobile;
                        entry.useremail      = useremail;
                        entry.userstatus     = userstatus;
                        entry.syncflg        = '1';
                        entry.addrights      = addrights;
                        entry.editrights     = editrights;
                        entry.deleterights   = deleterights;
                        entry.uploadrights   = uploadrights;
                        entry.downloadrights = downloadrights;
                        entry.sendmailrights = sendmailrights;
                        entry.custid         = custid;
                    }
                    entities.SaveChanges();
                }
            }
        }