public AuthenticationController(UserManager <Usuario> userManager, IJwtFactory jwtFactory, IOptions <JwtIssuerOptions> jwtOptions, mydbContext mydbContext)
 {
     _userManager = userManager;
     _jwtFactory  = jwtFactory;
     _jwtOptions  = jwtOptions.Value;
     _mydbContext = mydbContext;
 }
示例#2
0
文件: Program.cs 项目: gstavr/AGEMKO
        private static void RegionalUnity(object vPreviousColumn, object v1)
        {
            if (v1 != null && !string.IsNullOrWhiteSpace(v1.ToString()))
            {
                using (mydbContext context = new mydbContext())
                {
                    Region regType = new Region();
                    regType = context.Region.FirstOrDefault(x => x.RegionDescr.Equals(vPreviousColumn.ToString().Trim()));
                    if (regType == default(Region))
                    {
                        regType = new Region();
                        int?maxID = context.Region.Count().Equals(0) ? default(int?) : context.Region.Max(x => x.RegionId);
                        regType.RegionId    = maxID.HasValue ? maxID.Value + 1 : 1;
                        regType.RegionDescr = vPreviousColumn.ToString().Trim();
                        context.Region.Add(regType);
                        context.SaveChanges();
                    }


                    Regionalunity rType = new Regionalunity();
                    rType = context.Regionalunity.FirstOrDefault(x => x.RegionalUnityDescr.Equals(v1.ToString().Trim()));
                    if (rType == default(Regionalunity))
                    {
                        rType = new Regionalunity();
                        int?maxID = context.Regionalunity.Count().Equals(0) ? default(int?) : context.Regionalunity.Max(x => x.RegionalUnityId);
                        rType.RegionalUnityId    = maxID.HasValue ? maxID.Value + 1 : 1;
                        rType.RegionalUnityDescr = v1.ToString().Trim();
                        rType.RegionRegionId     = regType.RegionId;
                        context.Regionalunity.Add(rType);
                        context.SaveChanges();
                    }
                    selectedBusiness.RegionalUnityRegionalUnityId = rType.RegionalUnityId;
                }
            }
        }
 public AvailableObjectsController(
     IObjectService objectService
     , mydbContext context)
 {
     _objectService = objectService;
     _context       = context;
 }
 public EventLogsController(
     IEventLogService eventLogService
     , mydbContext context)
 {
     _eventLogService = eventLogService;
     _context         = context;
 }
示例#5
0
 public AccessControl(mydbContext context, IUserService userService, IAccessService accessService, IObjectService objectService, ILoggerService logger)
 {
     _context       = context;
     _userService   = userService;
     _accessService = accessService;
     _objectService = objectService;
     _logger        = logger;
 }
        public BackgroundQueueService(ILoggerFactory loggerFactory, IServiceProvider service)
        {
            this._logger = loggerFactory.CreateLogger <BackgroundQueueService>();

            var scope = service.CreateScope();

            context = scope.ServiceProvider.GetService <mydbContext>();

            InitializeRabbitMQ();
        }
 public TriggerAccessController(
     IAccessControl accessControl,
     IMapper mapper,
     mydbContext context,
     IOptions <AppSettings> appSettings)
 {
     _context       = context;
     _mapper        = mapper;
     _accessControl = accessControl;
     _appSettings   = appSettings.Value;
 }
 public TriggerController(
     IMapper mapper,
     mydbContext context,
     ITriggerService triggerService,
     IUserService userService,
     IOptions <AppSettings> appSettings)
 {
     _context        = context;
     _mapper         = mapper;
     _userService    = userService;
     _triggerService = triggerService;
     _appSettings    = appSettings.Value;
 }
        public MainViewModel()
        {
            using (mydbContext db = new mydbContext())
            {
                // получаем объекты из бд и выводим на консоль
                Users  = db.User.ToList();
                Books  = db.Book.ToList();
                Orders = db.Orders.ToList();
            }

            AddOrderCommand = new DelegateCommand(AddOrder);
            AddUserCommand  = new DelegateCommand(AddUser);
        }
示例#10
0
 private void AddSpoilers(mydbContext mydb, posts post)
 {
     foreach (SpoilersItem item in Spoilers)
     {
         spoilers spoiler = new spoilers
         {
             name    = item.name,
             content = item.content,
             posts   = post
         };
         mydb.spoilers.Add(spoiler);
     }
     mydb.SaveChanges();
 }
示例#11
0
        private void опубликоватьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int selectedRows = dataGridView_NewPost.SelectedRows[0].Index;
            // получаем значение из выделенной строки первой колонки
            string idPrepost = dataGridView_NewPost.Rows[selectedRows].Cells[0].Value.ToString();
            // то есть получаем id выделенной записи

            mydbContext mydb   = new mydbContext();
            preposts    prPost = mydb.preposts.Single(n => n.id.ToString() == idPrepost);

            Form_AddPost form_AddPost = new Form_AddPost(prPost);

            form_AddPost.FormClosed += PostList_onAfterAdd;
            form_AddPost.ShowDialog();
        }
示例#12
0
 public AccessController(
     IMapper mapper,
     mydbContext context,
     IAccessService accessService,
     IUserService userService,
     IOptions <AppSettings> appSettings,
     IMailService mailService)
 {
     _context       = context;
     _mapper        = mapper;
     _userService   = userService;
     _accessService = accessService;
     _appSettings   = appSettings.Value;
     _mailService   = mailService;
 }
示例#13
0
 private void AddUser()
 {
     try
     {
         using (mydbContext db = new mydbContext())
         {
             db.User.Add(ForAddUser);
             Users.Add(ForAddUser);
             db.SaveChanges();
             ForAddUser = new User();
         }
     }
     catch (Exception e)
     {
     }
 }
        public BindingSource Get()
        {
            BindingSource bs   = new BindingSource();
            mydbContext   mydb = new mydbContext();

            var query =
                from el in mydb.categories
                select new
            {
                el.id,
                category = el.ru_name
            };

            bs.DataSource = query.ToList();
            return(bs);
        }
示例#15
0
        public BindingSource Get()
        {
            BindingSource bs   = new BindingSource();
            mydbContext   mydb = new mydbContext();

            var query =
                from el in mydb.platforms
                select new
            {
                el.id,
                platform = el.name
            };

            bs.DataSource = query.ToList();
            return(bs);
        }
示例#16
0
文件: Program.cs 项目: gstavr/AGEMKO
        private static void Business(DataRow v)
        {
            selectedBusiness.BusinessesAgemko        = v[2].ToString();
            selectedBusiness.BusinessesAmke          = v[4].ToString();
            selectedBusiness.BusinessesVat           = v[5].ToString();
            selectedBusiness.BusinessesDescr         = v[6].ToString();
            selectedBusiness.BusinessesDistinctTitle = v[7].ToString();
            selectedBusiness.BusinessesNumMembers    = v.IsNull(8) ? default(int?) : Convert.ToInt32(v[8].ToString());
            selectedBusiness.BusinessesAddress       = v[10].ToString();
            selectedBusiness.BusinessesEmail         = v[14].ToString();
            selectedBusiness.BusinessesRegisterDate  = v.IsNull(16) ? default(DateTime?) : Convert.ToDateTime(v[16].ToString());
            selectedBusiness.BusinessesReviewDate    = v.IsNull(17) ? default(DateTime?) : Convert.ToDateTime(v[17].ToString());

            using (mydbContext context = new mydbContext())
            {
                Businesses rType = new Businesses();

                if (string.IsNullOrWhiteSpace(selectedBusiness.BusinessesVat))
                {
                    if (!string.IsNullOrWhiteSpace(selectedBusiness.BusinessesAgemko))
                    {
                        rType = context.Businesses.FirstOrDefault(x => x.BusinessesAgemko.Equals(selectedBusiness.BusinessesAgemko));
                        if (rType == default(Businesses))
                        {
                            int?maxID = context.Businesses.Count().Equals(0) ? default(int?) : context.Businesses.Max(x => x.BusinessesId);
                            selectedBusiness.BusinessesId = maxID.HasValue ? maxID.Value + 1 : 1;
                            context.Businesses.Add(selectedBusiness);
                        }
                    }
                }
                else
                {
                    rType = context.Businesses.FirstOrDefault(x => x.BusinessesVat.Equals(selectedBusiness.BusinessesVat));
                    if (rType == default(Businesses))
                    {
                        int?maxID = context.Businesses.Count().Equals(0) ? default(int?) : context.Businesses.Max(x => x.BusinessesId);
                        selectedBusiness.BusinessesId = maxID.HasValue ? maxID.Value + 1 : 1;
                        context.Businesses.Add(selectedBusiness);
                    }
                }

                rType.StatusStatusId = selectedBusiness.StatusStatusId;
                rType.RepresentativeRepresentativeId = selectedBusiness.RepresentativeRepresentativeId;

                context.SaveChanges();
            }
        }
示例#17
0
        private void AddPost(mydbContext mydb)
        {
            posts post = new posts
            {
                name        = Name,
                description = Description,
                date_public = DatePublic,
                file        = TorrentPath,
                pre_post    = PrepostID,
                program_id  = ProgramID,
                visible     = 1,
                count_view  = 0
            };

            mydb.posts.Add(post);
            mydb.SaveChanges();
        }
示例#18
0
        public static BindingSource UpdateProgramsGrid(string searchName)
        {
            mydbContext mydb  = new mydbContext();
            var         query =
                from el in mydb.programs
                where el.name.Contains(searchName)
                orderby el.name
                select new
            {
                el.id,
                el.name,
                platform = el.platforms.name
            };

            BindingSource binding = new BindingSource();

            binding.DataSource = query.ToList();
            return(binding);
        }
示例#19
0
        public void Add()
        {
            if (Name == null || Site == null || PlatformsID <= 0)
            {
                return;
            }

            mydbContext mydb     = new mydbContext();
            platforms   platform = mydb.platforms.Single(el => el.id == PlatformsID);

            programs prog = new programs
            {
                name      = Name,
                off_site  = Site,
                platforms = platform
            };

            mydb.programs.Add(prog);
            mydb.SaveChanges();
        }
示例#20
0
文件: Program.cs 项目: gstavr/AGEMKO
 private static void RegistryType(object v)
 {
     if (v != null && !string.IsNullOrWhiteSpace(v.ToString()))
     {
         using (mydbContext context = new mydbContext())
         {
             Registrytype rType = new Registrytype();
             rType = context.Registrytype.FirstOrDefault(x => x.RegistryTypeDescr.Equals(v.ToString().Trim()));
             if (rType == default(Registrytype))
             {
                 rType = new Registrytype();
                 int?maxID = context.Registrytype.Count().Equals(0) ? default(int?) : context.Registrytype.Max(x => x.RegistryTypeId);
                 rType.RegistryTypeId    = maxID.HasValue ? maxID.Value + 1 : 1;
                 rType.RegistryTypeDescr = v.ToString().Trim();
                 context.Registrytype.Add(rType);
                 context.SaveChanges();
             }
             selectedBusiness.RegistryTypeRegistryTypeId = rType.RegistryTypeId;
         }
     }
 }
示例#21
0
文件: Program.cs 项目: gstavr/AGEMKO
 private static void IndividualCategory(object v)
 {
     if (v != null && !string.IsNullOrWhiteSpace(v.ToString()))
     {
         using (mydbContext context = new mydbContext())
         {
             Individualcategory rType = new Individualcategory();
             rType = context.Individualcategory.FirstOrDefault(x => x.IndividualCategoryDescr.Equals(v.ToString().Trim()));
             if (rType == default(Individualcategory))
             {
                 rType = new Individualcategory();
                 int?maxID = context.Individualcategory.Count().Equals(0) ? default(int?) : context.Individualcategory.Max(x => x.IndividualCategoryId);
                 rType.IndividualCategoryId    = maxID.HasValue ? maxID.Value + 1 : 1;
                 rType.IndividualCategoryDescr = v.ToString().Trim();
                 context.Individualcategory.Add(rType);
                 context.SaveChanges();
             }
             selectedBusiness.IndividualCategoryIndividualCategoryId = rType.IndividualCategoryId;
         }
     }
 }
        public void Add(DataGridViewSelectedRowCollection CategorsSelected)
        {
            mydbContext mydb = new mydbContext();
            programs    prog = mydb.programs
                               .OrderByDescending(el => el.id)
                               .First();

            foreach (DataGridViewRow item in CategorsSelected)
            {
                int        idCategory = int.Parse(item.Cells[0].Value.ToString());
                categories category   = mydb.categories.Single(el => el.id == idCategory);

                program_categories program_Categories = new program_categories
                {
                    programs   = prog,
                    categories = category
                };
                mydb.program_categories.Add(program_Categories);
            }
            mydb.SaveChanges();
        }
示例#23
0
文件: Program.cs 项目: gstavr/AGEMKO
 private static void MainActivity(object v)
 {
     if (v != null && !string.IsNullOrWhiteSpace(v.ToString()))
     {
         using (mydbContext context = new mydbContext())
         {
             Mainactivity rType = new Mainactivity();
             rType = context.Mainactivity.FirstOrDefault(x => x.MainActivityDescr.Equals(v.ToString().Trim()));
             if (rType == default(Mainactivity))
             {
                 rType = new Mainactivity();
                 int?maxID = context.Mainactivity.Count().Equals(0) ? default(int?) : context.Mainactivity.Max(x => x.MainActivityId);
                 rType.MainActivityId    = maxID.HasValue ? maxID.Value + 1 : 1;
                 rType.MainActivityDescr = v.ToString().Trim();
                 context.Mainactivity.Add(rType);
                 context.SaveChanges();
             }
             selectedBusiness.MainActivityMainActivityId = rType.MainActivityId;
         }
     }
 }
示例#24
0
        public void Add()
        {
            mydbContext mydb = new mydbContext();

            AddPost(mydb);

            posts post = mydb.posts
                         .OrderByDescending(el => el.id)
                         .First();

            AddScreen(mydb, post);
            AddSpoilers(mydb, post);

            preposts prPost = mydb.preposts.Single(el => el.id == PrepostID);

            prPost.itpublic = 1;
            mydb.SaveChanges();

            Program.statusBarGlobal.Message     = "Добавление поста";
            Program.statusBarGlobal.Description = "Пост успешно добавлен.";
        }
示例#25
0
文件: Program.cs 项目: gstavr/AGEMKO
 private static void Status(object v)
 {
     if (v != null && !string.IsNullOrWhiteSpace(v.ToString()))
     {
         using (mydbContext context = new mydbContext())
         {
             Status rType = new Status();
             rType = context.Status.FirstOrDefault(x => x.StatusDescr.Equals(v.ToString().Trim()));
             if (rType == default(Status))
             {
                 rType = new Status();
                 int?maxID = context.Status.Count().Equals(0) ? default(int?) : context.Status.Max(x => x.StatusId);
                 rType.StatusId    = maxID.HasValue ? maxID.Value + 1 : 1;
                 rType.StatusDescr = v.ToString().Trim();
                 context.Status.Add(rType);
                 context.SaveChanges();
             }
             selectedBusiness.StatusStatusId = rType.StatusId;
         }
     }
 }
示例#26
0
        private void AddScreen(mydbContext mydb, posts post)
        {
            images img = new images
            {
                href  = Imgs.Poster,
                type  = "post",
                posts = post
            };

            mydb.images.Add(img);

            if (Imgs.Screens != null)
            {
                foreach (string item in Imgs.Screens)
                {
                    img = new images
                    {
                        href  = item,
                        type  = "screen",
                        posts = post
                    };
                    mydb.images.Add(img);
                }
            }

            if (Imgs.Views != null)
            {
                foreach (string item in Imgs.Views)
                {
                    img = new images
                    {
                        href  = item,
                        type  = "view",
                        posts = post
                    };
                    mydb.images.Add(img);
                }
            }
            mydb.SaveChanges();
        }
示例#27
0
        private void PostList_onAfterAdd(object sender, EventArgs e)
        {
            mydbContext mydb = new mydbContext();

            var prepostsList =
                from el in mydb.preposts
                where el.itpublic == 0
                orderby el.id descending
                select new
            {
                el.id,
                el.date,
                trackerName = el.tracker1.name,
                el.name
            };

            dataGridView_NewPost.DataSource = prepostsList
                                              .Take(MainFunc.countViewRecordPrPost)
                                              .ToList();

            var postsList =
                from el in mydb.posts
                orderby el.date_create descending
                select new
            {
                el.id,
                el.name,
                el.date_create,
                el.date_public,
                el.count_view,
                el.visible
            };

            dataGridView_PublicPost.DataSource = postsList
                                                 .Take(MainFunc.countViewRecordPost)
                                                 .ToList();
        }
示例#28
0
 public void Dispose()
 {
     _mydb = null;
 }
示例#29
0
 public TransactionRepository()
 {
     _mydb = new mydbContext();
 }
 public ComisonRepository()
 {
     _mydb = new mydbContext();
 }