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


C# BaseRepository类代码示例

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


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


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