コード例 #1
0
ファイル: Global.asax.cs プロジェクト: NiklasAndren/Missionny
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            ControllerBuilder.Current.SetControllerFactory(new NinjectControllerFactory());

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
            var context = new EFDbContext();

            Database.SetInitializer<EFDbContext>(new MissionInitializer());

            (new EFDbContext()).Database.Initialize(false);
              //  context.Database.Initialize(true);
        }
コード例 #2
0
        public static int Increment()
        {
            int result;
            int valueInrement;

            using (EFDbContext context = new EFDbContext())
            {

                result = context.Increment.First().Counter;
                valueInrement = result;

                context.Increment.First().Counter = ++valueInrement;
                context.SaveChanges();
            }
            return result;
        }
コード例 #3
0
ファイル: Table.cs プロジェクト: Ts-alan/oncloudbase
   public void Setinitialization(EFDbContext db)
   {
       GetDataModel = db.City.Join(db.Street, city => city.id, street => street.City_id,
 (city, street) => new { Location = city.Name, Denomination = street.Name, StreetId = street.id, UniqueNumber=street.UniqueNumber,IdStreet=street.id })
 .GroupJoin(db.Segment, citystreet => citystreet.StreetId, segment => segment.Street_id,
     (citystreet, segment) =>
         new Table()
         {
             Denomination = citystreet.Denomination,
             Location = citystreet.Location,
             NumberSegment = segment.Count(),
             UniqueNumber= citystreet.UniqueNumber,
             IdStreet= citystreet.IdStreet,
             Segments= segment
         });
    }
コード例 #4
0
 public static string StringSymvol(string TypeConstruction = "BB")
 {
     using (EFDbContext context = new EFDbContext())
     {
         if (context.ListUniqueNumber.Any())
         {
             string ListId= context.ListUniqueNumber.Select(a=>a.UniqueNumber).First();
             context.ListUniqueNumber.Remove(context.ListUniqueNumber.First());
             context.SaveChanges();
             return ListId;
         }
     }
     string SymbolString = "";
     int number = Increment();
     for (int s = 8; s > number.ToString().Length; s--)
     {
         SymbolString = "0" + SymbolString;
     }
     var ValueString = TypeConstruction + SymbolString + number;
     return ValueString;
 }
            public SimpleMembershipInitializer()
            {
                Database.SetInitializer<EFDbContext>(null);

                //Database.SetInitializer<UsersContext>(new DropCreateDatabaseIfModelChanges<UsersContext>());

                try
                {
                    using (var context = new EFDbContext())
                    {
                        if (!context.Database.Exists())
                        {
                            // Create the SimpleMembership database without Entity Framework migration schema
                            ((IObjectContextAdapter)context).ObjectContext.CreateDatabase();

                        }
                    }

                    WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true);

                    const string adminRole = "Administrator";
                    const string adminName = "Administrator";
                    const string pwd = "123456";

                    if (!Roles.RoleExists(adminRole))
                    {
                        Roles.CreateRole(adminRole);
                    }
                    if (!WebSecurity.UserExists(adminName))
                    {
                        WebSecurity.CreateUserAndAccount(adminName, pwd);
                        Roles.AddUserToRole(adminName, adminRole);
                    }
                }
                catch (Exception ex)
                {
                    throw new InvalidOperationException("The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588", ex);
                }
            }
コード例 #6
0
 public industriesController(EFDbContext context)
 {
     _context = context;
 }
コード例 #7
0
 public MessageRepository()
 {
     _dbContext = new EFDbContext();
 }
コード例 #8
0
 public StudentsController(EFDbContext context, DataManager dataManager)
 {
     _datamanager     = dataManager;
     _servicesmanager = new ServicesManager(_datamanager);
 }
コード例 #9
0
 public UserRepository()
 {
     _dbContext = new EFDbContext();
 }
コード例 #10
0
        public ActionResult AddWorkout()
        {
            // Check if this page is requested by a logged in user and if the user is an moderator/owner
            if (Session["User"] != null)
            {
                User founduser = (User)Session["User"];
                if (founduser.Username != "")
                {
                    // User is logged in
                    if (founduser.Accounttype == "moderator" || founduser.Accounttype == "owner")
                    {
                        // The user has the rights to add a workout

                        // Retrieve all inputs and check them
                        string workouttitle = Request["Workouttitle"];
                        string price        = Request["Workoutprice"];
                        string goal         = Request["Goal"];
                        string descShort    = Request["DescriptionShort"];

                        string descLong = Request.Unvalidated["DescriptionLong"];

                        if (goal != "Afvallen" && goal != "Spieropbouw" && goal != "Spierkracht" &&
                            goal != "Core")
                        {
                            TempData["alertMessage"] = "Onjuiste invoer bij doel, gelieve opnieuw te proberen";
                            return(View("../Admin/WriteWorkout"));
                        }

                        // Change decimal separator to a period ( . ) for converting to a decimal to work
                        price = price.Replace(",", ".");

                        decimal pricedecimal = decimal.Parse(price, NumberStyles.Any, CultureInfo.InvariantCulture);



                        // All inputs should be correct, add them into the database
                        DateTime creationdate;
                        creationdate = DateTime.Now;

                        int writer = founduser.UserID;

                        Workout workout = new Workout()
                        {
                            CreationDateTime = creationdate,
                            DescriptionLong  = descLong,
                            DescriptionShort = descShort,
                            Goal             = goal,
                            Price            = pricedecimal,
                            WorkoutTitle     = workouttitle,
                            Writer           = writer
                        };

                        var context = new EFDbContext();

                        context.Workouts.Add(workout);
                        context.SaveChanges();

                        return(RedirectToAction("Workouts"));
                    }
                    TempData["alertMessage"] =
                        "Je hebt niet de rechten om deze pagina te bezoeken, als je denkt dat dit een fout is neem dan contact met ons op.";
                    return(View("../Home/Index"));
                }
                TempData["alertMessage"] = "Log in om deze pagina te bezoeken";
                return(View("../Home/Index"));
            }
            TempData["alertMessage"] = "Log in om deze pagina te bezoeken";
            return(View("../Home/Index"));
        }
コード例 #11
0
 public static PublishedDetail GetPublish(EFDbContext dbContext, string id)
 {
     return(dbContext.PublishedDetail.Where(p => p.ID == id).FirstOrDefault());
 }
コード例 #12
0
ファイル: AccountController.cs プロジェクト: solomon00/judge
        public ActionResult ExternalLoginConfirmation(RegisterExternalLoginViewModel model, string returnUrl)
        {
            string provider = null;
            string providerUserId = null;

            if (User.Identity.IsAuthenticated || !OAuthWebSecurity.TryDeserializeProviderUserId(model.ExternalLoginData, out provider, out providerUserId))
            {
                return RedirectToAction("Manage");
            }

            if (ModelState.IsValid)
            {
                // Insert a new user into the database
                using (EFDbContext db = new EFDbContext())
                {
                    UserProfile user = db.UserProfiles.FirstOrDefault(u => u.UserName.ToLower() == model.UserName.ToLower());
                    // Check if user already exists
                    if (user == null)
                    {
                        // Insert name into the profile table
                        db.UserProfiles.Add(new UserProfile { UserName = model.UserName });
                        db.SaveChanges();

                        OAuthWebSecurity.CreateOrUpdateAccount(provider, providerUserId, model.UserName);
                        OAuthWebSecurity.Login(provider, providerUserId, createPersistentCookie: false);

                        return RedirectToLocal(returnUrl);
                    }
                    else
                    {
                        ModelState.AddModelError("UserName", "User name already exists. Please enter a different user name.");
                    }
                }
            }

            ViewBag.ProviderDisplayName = OAuthWebSecurity.GetOAuthClientData(provider).DisplayName;
            ViewBag.ReturnUrl = returnUrl;
            return View(model);
        }
コード例 #13
0
 public EFTeacherContract(EFDbContext context)
 {
     this.context = context;
 }
コード例 #14
0
 public PositionRepositiry(EFDbContext context) : base(context)
 {
 }
コード例 #15
0
 public ItemRepository(EFDbContext context)
 {
     _context = context;
 }
コード例 #16
0
 public MealsController(EFDbContext context)
 {
     _context = context;
 }
コード例 #17
0
 public ArticleRepository(EFDbContext context) : base(context)
 {
     this.context = context;
 }
コード例 #18
0
 public EFFriendsRepository(EFDbContext context)
 {
     this.context = context;
 }
コード例 #19
0
ファイル: Global.asax.cs プロジェクト: solomon00/judge
        private void InitializeSimpleMembership()
        {
            Database.SetInitializer<EFDbContext>(new MigrateDatabaseToLatestVersion<EFDbContext, Solomon.WebUI.Migrations.Configuration>());

            try
            {
                using (var context = new EFDbContext())
                {
                    context.Database.Initialize(true);
                    if (!context.Database.Exists())
                    {
                        // Create the SimpleMembership database without Entity Framework migration schema
                        //((IObjectContextAdapter)context).ObjectContext.CreateDatabase();

                    }
                }

                WebSecurity.InitializeDatabaseConnection("EFDbContext", "UserProfile", "UserId", "UserName", autoCreateTables: true);

                if (!Roles.RoleExists("Administrator"))
                    Roles.CreateRole("Administrator");

                if (!Roles.RoleExists("Judge"))
                    Roles.CreateRole("Judge");

                if (!Roles.RoleExists("User"))
                    Roles.CreateRole("User");

                if (Membership.GetUser("Admin", false) == null)
                {
                    WebSecurity.CreateUserAndAccount("Admin", "alborov");
                }
                if (!Roles.IsUserInRole("Admin", "Administrator"))
                {
                    Roles.AddUserToRole("Admin", "Administrator");
                }
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException("The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588", ex);
            }
        }
コード例 #20
0
ファイル: Repository.cs プロジェクト: taghavi/CustomerPanel
 public Repository(EFDbContext context)
 {
     this.context = context;
 }
コード例 #21
0
 public OrganisationRepository(EFDbContext context)
 {
     this.context = context;
 }
コード例 #22
0
 public Account()
 {
     db = new EFDbContext();
 }
コード例 #23
0
 public ProductController(IHostingEnvironment env, IConfiguration configuration, EFDbContext context)
 {
     _configuration = configuration;
     _env           = env;
     _context       = context;
     dirPathSave    = ImageHelper.GetImageFolder(_env, _configuration);
 }
コード例 #24
0
 public UnitOfWork(EFDbContext context)
 {
     _context    = context;
     ContactRepo = new ContactRepository(_context);
     ReservRepo  = new ReservationRepository(_context);
 }
コード例 #25
0
 public RoleService(EFDbContext context)
 {
     _unitOfWork = new UnitOfWork(context);
     _context    = context;
 }
コード例 #26
0
 public GenericRepository(EFDbContext context)
 {
     this.context = context;
     this.dbSet   = context.Set <TEntity>();
 }
コード例 #27
0
 public CardsController(EFDbContext context)
 {
     _context = context;
 }
コード例 #28
0
 public licensesController(EFDbContext context)
 {
     _context = context;
 }
コード例 #29
0
 public UserCommunitiesService(EFDbContext context)
 {
     _unitOfWork = new UnitOfWork(context);
 }
コード例 #30
0
 public NavigationRepository()
 {
     _dbContext = new EFDbContext();
 }
コード例 #31
0
 public CommunityGroupArticleService(EFDbContext context, IAWSS3Bucket awsS3Bucket)
 {
     _unitOfWork  = new UnitOfWork(context);
     _context     = context;
     _awsS3Bucket = awsS3Bucket;
 }
コード例 #32
0
ファイル: ModuleReaderManager.cs プロジェクト: hust-mis/YOY
        //定时进行数据上传
        private void TimerUpdate_Tick(object sender, EventArgs e)
        {
            if (isEnterInventory)
            {
                try
                {
                    var updateItems = from enter in enterTemp
                                      group enter by enter.EPCString into up
                                      select new { CardID = up.Key, Time = up.Max(t => t.Time) };

                    var v2c = from v in EFHelper.GetAll <Visitor2Card>()
                              join u in updateItems on v.CardID equals u.CardID
                              select new { v.VisitorID, u.Time };

                    if (v2c.Count() > 0)
                    {
                        using (var db = new EFDbContext())
                        {
                            foreach (var v in v2c)
                            {
                                db.ProjectOperation.Add(new Operation()
                                {
                                    ProjectID = ProjectID,
                                    VisitorID = v.VisitorID,
                                    PlayState = 0
                                });
                                db.ProjectRecord.Add(new ProRecord()
                                {
                                    ProjectID = ProjectID,
                                    VisitorID = v.VisitorID,
                                    Timestamp = v.Time,
                                    PlayState = 0
                                });
                            }
                            db.SaveChanges();
                        }
                    }

                    enterTemp.Clear();
                }
                catch (Exception ex)
                {
                }
            }

            if (isExitInventory)
            {
                try
                {
                    var updateItems = from exit in exitTemp
                                      group exit by exit.EPCString into up
                                      select new { CardID = up.Key, Time = up.Max(t => t.Time) };

                    var v2c = from v in EFHelper.GetAll <Visitor2Card>()
                              join u in updateItems on v.CardID equals u.CardID
                              select new { v.VisitorID, u.Time };


                    if (v2c.Count() > 0)
                    {
                        using (var db = new EFDbContext())
                        {
                            foreach (var v in v2c)
                            {
                                var operation = db.ProjectOperation.First(t => t.ProjectID == ProjectID && t.VisitorID == v.VisitorID);
                                if (operation != null)
                                {
                                    db.ProjectOperation.Remove(operation);
                                }
                                db.ProjectRecord.Add(new ProRecord()
                                {
                                    ProjectID = ProjectID,
                                    VisitorID = v.VisitorID,
                                    Timestamp = v.Time,
                                    PlayState = -1
                                });
                            }

                            db.SaveChanges();
                        }
                    }
                    enterTemp.Clear();
                }
                catch (Exception ex)
                {
                }
            }
        }
コード例 #33
0
 public Log4NetRepository(EFDbContext dbContext)
     : base(dbContext)
 {
 }
コード例 #34
0
ファイル: ModuleReaderManager.cs プロジェクト: hust-mis/YOY
        private void TimeProject_Tick(object sender, EventArgs e)
        {
            if (isProjectInventory)
            {
                try
                {
                    var updateItems = from project in projectTemp
                                      group project by project.EPCString into up
                                      select new { CardID = up.Key, Time = up.Max(t => t.Time) };


                    var v2c = from v in EFHelper.GetAll <Visitor2Card>()
                              join u in updateItems on v.CardID equals u.CardID
                              join vi in EFHelper.GetAll <Visitor>() on v.VisitorID equals vi.VisitorID
                              select new { v.VisitorID, vi.Name, u.Time, v.Balance, v.CardID };

                    if (v2c.Count() > 0)
                    {
                        var charge = EFHelper.GetAll <ChargeProject>().First(t => t.ProjectID == ProjectID);

                        foreach (var v in v2c)
                        {
                            if (v.Balance < charge.ProjectPrice)
                            {
                                MessageBox.Show(string.Format("ID:{0},用户:{1} 的余额不足 {2} 元,请充值后再尝试游玩!", v.VisitorID, v.Name, charge.ProjectPrice));
                                continue;
                            }

                            //判断是否重复刷卡
                            var isAgain = EFHelper.GetAll <Operation>().Where(t => t.VisitorID == v.VisitorID && t.PlayState == 1);
                            if (isAgain.Count() > 0)
                            {
                                continue;
                            }

                            using (var db = new EFDbContext())
                            {
                                var operation = db.ProjectOperation.First(t => t.ProjectID == ProjectID && t.VisitorID == v.VisitorID);
                                //改变项目实时信息
                                if (operation != null)
                                {
                                    operation.PlayState = 1;
                                }
                                //增加项目历史记录
                                db.ProjectRecord.Add(new ProRecord()
                                {
                                    ProjectID = ProjectID,
                                    VisitorID = v.VisitorID,
                                    Timestamp = v.Time,
                                    PlayState = 1
                                });
                                //生成消费订单
                                string orderId = IDHelper.getNextOrderID(DateTime.Now, 1);
                                db.Orders.Add(new Order()
                                {
                                    OrderID       = orderId,
                                    OrderState    = 1,
                                    OrderTime     = DateTime.Now,
                                    CommodityID   = charge.ProjectID,
                                    CommodityNum  = 1,
                                    CommodityType = 1,
                                    DoneTime      = DateTime.Now
                                });
                                //成对应的支付信息
                                db.Payments.Add(new Payment()
                                {
                                    OrderID       = orderId,
                                    PaymentAmount = charge.ProjectPrice,
                                    PaymentTime   = DateTime.Now,
                                    PaymentType   = 4
                                });
                                //增加游客支付的映射
                                db.Visitor2Orders.Add(new Visitor2Order()
                                {
                                    CardID    = v.CardID,
                                    OrderID   = orderId,
                                    VisitorID = v.VisitorID
                                });
                                //扣去游客卡上的余额
                                var visitor = db.Visitor2Cards.Where(t => t.VisitorID == v.VisitorID).Single();
                                visitor.Balance -= charge.ProjectPrice;
                                //提交事务
                                db.SaveChanges();
                            }
                        }
                    }

                    projectTemp.Clear();
                }
                catch (Exception ex)
                {
                }
            }
        }
コード例 #35
0
 public void SetDbContext(IDbContext dbContext)
 {
     this._dbContext = dbContext as EFDbContext;
 }
コード例 #36
0
 public PlaylistRepository(EFDbContext context)
 {
     this.context = context;
 }
コード例 #37
0
        // Begin of core PUT/POST execution method, values can be edited, or request can be aborted
        async Task handler_StoreFileRequestStartedAsync(object sender, Eventing.Args.StoreFileRequestEventArgs e)
        {
            string ExtFile = "";
            int FolderId = 0;
            if (TempData["FolderId"] != null)
            {
                FolderId = Convert.ToInt32(TempData["FolderId"]);
                TempData["FolderId"] = FolderId;
            }

            if (e.Param.FileStatusItem.StorageInfo.FilePath != 
                Server.MapPath("~/Files/ServiceGallery/" + FolderId + "/") + e.Param.FileStatusItem.FileName)
            {
                ExtFile = "ErrorPath";
            }
            // GetFileExtension Ext = new GetFileExtension();
            var extt = Path.GetExtension(e.Param.FileStatusItem.FileName);
            if (extt != ".jpg" && extt != ".png" && extt != ".jpeg" && extt != ".gif")
            {
                ExtFile = "ErrorExt";
            }

            if (ExtFile != "" && ExtFile == "ErrorPath")
            {
                e.Param.FileStatusItem.ErrorMessage = "مسیر فایل اشتباه است .";
                e.Param.FileStatusItem.Success = false;
            }
            if (ExtFile != "" && ExtFile == "ErrorExt")
            {
                e.Param.FileStatusItem.ErrorMessage = "نوع فایل معتبر نیست .";
                e.Param.FileStatusItem.Success = false;

            }
            if (ExtFile == "")
            {
                EFDbContext EFDbContext = new EFDbContext();
                string Filen = e.Param.FileStatusItem.FileName;

                int find = Filen.LastIndexOf(".");
                // var ext = Filen.Substring(find, Filen.Length - find);
                var MainName = Filen.Substring(0, find);
                MainName = ChangeUnKnownCharacters(MainName);
                e.Param.FileStatusItem.FileName = DateTime.Now.Ticks + MainName + extt;
                e.Param.FileStatusItem.UpdateStatus(true);

                ServiceTabFile Item = new ServiceTabFile();
                Item.File = e.Param.FileStatusItem.FileName;
                Item.ServiceTabId = FolderId;
                EFDbContext.ServiceTabFiles.Add(Item);
                EFDbContext.SaveChanges();

            }
            e.Context.PipelineControl.Message.MessageText += string.Format(_logpattern, "log-post", "StoreFileRequestStartedAsync", DateTime.Now.ToLongTimeString());
        }
コード例 #38
0
 public UserRepository(EFDbContext context)
 {
     this.context = context;
 }
コード例 #39
0
 public GenericRepository()
 {
     this._context = new EFDbContext();
     this._dbSet   = _context.Set <TEntity>();
 }
コード例 #40
0
ファイル: SiteMapRelated.cs プロジェクト: Chitva/Ganjine
        public IReadOnlyCollection<SitemapNode> GetSitemapNodes()
        {
            #region LocalVariable

            IUnitOfWork _uow = new EFDbContext();
            EFWorkExperienceRepository _RWorkExperience = new EFWorkExperienceRepository(_uow);
            EFServiceRepository _RService = new EFServiceRepository(_uow);
            EFNewsRepository _RNews = new EFNewsRepository(_uow);

            List<SitemapNode> items = new List<SitemapNode>();

            #endregion

            #region Static Page

            items.Add(new SitemapNode("http://www.paa-lawyers.com"));
            items.Add(new SitemapNode("http://www.paa-lawyers.com/Home"));
            items.Add(new SitemapNode("http://www.paa-lawyers.com/EN/Home"));

            items.Add(new SitemapNode("http://www.paa-lawyers.com/AboutUs/Introduce"));
            items.Add(new SitemapNode("http://www.paa-lawyers.com/AboutUs/Staff"));
            items.Add(new SitemapNode("http://www.paa-lawyers.com/AboutUs/Contact"));

            // Uncomment this Line if we have just one AboutUs Page
            //items.Add(new SitemapItem("http://www.paa-lawyers.com/AboutUs", ChangeFrequency.Weekly, 1f));

            items.Add(new SitemapNode("http://www.paa-lawyers.com/EN/AboutUs/Introduce"));
            items.Add(new SitemapNode("http://www.paa-lawyers.com/EN/AboutUs/Staff"));
            items.Add(new SitemapNode("http://www.paa-lawyers.com/EN/AboutUs/Contact"));

            // Uncomment this Line if we have just one AboutUs Page
            //items.Add(new SitemapItem("http://www.paa-lawyers.com/EN/AboutUs", ChangeFrequency.Weekly, 1f));

            items.Add(new SitemapNode("http://www.paa-lawyers.com/Article"));
            items.Add(new SitemapNode("http://www.paa-lawyers.com/EN/Article"));
            items.Add(new SitemapNode("http://www.paa-lawyers.com/News"));
            items.Add(new SitemapNode("http://www.paa-lawyers.com/EN/News"));
            //items.Add(new SitemapNode("http://www.paa-lawyers.com/FAQ"));
            //items.Add(new SitemapNode("http://www.paa-lawyers.com/EN/FAQ"));
            items.Add(new SitemapNode("http://www.paa-lawyers.com/Lawyer"));
            items.Add(new SitemapNode("http://www.paa-lawyers.com/EN/Lawyer"));

            #endregion

            #region workExperience

            //persian workExperience
            var persianWorkExperience = _RWorkExperience.WorkExperienceGroups.Where(_ => _.LanguageId == 1);

            foreach (var experience in persianWorkExperience)
            {
                //if it is the last node and it hasnt any child
                if (!_RWorkExperience.WorkExperienceGroups.Where(_ =>_.ParentID != null && _.ParentID == experience.Id).Any())
                {
                    string urlName = experience.Name.Replace(" ", "-");
                    items.Add(new SitemapNode(string.Format("http://www.paa-lawyers.com/Gallery/{0}/{1}", experience.Id, urlName)));
                }
            }

            //English WorkExperience
            var englishWorkExperience = _RWorkExperience.WorkExperienceGroups.Where(_ => _.LanguageId == 2);

            foreach (var exp in englishWorkExperience)
            {
                //if it is the last node and it hasnt any child
                if (!_RWorkExperience.WorkExperienceGroups.Where(_ =>_.ParentID !=null && _.ParentID == exp.Id).Any())
                {
                    string urlName = exp.Name.Replace(" ", "-");
                    items.Add(new SitemapNode(string.Format("http://www.paa-lawyers.com/EN/WorkExperiences/{0}/{1}", exp.Id, urlName)));
                }
            }

            #endregion workExperience

            #region Services

            //persian services
            var persianServiceGroup = _RService.ServiceGroups.Where(_ => _.LanguageId == 1);

            foreach (var service in persianServiceGroup)
            {
                if (!_RService.ServiceGroups.Where(_ =>_.ParentID != null && _.ParentID == service.Id).Any())
                {
                    string urlName = service.Name.Replace(" ", "-");
                    items.Add(new SitemapNode(string.Format("http://www.paa-lawyers.com/Product/{0}/{1}", service.Id, urlName)));
                }
            }

            //english Services
            var englishServiceGroup = _RService.ServiceGroups.Where(_ => _.LanguageId == 2);

            foreach (var engService in englishServiceGroup)
            {
                if (!_RService.ServiceGroups.Where(_ => _.ParentID != null &&_.ParentID == engService.Id).Any())
                {
                    string urlName = engService.Name.Replace(" ", "-");
                    items.Add(new SitemapNode(string.Format("http://www.paa-lawyers.com/EN/Product/{0}/{1}", engService.Id, urlName)));
                }
            }
            #endregion

            //#region Profiles

            //var UserProfiles = new Dictionary<int, string>();

            //var perLawyersCompany = _RLawyerCompany.LawyerCompanies.Where(_ => _.LanguageId == 1);

            //foreach (var lawyer in perLawyersCompany)
            //{
            //    var urlName = lawyer.CompanyUser.Name.Replace(" ", "-");
            //    var urlFamily = lawyer.CompanyUser.LastName.Replace(" ", "-");
            //    var urlFinal = urlName + "-" + urlFamily;
            //    UserProfiles.Add(lawyer.CompanyUserId, urlFinal);
            //}

            //var perSomeLawyer = _RSomeLawyerCompany.SomeLawyerCompanies.Where(_ => _.LanguageId == 1);

            //foreach (var someLawyer in perSomeLawyer)
            //{
            //    if (!UserProfiles.ContainsKey(someLawyer.CompanyUserId))
            //    {
            //        var urlName = someLawyer.CompanyUser.Name.Replace(" ", "-");
            //        var urlFamily = someLawyer.CompanyUser.LastName.Replace(" ", "-");
            //        var urlFinal = urlName + "-" + urlFamily;
            //        UserProfiles.Add(someLawyer.CompanyUserId, urlFinal);
            //    }
            //}

            //var perStaff = _RStaffCompany.StaffCompanies.Where(_ => _.LanguageId == 1);

            //foreach (var staff in perStaff)
            //{
            //    if (!UserProfiles.ContainsKey(staff.CompanyUserId))
            //    {
            //        var urlName = staff.CompanyUser.Name.Replace(" ", "-");
            //        var urlFamily = staff.CompanyUser.LastName.Replace(" ", "-");
            //        var urlFinal = urlName + "-" + urlFamily;
            //        UserProfiles.Add(staff.CompanyUserId, urlFinal);
            //    }
            //}

            //foreach (var dic in UserProfiles)
            //{
            //    items.Add(new SitemapNode(string.Format("http://www.paa-lawyers.com/Profile/Details/{0}/{1}", dic.Key, dic.Value)));
            //}

            ////EnglishUserProfiles
            //UserProfiles = new Dictionary<int, string>();

            //var engLawyersCompany = _RLawyerCompany.LawyerCompanies.Where(_ => _.LanguageId == 2);

            //foreach (var englawyer in engLawyersCompany)
            //{
            //    var urlName = englawyer.CompanyUser.Name.Replace(" ", "-");
            //    var urlFamily = englawyer.CompanyUser.LastName.Replace(" ", "-");
            //    var urlFinal = urlName + "-" + urlFamily;
            //    UserProfiles.Add(englawyer.CompanyUserId, urlFinal);
            //}

            //var engSomeLawyers = _RSomeLawyerCompany.SomeLawyerCompanies.Where(_ => _.LanguageId == 2);

            //foreach (var SomeLawyer in engSomeLawyers)
            //{
            //    if (!UserProfiles.ContainsKey(SomeLawyer.CompanyUserId))
            //    {
            //        var urlName = SomeLawyer.CompanyUser.Name.Replace(" ", "-");
            //        var urlFamily = SomeLawyer.CompanyUser.LastName.Replace(" ", "-");
            //        var urlFinal = urlName + "-" + urlFamily;
            //        UserProfiles.Add(SomeLawyer.CompanyUserId, urlFinal);
            //    }
            //}

            //var engStaff = _RStaffCompany.StaffCompanies.Where(_ => _.LanguageId == 2);

            //foreach (var engstaff in engStaff)
            //{
            //    if (!UserProfiles.ContainsKey(engstaff.CompanyUserId))
            //    {
            //        var urlName = engstaff.CompanyUser.Name.Replace(" ", "-");
            //        var urlFamily = engstaff.CompanyUser.LastName.Replace(" ", "-");
            //        var urlFinal = urlName + "-" + urlFamily;
            //        UserProfiles.Add(engstaff.CompanyUserId, urlFinal);
            //    }
            //}

            //foreach (var dic in UserProfiles)
            //{
            //    items.Add(new SitemapNode(string.Format("http://www.paa-lawyers.com/EN/Profile/Details/{0}/{1}", dic.Key, dic.Value)));
            //}

            //#endregion

            #region News

            var persianNews = _RNews.News.Where(_ => _.LanguageId == 1);
            foreach (var perNews in persianNews)
            {
                string urlName = perNews.Title.Replace(" ", "-");
                items.Add(new SitemapNode(string.Format("http://www.paa-lawyers.com/News/{0}/{1}", perNews.Id, urlName)));
            }

            var englishNews = _RNews.News.Where(_ => _.LanguageId == 2);

            foreach (var engNews in englishNews)
            {
                string urlName = engNews.Title.Replace(" ", "-");
                items.Add(new SitemapNode(string.Format("http://www.paa-lawyers.com/EN/News/{0}/{1}", engNews.Id, urlName)));
            }

            #endregion

            return items;
        }
コード例 #41
0
ファイル: _DBLogger.cs プロジェクト: naishan/SDDB
        //Constructors---------------------------------------------------------------------------------------------------------//

        public DBLogger(int dbLogginglevel, int procTooLongmSec, EFDbContext dbContext)
        {
            this.dbLoggingLevel = dbLogginglevel;
            this.procTooLongmSec = procTooLongmSec;
            this.dbContext = dbContext;
        }
コード例 #42
0
 public CommercialResponsiblePersonsController(EFDbContext context)
 {
     _context = context;
 }
コード例 #43
0
ファイル: ProjectsController.cs プロジェクト: gcipr/dataApi
 public ProjectsController(EFDbContext context)
 {
     _context = context;
 }
コード例 #44
0
ファイル: EFDataRepository.cs プロジェクト: TipSmit/TicTacToe
 public EFDataRepository(EFDbContext context)
 {
     this.context = context;
 }