Example #1
0
        public static List <Model.mdlUser> GetUser(string lKeyword, string lBranchId)
        {
            var pUser = new List <Model.User>();

            if (lBranchId == "")
            {
                pUser = DataContext.Users.Where(fld => fld.UserID.Contains(lKeyword)).ToList();
            }
            else
            {
                pUser = DataContext.Users.Where(fld => fld.BranchID.Equals(lBranchId)).OrderBy(fld => fld.BranchID).ToList();
            }

            var mdlUserList = new List <Model.mdlUser>();

            foreach (var user in pUser)
            {
                var mdlUser = new Model.mdlUser();
                mdlUser.BranchID = user.BranchID;
                mdlUser.UserId   = user.UserID;
                mdlUser.Password = user.Password;
                mdlUser.RoleID   = user.RoleID;

                mdlUserList.Add(mdlUser);
            }

            return(mdlUserList);
        }
Example #2
0
        public static List <Model.mdlUser> GetSearchUser(string lkeyword, string branchid)
        {
            //var pUser = DataContext.Users.Where(fld => fld.UserID.Contains(lkeyword) && fld.BranchID.Contains(branchid)).OrderBy(fld => fld.UserID).ToList();
            //return pUser;
            var mdlUserList = new List <Model.mdlUser>();

            List <SqlParameter> sp = new List <SqlParameter>()
            {
            };

            DataTable dtUser = Manager.DataFacade.DTSQLCommand(@"SELECT distinct a.* FROM [User] a 
                                                                 inner join (
                                                            select BranchID from Branch where BranchID in (" + branchid + ") ) b on a.BranchID like '%' + b.BranchID+'%' WHERE a.UserID LIKE '%" + lkeyword + "%' order by a.UserID", sp);

            foreach (DataRow drUser in dtUser.Rows)
            {
                var mdlUser = new Model.mdlUser();
                mdlUser.BranchID = drUser["BranchID"].ToString();
                mdlUser.UserId   = drUser["UserID"].ToString();
                mdlUser.RoleID   = drUser["RoleID"].ToString();
                mdlUser.Password = drUser["Password"].ToString();

                mdlUserList.Add(mdlUser);
            }

            return(mdlUserList);
        }
Example #3
0
        public static Model.mdlUser GetUserDetail(string lUserID)
        {
            List <SqlParameter> sp = new List <SqlParameter>()
            {
                new SqlParameter()
                {
                    ParameterName = "@UserId", SqlDbType = SqlDbType.VarChar, Value = lUserID
                }
            };

            var       mdlUser = new Model.mdlUser();
            DataTable dtUser  = Manager.DataFacade.DTSQLCommand(@"SELECT TOP 1 *
                                                                     FROM [dbo].[User] where UserID=@UserId", sp);

            foreach (DataRow drUser in dtUser.Rows)
            {
                mdlUser.UserId     = drUser["UserID"].ToString();
                mdlUser.Password   = drUser["Password"].ToString();
                mdlUser.EmployeeID = drUser["EmployeeID"].ToString();
                mdlUser.RoleID     = drUser["RoleID"].ToString();
            }

            return(mdlUser);
        }