Example #1
0
 public WindowNewSection(WorkSection section)
 {
     InitializeComponent();
     this.section = section;
     DataContext  = section;
     TypeWork.DisplayMemberPath = "Name";
     SetValues();
     //if (section.Id != null)
     //{
     using (var db = new SmetaDbAppContext())
     {
         int i = 0;
         foreach (var ob in db.WorkTypes)
         {
             if (ob.Id == section.WorkTypeId)
             {
                 break;
             }
             i++;
         }
         TypeWork.SelectedIndex = i;
     }
     PlaceWork.SelectedItem = Constants.Constants.GetPlaceWork()[(int)section.WorkTypeId];
     //}
 }
 public WorkSectionView(WorkSection workSection)
 {
     this.WorkSection = workSection;
     using (var db = new DbContexts.SmetaDbAppContext())
     {
         book = db.WorkTypes.Where(x => x.Id == WorkSection.WorkTypeId).Single().Name;
     }
     place = Helper.getName(WorkSection.Place);
 }
Example #3
0
        public WorkContext(Work Work)
        {
            this.Work        = Work;
            TeamContexts     = new ObservableCollection <TeamContext>();
            MaterailContexts = new ObservableCollection <MaterialContext>();
            PriborContexts   = new ObservableCollection <PriborContext>();

            WorkSections = new ObservableCollection <WorkSection>();

            using (var db = new DbContexts.SmetaDbAppContext())
            {
                db.WorkTeams.Where(x => x.WorkDemId == Work.Id).ToList().ForEach(x =>
                {
                    TeamContexts.Add(new TeamContext(x));
                });

                List <Material> materials = db.Materials;

                // WOrk types
                WorkTypes        = db.WorkTypes;
                selectedWorkType = WorkTypes.Where(x => x.Id ==
                                                   (db.WorkSections.Where(y => y.Id == Work.WorkSectionId)).FirstOrDefault().WorkTypeId).FirstOrDefault();

                //Work sections
                db.WorkSections.Where(x => x.WorkTypeId == selectedWorkType.Id).ToList().ForEach(x =>
                {
                    WorkSections.Add(x);
                });
                selectedSection = WorkSections.Where(x => x.Id == Work.WorkSectionId).FirstOrDefault();

                // Fill Materials
                db.MaterialGroups.Where(x => x.WorkId == Work.Id).ToList().ForEach(x =>
                {
                    var item      = new MaterialContext(x);
                    item.Material = materials.Where(y => y.Id == x.MaterialId).FirstOrDefault();

                    MaterailContexts.Add(item);
                });
                List <Pribor> pribors = db.Pribors;
                //Fill Pribors
                db.PriborGroups.Where(x => x.WorkId == Work.Id).ToList().ForEach(x =>
                {
                    var item    = new PriborContext(x);
                    item.Pribor = pribors.Where(y => y.Id == x.PriborId).FirstOrDefault();

                    PriborContexts.Add(item);
                });
            }
        }
Example #4
0
 public ContextWorkSection()
 {
     pol = false;
     kam = false;
     lab = false;
     using (var db = new DbContexts.SmetaDbAppContext())
     {
         WorkTypes = db.WorkTypes;
         if (WorkTypes.Count > 0)
         {
             selectedWorkType = WorkTypes[0];
         }
     }
     WorkSection = new WorkSection();
     Comentaries = new ObservableCollection <Commentary>();
 }
        public static void Init(string sectionType)
        {
            if (sectionType == "groupSection")
            {
                WorkSection groupSection = (WorkSection)ConfigurationManager.GetSection("sntConfig/workGroups");

                workGroups = new Dictionary <string, WorkGroupElement>();
                for (int i = 0; i < groupSection.WorkGroups.Count; i++)
                {
                    WorkGroupElement element = groupSection.WorkGroups[i];
                    workGroups.Add(element.Type, element);
                }
            }
            if (sectionType == "taskSection")
            {
                TaskSection taskSection = (TaskSection)ConfigurationManager.GetSection("sntConfig/taskParameters");
                taskParameters = new Dictionary <string, TaskParameterElement>();
                for (int i = 0; i < taskSection.TaskParameters.Count; i++)
                {
                    TaskParameterElement element = taskSection.TaskParameters[i];
                    taskParameters.Add(element.Type, element);
                }
            }
        }