Example #1
0
        public static TRepository Create <TRepository>(ContextTypes ctype) where TRepository : class
        {
            switch (ctype)
            {
            case ContextTypes.EntityFramework:
                if (typeof(TRepository) == typeof(IKsiazkaRepository))
                {
                    return(new KsiazkaEFRepository() as TRepository);
                }
                else if (typeof(TRepository) == typeof(IRozdzialRepository))
                {
                    return(new RozdzialEFRepository() as TRepository);
                }
                return(null);

            case ContextTypes.XMLSource:
                if (typeof(TRepository) == typeof(IKsiazkaRepository))
                {
                    return(new KsiazkaXMLRepository() as TRepository);
                }
                else if (typeof(TRepository) == typeof(IRozdzialRepository))
                {
                    return(new RozdzialXMLRepository() as TRepository);
                }
                return(null);

            default:
                return(null);
            }
        }
Example #2
0
        public static TRepository Create <TRepository>(ContextTypes ctype) where TRepository : class
        {
            switch (ctype)
            {
            case ContextTypes.EntityFramework:
                var a = Activator.CreateInstance <TRepository>();
                if (a != null)
                {
                    return(a);
                }
                //if (typeof(TRepository) == typeof(IStudentRepository))
                //{
                //    return new StudentEFRepository() as TRepository;
                //}
                return(null);

            case ContextTypes.XMLSource:
                if (typeof(TRepository) == typeof(IStudentRepository))
                {
                    //return new StudentXMLRepository() as TRepository;
                }
                return(null);

            default:
                return(null);
            }
        }
Example #3
0
        public static TRepository Create <TRepository>(ContextTypes ctype) where TRepository : class
        {
            switch (ctype)
            {
            case ContextTypes.EntityFrameworkSource:
                if (typeof(TRepository) == typeof(IPhoneBookRepository))
                {
                    return(new PhonebookRepository() as TRepository);
                }
                else if (typeof(TRepository) == typeof(IEntryRepository))
                {
                    return(new EntryRepository() as TRepository);
                }
                return(null);

            case ContextTypes.XmlSource:
                if (typeof(TRepository) == typeof(IEntryRepository))
                {
                    return(new EntryRepository() as TRepository);
                }
                else if (typeof(TRepository) == typeof(IPhoneBookRepository))
                {
                    return(new PhonebookRepository() as TRepository);
                }
                return(null);

            default:
                return(null);
            }
        }
Example #4
0
 public static TRepository Create <TRepository>(ContextTypes ctype) where TRepository : class
 {
     if (typeof(TRepository) == typeof(IStudentRepository))
     {
         return(new StudentXMLRepository() as TRepository);
     }
     return(null);
 }
Example #5
0
        public AccountRepository(ContextTypes type)
        {
            switch (type)
            {
            case ContextTypes.MemoryContext: context = new AccountMemoryContext(); break;

            case ContextTypes.MSSQLContext: context = new AccountContext(); break;
            }
        }
Example #6
0
        public StarrRepository(ContextTypes type)
        {
            switch (type)
            {
            case ContextTypes.MemoryContext: context = new StarrMemoryContext(); break;

            case ContextTypes.MSSQLContext: context = new StarrContext(); break;
            }
        }
 public Context(ContextTypes contextType = ContextTypes.Text, string tag = null, Context parent = null)
 {
     this.Type   = contextType;
     this.Tag    = tag;
     this.Parent = parent;
     if (parent != null)
     {
         this.Level = parent.Level;
     }
 }
 private void PopTo(ContextTypes contextType, string tag = null)
 {
     while (_contextStack.Count > 0 && !IsContext(contextType, tag))
     {
         Pop();
     }
     if (IsContext(contextType, tag))
     {
         Pop();//pop the actual open tag context
     }
 }
Example #9
0
        public AttackContext()
        {
            ContextName = "Any";
            ParserValue = string.Empty;
            Weight      = 0;

            AttackOriginType       = ContextTypes.Any;
            AttackOriginCustomType = string.Empty;
            AttackTargetType       = ContextTypes.Any;
            AttackTargetCustomType = string.Empty;
            Animations             = new AttackAnimations();
        }
Example #10
0
        public AttackContext(BinaryReader BR)
        {
            ContextName = BR.ReadString();
            ParserValue = BR.ReadString();
            Weight      = BR.ReadInt32();

            AttackOriginType       = (ContextTypes)BR.ReadByte();
            AttackOriginCustomType = BR.ReadString();
            AttackTargetType       = (ContextTypes)BR.ReadByte();
            AttackTargetCustomType = BR.ReadString();

            Animations = new AttackAnimations();
            Animations.Load(BR);
        }
Example #11
0
        static EF7DataContext()
        {
            var t = typeof(TEntity);

            EntityType = EntityTypes.FirstOrDefault(x => x.Name == (t.Name.Substring(1)));
            ctxType    = ContextTypes.FirstOrDefault(x => x.BaseType != null && x.BaseType.Name.Contains("DbContext"));
            if (EntityType == null)
            {
                throw new InvalidOperationException("DataType Is not Found");
            }
            if (ctxType == null)
            {
                throw new InvalidOperationException("DBContext Is not Found");
            }
        }
Example #12
0
 public void Send()
 {
     using (var context = new ContextTypes())
     {
         MailAddress from    = new MailAddress(textBoxSendFrom.Text);
         MailAddress to      = new MailAddress(textBoxSendTo.Text);
         MailMessage message = new MailMessage(from, to);
         message.Subject    = textBoxSendMessage.Text;
         message.IsBodyHtml = true;
         SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
         smtp.Credentials = new NetworkCredential("*****@*****.**", "mawimovnauryzbai1994");
         smtp.EnableSsl   = true;
         smtp.Send(message);
     }
 }
Example #13
0
        static EntityViewDataContext()
        {
            var bt = typeof(TEntityView).GetInterfaces().FirstOrDefault(x => x.Name.Contains("IEntityView"));

            TEntity    = bt.GetGenericArguments().First();
            EntityType = EntityTypes.FirstOrDefault(x => x.Name == (TEntity.Name.Substring(1)));

            ViewType = EntityTypes.FirstOrDefault(x => x.Name == (typeof(TEntityView).Name.Substring(1)));
            ctxType  = ContextTypes.FirstOrDefault(x => x.BaseType != null && x.BaseType.Name.Contains("DbContext"));

            if (ViewType == null)
            {
                throw new InvalidOperationException("ViewType Is not Found");
            }
            if (ctxType == null)
            {
                throw new InvalidOperationException("DBContext Is not Found");
            }
        }
Example #14
0
 public void Move()
 {
     using (var context = new ContextTypes())
     {
         try
         {
             string filePath = System.IO.Path.Combine(textBoxMoveFirst.Text);
             string query    = "Действительно переместить файл \n" + filePath + " ?";
             if (MessageBox.Show(query, "Переместить файл?", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
             {
                 File.Move(filePath, textBoxMoveSecond.Text);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Не удается переместить файл из-за исключения: " + ex.Message);
         }
     }
 }
Example #15
0
        private async void ButtonDownloadClick(object sender, RoutedEventArgs e)
        {
            hour   = textBlockHour.Text;
            minute = textBlockMinute.Text;
            time   = hour + minute;
            Thread thread = new Thread(ShowDate);

            using (var context = new ContextTypes())
            {
                downLoad = new DownLoadInformation
                {
                    UrlAddress = textBoxDownload.Text,
                    FileName   = textBoxDownloadName.Text,
                    Data       = datePiker.SelectedDate.Value,
                    Time       = time
                };
                context.DownLoad.Add(downLoad);
                await context.SaveChangesAsync();
            }
        }
Example #16
0
        private async void ButtonMoveClick(object sender, RoutedEventArgs e)
        {
            hour   = textBlockHour.Text;
            minute = textBlockMinute.Text;
            time   = hour + minute;
            Thread thread = new Thread(ShowDate);

            using (var context = new ContextTypes())
            {
                move = new MoveInformation
                {
                    PathFrom = System.IO.Path.Combine(textBoxMoveFirst.Text),
                    PathTo   = textBoxMoveSecond.Text,
                    Data     = datePiker.SelectedDate.Value,
                    Time     = time
                };
                context.Moving.Add(move);
                await context.SaveChangesAsync();
            }
        }
Example #17
0
        private async void ButtonClickToSend(object sender, RoutedEventArgs e)
        {
            hour   = textBlockHour.Text;
            minute = textBlockMinute.Text;
            time   = hour + minute;
            Thread thread = new Thread(ShowDate);

            using (var context = new ContextTypes())
            {
                email = new SendEmailInformation
                {
                    NameFrom = textBoxSendFrom.Text,
                    NameTo   = textBoxSendTo.Text,
                    Text     = textBoxSendMessage.Text,
                    Data     = datePiker.SelectedDate.Value,
                    Time     = time
                };
                context.SendEmail.Add(email);
                await context.SaveChangesAsync();
            }
        }
Example #18
0
        public SimplifiedSchema GetSchemaFromContext(ContextTypes contextType, string context)
        {
            SimplifiedSchemaObject foundObject = null;

            if (contextType == ContextTypes.ComplexType)
            {
                foundObject = GetFromComplexType(context);
            }
            else if (contextType == ContextTypes.XPath)
            {
                foundObject = GetFromXpath(context);
            }

            if (foundObject != null)
            {
                SimplifiedSchema schema = new SimplifiedSchema();
                schema.Children.Add(foundObject);
                return(schema);
            }

            return(null);
        }
 private void OpenListItem(int level, ContextTypes listType)
 {
     if (!IsListContext(_context))
     {
         Push(ContextTypes.List);
         _context.Level = 0;
     }
     if (_context.Level < level)
     {
         while (_context.Level < level)
         {
             Push(listType, listType == ContextTypes.UnorderedList ? "ul" : "ol");
             _context.Level++;
             Push(ContextTypes.ListItem, "li");
         }
         return;
     }
     else if (_context.Level > level)
     {
         while (_context.Level > level)
         {
             CloseList();
         }
     }
     if (_context.Type == ContextTypes.ListItem)
     {
         Pop("li");
     }
     if (_context.Type != listType)
     {
         CloseList();
         Push(listType, listType == ContextTypes.UnorderedList?"ul":"ol");
         _context.Level = level;
     }
     Push(ContextTypes.ListItem, "li");
 }
Example #20
0
 public static class RepositoryFactory { public static TRepository Create <TRepository>(ContextTypes ctype) where TRepository : class
                                         {
                                             if (typeof(TRepository) == typeof(ITraineeRepository))
                                             {
                                                 return(new TraineeXMLRepository() as TRepository);
                                             }
                                             return(null);
                                         }
Example #21
0
 public InjectionArgument(object value, ContextTypes contextType)
 {
     Value       = value;
     ContextType = contextType;
 }
 private void Push(ContextTypes contextType = ContextTypes.Text, string tag = null)
 {
     _contextStack.Push(_context);
     _context = new Context(contextType, tag, _context);
 }
Example #23
0
 public void Dispose()
 {
     filter    = ContextTypes.None;
     arguments = null;
     Reset();
 }
Example #24
0
 public static IBinding WhenInto(this IBindingCondition condition, ContextTypes type)
 {
     return(condition.When(context => context.Type.Contains(type)));
 }
Example #25
0
 public Enumerator(InjectionArgument[] arguments, ContextTypes filter) : this()
 {
     this.arguments = arguments;
     this.filter    = filter;
     currentIndex   = arguments.Length;
 }
 public static bool Contains(this ContextTypes contextType, ContextTypes other)
 {
     return (contextType & other) == other;
 }
 public static IBinding WhenInto(this IBindingCondition condition, ContextTypes type)
 {
     return condition.When(context => context.Type.Contains(type));
 }
 private bool IsContext(ContextTypes contextType, string tag = null)
 {
     return(_context.Type == contextType && string.Equals(_context.Tag, tag, StringComparison.InvariantCultureIgnoreCase));
 }
        public static TRepository Create <TRepository>(ContextTypes ctype) where TRepository : class
        {
            switch (ctype)
            {
            case ContextTypes.EntityFramework:
                if (typeof(TRepository) == typeof(IClientDetailRepository))
                {
                    return(new ClientDetailRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(IFacilityRepository))
                {
                    return(new FacilityRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(IDiseaseRepository))
                {
                    return(new DiseaseRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(IEmergencyContactRepository))
                {
                    return(new EmergencyContactRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(IMedicalInformationRepository))
                {
                    return(new MedicalInformationRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(ICountryCodeRepository))
                {
                    return(new CountryCodeRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(ICityRepository))
                {
                    return(new CityRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(IStateRepository))
                {
                    return(new StateRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(IInsuranceInformationRepository))
                {
                    return(new InsuranceInformationRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(IQuickHealthRepository))
                {
                    return(new QuickHealthRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(IHospitalDetailsRepository))
                {
                    return(new HospitalDetailsRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(IQuickUploadRepository))
                {
                    return(new QuickUploadRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(ICountryRepository))
                {
                    return(new CountryRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(IDoctorRepository))
                {
                    return(new DoctorRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(ISecretaryRepository))
                {
                    return(new SecretaryRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(IFeedbackRepository))
                {
                    return(new FeedbackRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(IAppointmentRepository))
                {
                    return(new AppointmentRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(IAppointmentRepository))
                {
                    return(new AppointmentRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(ITblHospitalAmenitiesRepository))
                {
                    return(new TblHospitalAmenitiesRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(ITblHospitalServicesRepository))
                {
                    return(new TblHospitalServicesRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(ITblHospitalSpecialtiesRepository))
                {
                    return(new TblHospitalSpecialtiesRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(IQuickUploadRepository))
                {
                    return(new QuickUploadRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(IDoctorAvailableTimeRepository))
                {
                    return(new DoctorAvailableTimeRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(IContactUsRepository))
                {
                    return(new ContactUsRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(ITimeMasterRepository))
                {
                    return(new TimeMasterRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(IPatientPrescriptionRepository))
                {
                    return(new PatientPrescriptionRepository() as TRepository);
                }
                if (typeof(TRepository) == typeof(INewsBlogsRepository))
                {
                    return(new NewsBlogsRepository() as TRepository);
                }

                return(null);

            default:
                return(null);
            }
        }
Example #30
0
 public static bool Contains(this ContextTypes contextType, ContextTypes other)
 {
     return((contextType & other) == other);
 }