• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# UserModel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中UserModel的典型用法代码示例。如果您正苦于以下问题:C# UserModel类的具体用法?C# UserModel怎么用?C# UserModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UserModel类属于命名空间,在下文中一共展示了UserModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: JobBuilder

 public JobBuilder(OrderModel order, UserModel userModel, IHRIDService hridService, Vendor vendor = null)
 {
     job = new Job(order, hridService.NextId("Job"));
     job.User = userModel;
     job.Vendor = vendor;
     job.ProfitShareResult = vendor?.Strategy?.Calculate(order.OrderCart.TotalToPay.Value);
 }
开发者ID:NerdCats,项目名称:TaskCat,代码行数:7,代码来源:JobBuilder.cs


示例2: ToModel

 // user entity => user model
 public static UserModel ToModel(this User entity)
 {
     var model = new UserModel();
     AutoMapper.Mapper.CreateMap<User, UserModel>();
     AutoMapper.Mapper.Map(entity, model);
     return model;
 }
开发者ID:thuyhk,项目名称:ThuanThienVN,代码行数:8,代码来源:MappingExtensions.cs


示例3: LogIn

            public RedirectToRouteResult LogIn(UserModel log)
            {
                Diagnostics.Debug.WriteLine("LogIn");
                Diagnostics.Debug.WriteLine(log.Nombre);
                Diagnostics.Debug.WriteLine(log.Apellido);
                Diagnostics.Debug.WriteLine(log.User);
                Diagnostics.Debug.WriteLine(log.Password);
                Diagnostics.Debug.WriteLine(log.Correo);
                Diagnostics.Debug.WriteLine(log.Genero);
                Diagnostics.Debug.WriteLine(log.Celular);

                Sesion li = new Sesion();
                if (li.user == null)
                {
                    string usuario = log.User;
                    string clave = log.Password;

                    if (li.IniciarSesion(usuario, clave))
                        return RedirectToAction("Index", "Dashboard");

                    else
                        return RedirectToAction("LogIn", "LogIn");
                }
                else
                {
                    li.user = log.User;
                    li.key = log.Password;

                    return RedirectToAction("LogIn", "LogIn");
                }
            }
开发者ID:wawila,项目名称:Hackpro,代码行数:31,代码来源:LogInController.cs


示例4: Lock

        public ActionResult Lock(UserModel usersModel)
        {
            try
            {
                if (usersModel != null)
                {
                    var user = _userRepository.GetUsersModelByUserNameAndPassword(usersModel.UserName,
                        usersModel.Password);
                    if (user != null)
                    {
                        Session["User"] = user;
                        return RedirectToAction("Index", "Home");
                    }
                    else
                    {

                        return RedirectToAction("Login", "Account");
                    }

                }
            }
            catch (Exception)
            {

                throw;
            }
            return RedirectToAction("Login", "Account");
        }
开发者ID:4hmetuyar,项目名称:Huwax,代码行数:28,代码来源:AccountController.cs


示例5: TestWithValidPost_ShouldCreatePostInDatabase

        public void TestWithValidPost_ShouldCreatePostInDatabase()
        {
            var testPost = new Post()
                {
                    Title = "Test post",
                    Tags = new List<Tag>() { new Tag()
                        {
                            Name = "technology"
                        },
                       
                },
                    Text = "this is just a test post"
                };

            var testUser = new UserModel()
            {
                Username = "VALIDUSER",
                DisplayName = "VALIDNICK",
                AuthCode = new string('b', 40)
            };
            LoggedUserModel userModel = RegisterTestUser(httpServer, testUser);

            var headers = new Dictionary<string, string>();
            headers["X-sessionKey"] = userModel.SessionKey;

            var response = httpServer.Post("api/posts", testPost, headers);
            Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);
        }
开发者ID:VyaraGGeorgieva,项目名称:TelerikAcademy,代码行数:28,代码来源:CreatePostTests.cs


示例6: Add

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(UserModel model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into UserInfo(");
            strSql.Append("Id,UserName,PassWord,AddTime)");
            strSql.Append(" values (");
            strSql.Append("@Id,@UserName,@PassWord,@AddTime)");
            SqlParameter[] parameters = {
                    new SqlParameter("@Id", SqlDbType.UniqueIdentifier,16),
                    new SqlParameter("@UserName", SqlDbType.VarChar,50),
                    new SqlParameter("@PassWord", SqlDbType.VarChar,50),
                    new SqlParameter("@AddTime", SqlDbType.DateTime)};
            parameters[0].Value = Guid.NewGuid();
            parameters[1].Value = model.UserName;
            parameters[2].Value = model.PassWord;
            parameters[3].Value = model.AddTime;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
开发者ID:hijushen,项目名称:WindowDemo,代码行数:30,代码来源:UserDA.cs


示例7: Post

        public HttpResponseMessage Post(UserModel model)
        {
            HttpResponseMessage response = new HttpResponseMessage();
            var user = model.ToEntity();
            int userId = userService.UserRegistrationAndUpdation("insert",user);
            if (model.Image != null)
            {
                if (HttpContext.Current.Request.Files.AllKeys.Any())
                {
                    // Get the uploaded image from the Files collection
                    var httpPostedFile = HttpContext.Current.Request.Files["UploadedImage"];

                    if (httpPostedFile != null)
                    {
                        string lastPart = Path.GetExtension(httpPostedFile.FileName);
                        string fileName = string.Format("{0}_{1}.{2}", httpPostedFile.FileName, userId, lastPart);
                        // Get the complete file path
                        var fileSavePath = Path.Combine(HttpContext.Current.Server.MapPath("~/Images/User"), httpPostedFile.FileName);

                        // Save the uploaded file to "UploadedFiles" folder
                        httpPostedFile.SaveAs(fileSavePath);
                    }
                }
            }
            response.Content = new StringContent("Registration Successfully", Encoding.Unicode);
            return response;
        }
开发者ID:sankardevts,项目名称:Ignite,代码行数:27,代码来源:UserController.cs


示例8: Update

 public void Update(UserModel updatedUser)
 {
     var existing = Get(updatedUser.Id.GetValueOrDefault());
     if (existing != null)
     {
         existing.DisplayName = updatedUser.DisplayName;
         existing.UserName = updatedUser.UserName;
         existing.ExternalId = updatedUser.ExternalId;
         existing.Name = updatedUser.Name;
         existing.DisplayName = updatedUser.DisplayName;
         existing.NickName = updatedUser.NickName;
         existing.ProfileUrl = updatedUser.ProfileUrl;
         existing.Emails = updatedUser.Emails;
         existing.Addresses = updatedUser.Addresses;
         existing.PhoneNumbers = updatedUser.PhoneNumbers;
         existing.Ims = updatedUser.Ims;
         existing.Photos = updatedUser.Photos;
         existing.UserType = updatedUser.UserType;
         existing.Title = updatedUser.Title;
         existing.PreferredLanguage = updatedUser.PreferredLanguage;
         existing.Locale = updatedUser.Locale;
         existing.Timezonoe = updatedUser.Timezonoe;
         existing.Active = updatedUser.Active;
         existing.Password = updatedUser.Password;
         existing.Groups = updatedUser.Groups;
         existing.X509Certificates = updatedUser.X509Certificates;
         existing.Meta = updatedUser.Meta;
     }
 }
开发者ID:eknowledger,项目名称:SCIM.net,代码行数:29,代码来源:UserService.cs


示例9: AddLogEntry

        /// <summary>
        /// Adds a login attempt to a user's log.
        /// </summary>
        /// <param name="userModel">UserModel with new Data.</param>
        /// <returns>Number of affected rows, should be 1.</returns>
        public LoginLog AddLogEntry(UserModel userModel)
        {
            ClientIdentifier clientIdentifier = Entities.ClientIdentifier.FirstOrDefault(x => x.UserName == userModel.UserName);

            LoginLog loginLog = new LoginLog
                {
                    IpAdress = userModel.IpAdress,
                    TimeStamp = DateTime.Now,
                    UserAgent = userModel.UserAgent,
                    Success = 0

                };

            if (clientIdentifier != null)
            {
                clientIdentifier.LastLogin = DateTime.Now;

                if (clientIdentifier.LoginLog == null)
                           clientIdentifier.LoginLog = new Collection<LoginLog>();

                clientIdentifier.LoginLog.Add(loginLog);
            }

            Entities.SaveChanges();

            return loginLog;
        }
开发者ID:jhilscher,项目名称:lockDataService,代码行数:32,代码来源:Repository.cs


示例10: UpdateInfo

        // Update is called once per frame
        public void UpdateInfo(UserModel userModel)
        {
            if (userModel != null) {
                username.text = "Username: " + userModel.info.username;
                if (userModel.info.gender == "m") {
                    gender.text = "Gender: Male";
                } else if (userModel.info.gender == "f") {
                    gender.text = "Gender: Female";
                } else {
                    gender.text = "Gender: " + userModel.info.gender;
                }
                country.text = "Country: " + userModel.info.country;
                state.text = "State: " + userModel.info.state;

                if (userModel.info.thumbnailUrl != null) {
                    GetUserPic(userModel.info.thumbnailUrl);
                }
            } else {
                username.text = "";
                gender.text = "";
                country.text = "";
                state.text = "";
                userPic.sprite = null;
            }
        }
开发者ID:SeruK,项目名称:Chatsent,代码行数:26,代码来源:GetUserInfo.cs


示例11: GetOrCreateUser

	    private async Task GetOrCreateUser()
	    {
            using (var scope = Container.BeginLifetimeScope())
            {
                var userService = scope.Resolve<IUserService>();
                var user = await userService.GetByIdAsync(User.Id);
                if (user == null)
                {
                    var result = await userService.AddUserAsync(new UserModelAdd { DeviceId = User.DeviceId });
                    if (result.IsSuccess)
                    {
                        User = result.Model;
                        SavePreference(SipperPreference.UserId, User.Id.ToString());
                        SavePreference(SipperPreference.DeviceId, User.DeviceId.ToString());
                    }
                    else
                    {
                        Log.Debug("@string/log_prefix", "User cannot be registered");
                    }
                }
                else
                {
                    User = user;
                }
            }
	    }
开发者ID:ppkdo,项目名称:sipper,代码行数:26,代码来源:App.cs


示例12: SaveChanges

        public ActionResult SaveChanges(UserModel model)
        {
            if (!ModelState.IsValid)
                return null;

            T_User entity = UserModel.ModelToEntity(model);

            // Save add action
            if (model.user_id <= 0)
            {
                entity.user_password = "soft";
                entity.user_date_subscription = DateTime.Now;

                _context.Add(entity);
                _context.SaveChanges();
                Log.Info(string.Format("Edit user id={0} name={1}", entity.user_id, entity.user_name));

                return GenerateJson(entity, true, "Nouveau utilisateur ajouté.");
            }
            // Save edit action
            else
            {
                _context.Edit(entity);
                _context.SaveChanges();
                Log.Info(string.Format("Create user id={0} name={1}", entity.user_id, entity.user_name));

                return GenerateJson(entity, false, "Utilisateur modifié.");
            }
        }
开发者ID:Edjo,项目名称:MvcProject,代码行数:29,代码来源:UserController.cs


示例13: RegisterTestUser

 private LoggedUserModel RegisterTestUser(InMemoryHttpServer httpServer, UserModel testUser)
 {
     var response = httpServer.Post("api/users/register", testUser);
     var contentString = response.Content.ReadAsStringAsync().Result;
     var userModel = JsonConvert.DeserializeObject<LoggedUserModel>(contentString);
     return userModel;
 }
开发者ID:VyaraGGeorgieva,项目名称:TelerikAcademy,代码行数:7,代码来源:LeaveCommentTests.cs


示例14: LoginUser

        public HttpResponseMessage LoginUser(UserModel user)
        {
            IQueryable<User> users = this.userRepository.GetAll();

            var result = from u in users
                         where u.Username == user.Username && u.Password == user.Password
                         select u;

            User newUser = result.FirstOrDefault();
            if (newUser != null)
            {
                var rep = new DbUsersRepository(db);
                var sessionKey = rep.LoginUser(user.Username, user.Password);
                UserLoggedModel userModel = new UserLoggedModel()
                {
                    UserID = newUser.UserID,
                    Username = newUser.Username,
                    SessionKey = sessionKey
                };
                var responseMsg = Request.CreateResponse(HttpStatusCode.OK, userModel);
                return responseMsg;
            }
            else
            {
                var responseMsg = Request.CreateResponse(HttpStatusCode.NotFound);
                return responseMsg;
            }
        }
开发者ID:nnaidenov,项目名称:WebServices-TeamTimon,代码行数:28,代码来源:UsersController.cs


示例15: Add

        public string Add(AddUserModel model)
        {
            if (ModelState.IsValid)
            {
                UserModel user = new UserModel();
                user.Code = model.Code;                             //登录名
                user.Password = "123456".VariationMd5();            //默认密码

                user.Name = model.Name;                             //姓名
                user.Phone = model.Phone;                           //电话
                user.No = model.No;                                 //用户编号

                user.Departmentid = model.Departmentid.ToInt();     //部门
                user.Gender = model.Gender;                         //性别
                user.Age = model.Age;                               //年龄

                user.Status = model.Status;                         //用户状态
                user.Email = model.Email;                           //邮箱

                user.DelFlag = 0;                                   //有效状态
                user.CreateMan = SysConfig.CurrentUser.Id;          //创建人
                user.CreateTime = DateTime.Now;                     //创建时间
                int result = user.Insert().ToInt();

                if (result > 0)
                {
                    //记录操作日志
                    CommonMethod.Log(SysConfig.CurrentUser.Id, "Insert", "Sys_User");
                    return "1";
                }
            }
            return "0";
        }
开发者ID:LeeChean,项目名称:ForeignTradeERP,代码行数:33,代码来源:UserController.cs


示例16: LoginUser

        public HttpResponseMessage LoginUser(UserModel model)
        {
            var baseResponse = this.TryToExecuteOperation(() =>
            {
                this.ValidateUsername(model.Username);
                this.ValidateAuthCode(model.AuthCode);
                var usernameToLower = model.Username.ToLower();
                var user = repository.All()
                    .FirstOrDefault(usr => usr.Username == usernameToLower && usr.AuthCode == model.AuthCode);

                if (user == null)
                {
                    throw new InvalidOperationException("Username is not exist!");
                }

                if (user.SessionKey == null)
                {
                    user.SessionKey = this.GenerateSessionKey(user.UserId);
                    repository.Update(user.UserId, user);
                }

                var userModel = new LoggedUserModel()
                {
                    DisplayName = user.DisplayName,
                    SessionKey = user.SessionKey
                };

                var response = this.Request.CreateResponse(HttpStatusCode.Created, userModel);
                return response;
            });
            return baseResponse;
        }
开发者ID:VyaraGGeorgieva,项目名称:TelerikAcademy,代码行数:32,代码来源:UsersController.cs


示例17: Index

        // GET: UserMgt
        public ActionResult Index()
        {
            UserModel model = new UserModel();
            string code = Request.QueryString["code"];
            string state = Request.QueryString["state"];
            if (!string.IsNullOrEmpty(code))
            {
                model.OpenId = HttpHelper.GetOpenIdByAuthCode(code, state);
            }
            try
            {
                ViewBag.GenderList = EnumHelper.GetEnumList(typeof(PublicEnum.Gender));
                ViewBag.IdTypeList = EnumHelper.GetEnumList(typeof(PublicEnum.IdType));
                ViewBag.ProvinceList = this.GetProvince();
                ViewBag.CityList = this.GetCities(DefaultProvinceId);
                ViewBag.DistrictList = this.GetDistricts(DefaultCityId);
            }
            catch (Exception exp)
            {

                ViewBag.Message = exp.Message;
            }

            return View("Index", model);
        }
开发者ID:JeremiahW,项目名称:runningrecord,代码行数:26,代码来源:UserMgtController.cs


示例18: UcPassAtt

        public UcPassAtt(WPro aPro, UserModel userModel)
        {
            _APro = aPro;
            _UserModel = userModel;

            InitializeComponent();
        }
开发者ID:burstas,项目名称:rmps,代码行数:7,代码来源:UcPassAtt.cs


示例19: GetUser

        public UserModel GetUser(int userId)
        {
            UserModel model = new UserModel();

            User user = session.Load<User>(userId);
            return model.FilledBy(user);
        }
开发者ID:feilang864,项目名称:task.zyfei.net,代码行数:7,代码来源:UserService.cs


示例20: WriteDefaultLogin

        public static void WriteDefaultLogin(UserModel user,bool isEnableDomain,bool isFirst=true)
        {
            try
            {
                if (isFirst)
                {
                    RegistryKey rekey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", true);
                    if (rekey == null) return;
                    else
                    {
                        rekey.SetValue("AutoAdminLogon", "1");
                        rekey.SetValue("DefaultUserName", user.UserName);
                        rekey.SetValue("DefaultPassword", user.Password);
                        if (isEnableDomain)
                            rekey.SetValue("DefaultDomainName", user.Domain);
                        LogHelper.WriteLog("用户" + user.UserName + "自动登录,登录密码为:" + user.Password);
                    }
                    rekey.Close();
                }
                else
                {

                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("设置自动登录错误",ex);
            }
        }
开发者ID:xuren87,项目名称:BatchActiveO365,代码行数:29,代码来源:RegisterTool.cs



注:本文中的UserModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UserProfile类代码示例发布时间:2022-05-24
下一篇:
C# UserManager类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap