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

C# BaseRepository类代码示例

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

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



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

示例1: CheckLusherAnswers

        public static List<int> CheckLusherAnswers(long surveyResultId, List<SurveysAnswerContent> surveysAnswerContents)
        {
            using (var lusherRepository = new BaseRepository<LusherAnswer>())
            {
                SurveysResult surveysResult =
                    lusherRepository.Context.SurveysResults.FirstOrDefault(x => x.Id == surveyResultId);
                if (surveysResult == null)
                {
                    throw new SurveysResultDoesNotExistException();
                }

                // Check surveyResultMethod.MethodsId = id of test lusher pair
                Test test = lusherRepository.Context.Tests.FirstOrDefault(x => x.Id == surveysResult.MethodsId);
                if (test == null)
                {
                    return null;
                }
                if (!String.Equals(test.CodeName, Constraints.KLusherPairCodeName))
                {
                    return null;
                }

                String answerStr = ResultConverter.GenerateAnswerString(test.CodeName, surveysAnswerContents);

                // Check lusher Answers for special question
                // Invoke static method from LusherPairMethod from Consul Shell
                return LusherPairMethod.CheckAnswers(answerStr);
            }
        }
开发者ID:sergiygladkyy,项目名称:mbo,代码行数:29,代码来源:LusherPairRepository.cs


示例2: Edit

        public ActionResult Edit(FirmExt model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    string Msg = "";
                    FirmRepository uRepo = new FirmRepository();
                    if (uRepo.Update(model, ref Msg, this))
                    {
                        return RedirectToAction("Index", "Firm");
                    }
                }
                catch (Exception ex)
                {
                    string hostName1 = Dns.GetHostName();
                    string GetUserIPAddress = Dns.GetHostByName(hostName1).AddressList[0].ToString();
                    string PageName = Convert.ToString(Session["PageName"]);
                    //string GetUserIPAddress = GetUserIPAddress1();
                    using (BaseRepository baseRepo = new BaseRepository())
                    {
                        //BizContext BizContext1 = new BizContext();
                        BizApplication.AddError(baseRepo.BizDB, PageName, ex.Message, ex.StackTrace, DateTime.Now, GetUserIPAddress);
                    }
                    Session["PageName"] = "";
                    ModelState.AddModelError("", "Error: Please Correct/Enter All the Information below to Save this Record, All Fields are Mandatory");
                    ErrorHandling.HandleModelStateException(ex, ModelState);
                }
            }

            return View(model);
        }
开发者ID:tomasroy2015,项目名称:gbs-angular-html5,代码行数:32,代码来源:FirmController.cs


示例3: _Create

        public ActionResult _Create([DataSourceRequest]DataSourceRequest request, TB_TypeFirmRequestStatusExt model)
        {
            if (ModelState.IsValid)
            {
                string Msg = "";
                try
                {
                    TB_TypeFirmRequestStatusRepository modelRepo = new TB_TypeFirmRequestStatusRepository();
                    if (modelRepo.Create(model, ref Msg, this) == false)
                    {
                        return this.Json(new DataSourceResult { Errors = Msg });
                    }
                }
                catch (Exception ex)
                {
                    string hostName1 = Dns.GetHostName();
                    string GetUserIPAddress = Dns.GetHostByName(hostName1).AddressList[0].ToString();
                    string PageName = Convert.ToString(Session["PageName"]);
                    //string GetUserIPAddress = GetUserIPAddress1();
                    using (BaseRepository baseRepo = new BaseRepository())
                    {
                        //BizContext BizContext1 = new BizContext();
                        BizApplication.AddError(baseRepo.BizDB, PageName, ex.Message, ex.StackTrace, DateTime.Now, GetUserIPAddress);
                    }
                    Session["PageName"] = "";
                    string error = ErrorHandling.HandleException(ex);
                    return this.Json(new DataSourceResult { Errors = error });
                }
            }

            return Json(new[] { model }.ToDataSourceResult(request, ModelState));
        }
开发者ID:tomasroy2015,项目名称:gbs-angular-html5,代码行数:32,代码来源:TB_TypeFirmRequestStatusController.cs


示例4: GetPackages

 public Package GetPackages(int packageId)
 {
     using (var packageRepository = new BaseRepository<Package>())
     {
         return packageRepository.GetAllItems.FirstOrDefault(x => x.Id == packageId);
     }
 }
开发者ID:sergiygladkyy,项目名称:mbo,代码行数:7,代码来源:PackageRepository.cs


示例5: Validate

        public override ValidationResult Validate(object value,
        System.Globalization.CultureInfo cultureInfo)
        {
            BindingGroup bg = value as BindingGroup;
            if (bg == null) { return ValidationResult.ValidResult; }
            if (bg.Items.Count > 0)
            {
                Peoples tempValue = (value as BindingGroup).Items[0] as Peoples;
                try
                {
                    BaseRepository<Peoples> peoples = new BaseRepository<Peoples>();
                    var temp = (from peopl in peoples.items where tempValue.inn == peopl.inn select peopl).Count<Peoples>();
                    if (temp == 1)
                    {
                        peoples.SaveChages();
                        return ValidationResult.ValidResult;
                        
                    }

                    return new ValidationResult(false, "Найдено совпадение ИНН");
                }
                catch (Exception ex)
                {
                    return new ValidationResult(false, ex.Message);
                }
            }
            return ValidationResult.ValidResult;
        }
开发者ID:versussun,项目名称:git-ato-base_client,代码行数:28,代码来源:PeoplesRowValidationRules.cs


示例6: GetTests

 public IEnumerable<Test> GetTests()
 {
     using (var repo = new BaseRepository<Test>())
     {
         return repo.GetAllItems.ToList();
     }
 }
开发者ID:sergiygladkyy,项目名称:mbo,代码行数:7,代码来源:TestRepository.cs


示例7: DeleteHotelRoom

 public JsonResult DeleteHotelRoom(int HotelRoomID)
 {
     int i = 1;
     PropertyRoomsRepository obj = new PropertyRoomsRepository();
     try
     {
         i = obj.DeleteHotelRoom(HotelRoomID, this);
     }
     catch (Exception ex)
     {
         string hostName1 = Dns.GetHostName();
         string GetUserIPAddress = Dns.GetHostByName(hostName1).AddressList[0].ToString();
         string PageName = Convert.ToString(Session["PageName"]);
         //string GetUserIPAddress = GetUserIPAddress1();
         using (BaseRepository baseRepo = new BaseRepository())
         {
             //BizContext BizContext1 = new BizContext();
             BizApplication.AddError(baseRepo.BizDB, PageName, ex.Message, ex.StackTrace, DateTime.Now, GetUserIPAddress);
         }
         Session["PageName"] = "";
         string error = ErrorHandling.HandleException(ex);
         return this.Json(new DataSourceResult { Errors = error });
     }
     return Json(i, JsonRequestBehavior.AllowGet);
 }
开发者ID:tomasroy2015,项目名称:gbs-angular-html5,代码行数:25,代码来源:PropertyRoomsController.cs


示例8: GetAllShellResults

 public static List<SurveysShellResult> GetAllShellResults()
 {
     using (var resultRepository = new BaseRepository<SurveysShellResult>())
     {
         return resultRepository.GetAllItems.ToList();
     }
 }
开发者ID:sergiygladkyy,项目名称:mbo,代码行数:7,代码来源:SurveysResultRepository.cs


示例9: AuthorizeUser

        public OldUser AuthorizeUser(string login, string password)
        {
            using (var _userRepository = new BaseRepository<OldUser>())
            {
                //var OldUser = _userRepository.GetAllItems.FirstOrDefault(x => x.Login == login && x.Password == password);
                var user = _userRepository.Context.OldUsers.Include("Role").FirstOrDefault(x => x.Login == login && x.Password == password);
                if (user == null)
                {
                    throw new UserDoesNotExistException();
                }

                if (user.ExpirationDate < DateTime.Now)
                {
                    // session is not valid, update token
                    user.Token = Guid.NewGuid();
                }

                user.ExpirationDate = DateTime.Now.AddMinutes(20);

                if (_userRepository.Update(user).Status)
                {
                    return user;
                }
            }
            throw new UpdateException();
        }
开发者ID:sergiygladkyy,项目名称:mbo,代码行数:26,代码来源:AuthorizationRepository.cs


示例10: GetRoleById

 /// <summary>
 /// Get role by Id
 /// DB table Roles
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Role GetRoleById(int id)
 {
     using (var roleRepository = new BaseRepository<Role>())
     {
         return roleRepository.GetAllItems.FirstOrDefault(x => x.Id == id);
     }
 }
开发者ID:sergiygladkyy,项目名称:mbo,代码行数:13,代码来源:RoleRepository.cs


示例11: GetRoles

 /// <summary>
 /// Return list of Roles
 /// DB table Roles
 /// </summary>
 /// <returns></returns>
 public List<Role> GetRoles()
 {
     using (var roleRepository = new BaseRepository<Role>())
     {
         return roleRepository.GetAllItems.ToList();
     }
 }
开发者ID:sergiygladkyy,项目名称:mbo,代码行数:12,代码来源:RoleRepository.cs


示例12: GetAllQuestions

 public List<ShutzQuestion> GetAllQuestions()
 {
     using (var shutzQuestionRepository = new BaseRepository<ShutzQuestion>())
     {
         return shutzQuestionRepository.Context.ShutzQuestions.Include("ShutzAnswers").ToList();
     }
 }
开发者ID:sergiygladkyy,项目名称:mbo,代码行数:7,代码来源:ShutzRepository.cs


示例13: GetAllQuestions

 public List<KotQuestion> GetAllQuestions()
 {
     using (var kotQuestionRepository = new BaseRepository<KotQuestion>())
     {
         return kotQuestionRepository.Context.KotQuestions.Include("KotAnswers").ToList();
     }
 }
开发者ID:sergiygladkyy,项目名称:mbo,代码行数:7,代码来源:KotRepository.cs


示例14: GetSpecialQuestion

        public static List<LusherPairScenarioItem> GetSpecialQuestion(List<int> colorNumbers)
        {
            using (var lusherPairRepository = new BaseRepository<LusherPairQuestion>())
            {
                List<LusherAnswer> specialColors = new List<LusherAnswer>();
                foreach (var colorNumber in colorNumbers)
                {
                    specialColors.Add(lusherPairRepository.Context.LusherAnswers.FirstOrDefault(x => x.Number == colorNumber));
                }
                LusherPairQuestion specialQuestion = lusherPairRepository.GetAllItems.FirstOrDefault(x => x.Id != 1);
                if (specialQuestion == null)
                {
                    throw new QuestionDoesNotExistException();
                }

                List<LusherPairScenarioItem> scenarioItems = new List<LusherPairScenarioItem>();

                LusherPairScenarioItem scenarioItem = new LusherPairScenarioItem();
                scenarioItem.Steps = new List<LusherPairQuestion>() { specialQuestion };
                scenarioItem.Answers = specialColors;
                scenarioItem.UniqueAnswer = true;
                scenarioItems.Add(scenarioItem);

                return scenarioItems;
            }
        }
开发者ID:sergiygladkyy,项目名称:mbo,代码行数:26,代码来源:LusherPairRepository.cs


示例15: GetTest

 public static Test GetTest(int id)
 {
     using (var testRepository = new BaseRepository<Test>())
     {
         return testRepository.GetAllItems.FirstOrDefault(x => x.Id == id);
     }
 }
开发者ID:sergiygladkyy,项目名称:mbo,代码行数:7,代码来源:TestRepository.cs


示例16: GetUserByCredentials

 public OldUser GetUserByCredentials(string login, string password)
 {
     using (var _repository = new BaseRepository<OldUser>())
     {
         return _repository.Context.OldUsers.Include("Role").FirstOrDefault(x => x.Login == login && x.Password == password);
     }
 }
开发者ID:sergiygladkyy,项目名称:mbo,代码行数:7,代码来源:AuthorizationRepository.cs


示例17: GetTestById

 public Test GetTestById(int id)
 {
     using (var repo = new BaseRepository<Test>())
     {
         return repo.GetAllItems.ToList().FirstOrDefault(x => x.Id == id);
     }
 }
开发者ID:sergiygladkyy,项目名称:mbo,代码行数:7,代码来源:TestRepository.cs


示例18: GetServicePrice

 public Price GetServicePrice(int id)
 {
     using (var priceRepository = new BaseRepository<Price>())
     {
         return priceRepository.GetAllItems.FirstOrDefault(x => x.ServiceId == id);
     }
 }
开发者ID:sergiygladkyy,项目名称:mbo,代码行数:7,代码来源:ServiceRepository.cs


示例19: Validate

        public override ValidationResult Validate(object value,
        System.Globalization.CultureInfo cultureInfo)
        {
            BindingGroup bg = value as BindingGroup;
            if (bg == null) { return ValidationResult.ValidResult; }
            if (bg.Items.Count > 0)
            {
                UBD_sertificate tempValue = (value as BindingGroup).Items[0] as UBD_sertificate;
                try
                {
                    BaseRepository<UBD_sertificate> sertificats = new BaseRepository<UBD_sertificate>();

                    var temp = (from sertif in sertificats.items
                                where sertif.id_people==tempValue.id_people && sertif.certificate_number==tempValue.certificate_number
                                select sertif).Count<UBD_sertificate>();
                    if (temp == 1)
                    {
                        sertificats.SaveChages();
                        return ValidationResult.ValidResult;

                    }

                    return new ValidationResult(false, "Запись о даном удостоверении уже существует!!!");
                }
                catch (Exception ex)
                {
                    return new ValidationResult(false, ex.Message);
                }
            }
            return ValidationResult.ValidResult;
        }
开发者ID:versussun,项目名称:git-ato-base_client,代码行数:31,代码来源:UBDValidationRules.cs


示例20: GetServices

 public List<Service> GetServices()
 {
     using (var serviceRepository = new BaseRepository<Service>())
     {
         return serviceRepository.Context.Services.Include("ConclusionType").ToList();
     }
 }
开发者ID:sergiygladkyy,项目名称:mbo,代码行数:7,代码来源:ServiceRepository.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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