当前位置: 首页>>代码示例>>C#>>正文


C# Models类代码示例

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


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

示例1: AddGroup

        public static Models.ValidationResult AddGroup(Models.Group group, int userId)
        {
            using (var uow = new DAL.UnitOfWork())
            {
                var validationResult = ValidateGroup(group, true);
                if (validationResult.IsValid)
                {
                    uow.GroupRepository.Insert(group);
                    validationResult.IsValid = uow.Save();

                    //If Group management is being used add this group to the allowed users list
                    var userManagedGroups = BLL.UserGroupManagement.Get(userId);
                    if (userManagedGroups.Count > 0)
                        BLL.UserGroupManagement.AddUserGroupManagements(
                            new List<Models.UserGroupManagement>
                            {
                                new Models.UserGroupManagement
                                {
                                    GroupId = group.Id,
                                    UserId = userId
                                }
                            });
                }

                return validationResult;
            }
        }
开发者ID:cdadmin,项目名称:clonedeploy,代码行数:27,代码来源:Group.cs

示例2: ClientPartitionHelper

        public ClientPartitionHelper(Models.ImageProfile imageProfile)
        {
            string schema = null;
     
            if (imageProfile != null)
            {
                _imageProfile = imageProfile;
                if (imageProfile.PartitionMethod == "Dynamic" && !string.IsNullOrEmpty(imageProfile.CustomSchema))
                {
                    schema = imageProfile.CustomSchema;
                }
                else
                {
                    var path = Settings.PrimaryStoragePath + "images" + Path.DirectorySeparatorChar + imageProfile.Image.Name + Path.DirectorySeparatorChar +
                               "schema";
                    if (File.Exists(path))
                    {
                        using (var reader = new StreamReader(path))
                        {
                            schema = reader.ReadLine() ?? "";
                        }
                    }
                }
            }

            if (!string.IsNullOrEmpty(schema))
            {
                _imageSchema = JsonConvert.DeserializeObject<Models.ImageSchema.ImageSchema>(schema);
            }
        }
开发者ID:Terricide,项目名称:clonedeploy,代码行数:30,代码来源:ClientPartitionHelper.cs

示例3: Post

        public int Post(Models.MstItemGroup itemgroup)
        {
            try
            {
                var isLocked = true;
                var identityUserId = User.Identity.GetUserId();
                var mstUserId = (from d in db.MstUsers where "" + d.Id == identityUserId select d.Id).SingleOrDefault();
                var date = DateTime.Now;

                Data.MstItemGroup newItemGroup = new Data.MstItemGroup();

                //
                newItemGroup.ItemGroup = itemgroup.ItemGroup;
                newItemGroup.ImagePath = itemgroup.ImagePath;
                newItemGroup.KitchenReport = itemgroup.KitchenReport;
                newItemGroup.EntryUserId = mstUserId;
                newItemGroup.EntryDateTime = date;

                newItemGroup.UpdateUserId = mstUserId;
                newItemGroup.UpdateDateTime = date;
                newItemGroup.IsLocked = isLocked;
                //

                db.MstItemGroups.InsertOnSubmit(newItemGroup);
                db.SubmitChanges();

                return newItemGroup.Id;
            }
            catch
            {
                return 0;
            }
        }
开发者ID:hgminerva,项目名称:WebPos,代码行数:33,代码来源:ApiItemGroupController.cs

示例4: Post

        public int Post(Models.MstUser user)
        {
            try
            {
                var isLocked = true;
                var identityUserId = User.Identity.GetUserId();
                var mstUserId = (from d in db.MstUsers where "" + d.Id == identityUserId select d.Id).SingleOrDefault();
                var date = DateTime.Now;

                Data.MstUser newUser = new Data.MstUser();

                newUser.UserName = user.UserName;
                newUser.IsLocked = isLocked;
                newUser.Password = user.Password;
                newUser.FullName = user.FullName;
                newUser.UserCardNumber = user.UserCardNumber;
                newUser.EntryUserId = mstUserId;
                newUser.EntryDateTime = date;
                newUser.UpdateUserId = mstUserId;
                newUser.UpdateDateTime = date;

                db.MstUsers.InsertOnSubmit(newUser);
                db.SubmitChanges();

                return newUser.Id;
            }
            catch
            {
                return 0;
            }
        }
开发者ID:hgminerva,项目名称:WebPos,代码行数:31,代码来源:ApiUserController.cs

示例5: add

 public void add(Models.Author author)
 {
     using (BookLibrary dc = new BookLibrary(connectionString, mapping))
     {
         dc.addAuthor(author.Id, author.name);
     }
 }
开发者ID:pgleinad,项目名称:CSWSolutions,代码行数:7,代码来源:Author.cs

示例6: AddTask

 public Task AddTask(HttpRequestMessage requestMessage, Models.Task newTask)
 {
     return new Task
     {
         Subject = "In v2, newTask.Subject = " + newTask.Subject
     };
 }
开发者ID:ZiTsi,项目名称:TaskManager,代码行数:7,代码来源:TasksController.cs

示例7: Equals

 protected bool Equals(Models.Character other)
 {
     return Number == other.Number && Priority == other.Priority && string.Equals(Logograph, other.Logograph) &&
            string.Equals(Pronunciation, other.Pronunciation) && Equals(ReviewTime, other.ReviewTime) &&
            Equals(Definitions, other.Definitions) && Equals(Usages, other.Usages) &&
            Equals(Phrases, other.Phrases) && Equals(Idioms, other.Idioms);
 }
开发者ID:inkysigma,项目名称:ChineseDictionary,代码行数:7,代码来源:CharacterExtentions.cs

示例8: RenderBody

        private void RenderBody(Models.RenderingModel model, StringBuilder sbHtml)
        {
            sbHtml.AppendLine("<tbody>");

            foreach (var row in model.Rows)
            {
                sbHtml.Append("<tr");
                AppendCssAttribute(row.CalculatedCssClass, sbHtml);
                sbHtml.AppendLine(">");

                foreach (var col in model.Columns)
                {
                    var cell = row.Cells[col.Name];

                    sbHtml.Append("<td");
                    AppendCssAttribute(cell.CalculatedCssClass, sbHtml);
                    sbHtml.Append(">");
                    sbHtml.Append(cell.HtmlText);
                    sbHtml.Append("</td>");
                }
                sbHtml.AppendLine("  </tr>");
            }

            sbHtml.AppendLine("</tbody>");
        }
开发者ID:T-o-m-a-s-z,项目名称:MVCGrid.Net,代码行数:25,代码来源:BootstrapRenderingEngine.cs

示例9: Add

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Models.m_announcement_user model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into m_announcement_user(");
            strSql.Append("ANNOUNCEMENT_ID,USER_ACCOUNT,STATUS)");
            strSql.Append(" values (");
            strSql.Append("@ANNOUNCEMENT_ID,@USER_ACCOUNT,@STATUS)");
            SqlParameter[] parameters = {
                    new SqlParameter("@ANNOUNCEMENT_ID", SqlDbType.UniqueIdentifier,16),
                    new SqlParameter("@USER_ACCOUNT", SqlDbType.NVarChar,50),
                    new SqlParameter("@STATUS", SqlDbType.NVarChar,50)};
            parameters[0].Value = model.ANNOUNCEMENT_ID;
            parameters[1].Value = model.USER_ACCOUNT;
            parameters[2].Value = model.STATUS;

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

示例10: insertAccountCategory

        public Int32 insertAccountCategory(Models.MstAccountCategory accountCategory)
        {
            try
            {
                var userId = (from d in db.MstUsers where d.UserId == User.Identity.GetUserId() select d.Id).SingleOrDefault();

                Data.MstAccountCategory newAccountCategory = new Data.MstAccountCategory();
                newAccountCategory.AccountCategoryCode = accountCategory.AccountCategoryCode;
                newAccountCategory.AccountCategory = accountCategory.AccountCategory;
                newAccountCategory.IsLocked = accountCategory.IsLocked;
                newAccountCategory.CreatedById = userId;
                newAccountCategory.CreatedDateTime = DateTime.Now;
                newAccountCategory.UpdatedById = userId;
                newAccountCategory.UpdatedDateTime = DateTime.Now;

                db.MstAccountCategories.InsertOnSubmit(newAccountCategory);
                db.SubmitChanges();

                return newAccountCategory.Id;
            }
            catch
            {
                return 0;
            }
        }
开发者ID:hgminerva,项目名称:Easyfisv2,代码行数:25,代码来源:ApiAccountCategoryController.cs

示例11: AddApp

        public int AddApp(XXF.Db.DbConn PubConn, Models.DbModels.app model)
        {
            if (string.IsNullOrEmpty(model.appid))
            {
                model.appid = XXF.Db.LibString.MakeRandomNumber(16).ToLower();
            }
            if (ExitAppid(PubConn, model.appid))
            {
                return -2;
            }
            if (string.IsNullOrEmpty(model.appsecret))
            {
                model.appsecret = Guid.NewGuid().ToString().Replace("-", "");
            }

            string sql = "insert into app(appid,appname,apptype,appgradeno,appsecret,appdesc,freeze) values(@appid,@appname,@apptype,@appgradeno,@appsecret,@appdesc,@freeze)";
            XXF.Db.SimpleProcedureParameter para = new XXF.Db.SimpleProcedureParameter();
            para.Add("@appid", model.appid);
            para.Add("@appsecret", model.appsecret);
            para.Add("@appname", model.appname);
            para.Add("@apptype", model.apptype);
            para.Add("@appgradeno", model.appgradeno);
            para.Add("@freeze", model.freeze);
            para.Add("@appdesc", model.appdesc ?? "");

            int r = PubConn.ExecuteSql(sql, para.ToParameters());
            return r;
        }
开发者ID:buweixiaomi,项目名称:DydCert,代码行数:28,代码来源:AppDal.cs

示例12: Search

        //public Models.SearchResult<Models.ConsumableUsage> Search(Models.DateRangeSearchInfo searchInfo)
        //{
        //    string url = string.Format("{0}?page={1}&limit={2}&start={3}&end={4}",
        //        ResourceUrl, searchInfo.PageIndex, searchInfo.PageSize, searchInfo.Start, searchInfo.End);
        //    return CreateGetRequest<SearchResult<Models.ConsumableUsage>>(Guid.Empty, url);
        //}
        public Models.SearchResult<Models.ConsumableUsage> Search(Models.ConsumableUsageSearchInfo searchInfo)
        {
            string url = string.Format("{0}?page={1}&limit={2}&start={3}&end={4}",
                ResourceUrl ,searchInfo.PageIndex, searchInfo.PageSize, searchInfo.Start, searchInfo.End);

            return CreateGetRequest<SearchResult<ConsumableUsage>>(Guid.Empty, url);
        }
开发者ID:antonmaju,项目名称:egg-farm-system,代码行数:13,代码来源:ConsumableUsageServiceClient.cs

示例13: Save

 public void Save(Models.ConsumableUsage model)
 {
     if(model.IsNew)
         base.CreatePostRequest(model);
     else
         base.CreatePutRequest(model.Id, model);
 }
开发者ID:antonmaju,项目名称:egg-farm-system,代码行数:7,代码来源:ConsumableUsageServiceClient.cs

示例14: CloudUpload

        public string CloudUpload(Models.RegisterBindingModel user)
        {
            if (HandleFileUpload(ref user))
            {
                Account acount = new Account("gigantor", "986286566519458", "GT87e1BTMnfLut1_gXhSH0giZPg");
                Cloudinary cloudinary = new Cloudinary(acount);

                string userId = this.User.Identity.GetUserId();
                ApplicationUser user1 = db.Users.Find(userId);
                if (user1.ProfilePicUrl != null && user1.ProfilePicUrl.StartsWith("http://res.cloudinary.com/gigantor/image/upload/"))  //this block of code deletes the previous image if the user had one
                {
                    //this here is just a string manipulation to get to the ImageID from cloudinary
                    string assist = "http://res.cloudinary.com/gigantor/image/upload/";
                    string part1 = user1.ProfilePicUrl.Remove(user1.ProfilePicUrl.IndexOf(assist), assist.Length);
                    string part2 = part1.Remove(0, 12);
                    string toDelete = part2.Remove(part2.Length - 4);
                    cloudinary.DeleteResources(toDelete);  //this finally deletes the image
                }

                user1.ProfilePicUrl = CloudinaryUpload(user);
                db.Entry(user1).State = EntityState.Modified;
                db.SaveChanges();
                return user1.ProfilePicUrl;
            }
            return user.ProfileUrl;
        }
开发者ID:AdmirZirojevic,项目名称:BitCampProject,代码行数:26,代码来源:HelperController.cs

示例15: Post

        public int Post(Models.SysAuditTrail audittrail)
        {
            try
            {
                var identityUserId = User.Identity.GetUserId();
                var mstUserId = (from d in db.MstUsers where "" + d.Id == identityUserId select d.Id).SingleOrDefault();

                Data.SysAuditTrail newAuditTrail = new Data.SysAuditTrail();

                //
                newAuditTrail.UserId = mstUserId;
                newAuditTrail.AuditDate = Convert.ToDateTime(audittrail.AuditDate);
                newAuditTrail.TableInformation = audittrail.TableInformation;
                newAuditTrail.RecordInformation = audittrail.RecordInformation;
                newAuditTrail.FormInformation = audittrail.FormInformation;
                newAuditTrail.ActionInformation = audittrail.ActionInformation;
                //

                db.SysAuditTrails.InsertOnSubmit(newAuditTrail);
                db.SubmitChanges();

                return newAuditTrail.Id;
            }
            catch
            {
                return 0;
            }
        }
开发者ID:hgminerva,项目名称:WebPos,代码行数:28,代码来源:ApiAuditTrailController.cs


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