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

C# Models类代码示例

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

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



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


示例16: AddDetail

 public ActionResult AddDetail(Models.LedgerAddDetailModel model)
 {
     using (db00ccd2da5aff4a5983c0a17b010f53a6Entities context = new db00ccd2da5aff4a5983c0a17b010f53a6Entities())
     {
         var theLedger = context.Ledgers.FirstOrDefault(l => l.LedgerId == model.LedgerId);
         if (theLedger == default(Ledger))
         {
             return View("ErrorMessage", new Models.ErrorMessageModel { Title = "No Such Ledger!", Message = "The ledger you are attempting to access does not exist in the database.", ReturnAction = "Index", ReturnRouteValues = new { } });
         }
         else if (theLedger.UserProfile.UserName != User.Identity.Name && theLedger.Editors.FirstOrDefault(u => u.UserName == User.Identity.Name) == default(UserProfile))
         {
             return View("ErrorMessage", new Models.ErrorMessageModel { Title = "No Permission!", Message = "You are neither the owner nor an editor of the ledger you are attempting to access.", ReturnAction = "Index", ReturnRouteValues = new { } });
         }
         var theDetail = new LedgerDetail();
         theDetail.Amount = model.Amount;
         theDetail.Legder_LedgerId = model.LedgerId;
         theDetail.Memo = model.Memo;
         theDetail.Payor = model.Payor;
         theDetail.PaySource = model.PaySource;
         theDetail.Category = model.Category;
         theDetail.When = model.When;
         theLedger.LedgerDetails.Add(theDetail);
         context.SaveChanges();
         return RedirectToAction("Detail", new { id=model.LedgerId });
     }
 }
开发者ID:hakelimopu,项目名称:SimpleLedger,代码行数:26,代码来源:LedgerController.cs


示例17: AddCompileResult

        public void AddCompileResult(Models.CompileCommandResult result)
        {
            if (InvokeRequired)
            {
                this.Invoke(new AddCompileResultDelegate(AddCompileResult), new object[] { result });
                return;
            }

            if (result.IsSuccess){
                result.ResultText = "success";
            }

            List<Models.CompileCommandResult> compileResults = (List<Models.CompileCommandResult>)compileResultsDataGridView.DataSource;
            compileResults.Insert(0, result);
            compileResultsDataGridView_DataChanged();

            if (result.IsSuccess && Program.Settings.ShowSuccessMessages)
            {
                ShowSuccessNotification("Successful compile", result.ResultText);
            }
            else if(!result.IsSuccess)
            {
                ShowErrorNotification("Compile error", result.ResultText);
            }
        }
开发者ID:rs3d,项目名称:WinLess,代码行数:25,代码来源:mainForm.cs


示例18: AddEditor

 public ActionResult AddEditor(Models.LedgerAddEditorModel model)
 {
     using (db00ccd2da5aff4a5983c0a17b010f53a6Entities context = new db00ccd2da5aff4a5983c0a17b010f53a6Entities())
     {
         var theLedger = context.Ledgers.FirstOrDefault(l => l.LedgerId == model.LedgerId);
         if (theLedger == default(Ledger))
         {
             return View("ErrorMessage", new Models.ErrorMessageModel { Title = "No Such Ledger!", Message = "The ledger you are attempting to access does not exist in the database.", ReturnAction = "Index", ReturnRouteValues = new { } });
         }
         else if (theLedger.UserProfile.UserName != User.Identity.Name)
         {
             return View("ErrorMessage", new Models.ErrorMessageModel { Title = "No Permission!", Message = "You are not the owner of the ledger you are attempting to access.", ReturnAction = "Index", ReturnRouteValues = new { } });
         }
         var theUser = context.UserProfiles.FirstOrDefault(u => u.UserName == model.EditorName);
         if (theUser == default(UserProfile))
         {
             return View("ErrorMessage", new Models.ErrorMessageModel { Title = "No Such User!", Message = "The user you are attempting to add does not exist in the database.", ReturnAction = "Editors", ReturnRouteValues = new { id= model.LedgerId } });
         }
         if (theLedger.Editors.Any(u => u.UserId == theUser.UserId))
         {
             return View("ErrorMessage", new Models.ErrorMessageModel { Title = "User Already an Editor!", Message = "The user you are attempting to add is already an editor.", ReturnAction = "Editors", ReturnRouteValues = new { id=model.LedgerId } });
         }
         theLedger.Editors.Add(theUser);
         context.SaveChanges();
         return RedirectToAction("Editors", new { id = model.LedgerId });
     }
 }
开发者ID:hakelimopu,项目名称:SimpleLedger,代码行数:27,代码来源:LedgerController.cs


示例19: Save

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


示例20: saveTransaction

 public string saveTransaction(Models.EntryModel model)
 {
     
         using (var transaction=_ctx.Database.BeginTransaction())
         {
             try
             {
                 Guid salesId = Guid.NewGuid();
                 SalesMaster salesMaster = new SalesMaster();
                 salesMaster.id = salesId;
                 salesMaster.timeStamp = model.TimeStamp;
                 salesMaster.location_name = model.LocationName;
                 salesMaster.sale_invoice_number = model.InvoiceNo;
                 salesMaster.total_sales_amount = model.TotalAmount;
                 salesMaster.currency = model.Currency;
                 List<SalesDetail> sales = model.SalesDetails.Select(a => new SalesDetail() { ProductId = a.Id, SalesMasterId = salesId, Quantity = a.Quantity }).ToList();
                 sales.ForEach(s => _ctx.salesDetail.Add(s));
                 _ctx.salesMaster.Add(salesMaster);
                 _ctx.SaveChanges();
                 transaction.Commit();
                 return salesId.ToString();
             }
             catch
             {
                 transaction.Rollback();
                 return null;
             }
         }
     
 }
开发者ID:sandipco,项目名称:HelixLeisure,代码行数:30,代码来源:HLeisureRepository.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Modes类代码示例发布时间:2022-05-24
下一篇:
C# Modelo_Entidades类代码示例发布时间: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