Ejemplo n.º 1
0
        public async Task <ActionResult> Register(CustomViewModel model)
        {
            model.USER.EMAIL = model.RegisterViewModel.Email;

            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.RegisterViewModel.Email, Email = model.RegisterViewModel.Email
                };
                Debug.WriteLine("User: "******"Result: " + result);
                if (result.Succeeded)
                {
                    await Task.Run(() =>
                    {
                        SignInManager.SignIn(user, isPersistent: false, rememberBrowser: false);
                        model.USER.USER_ID = user.Id;
                        Debug.WriteLine("USER: "******"Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                                eve.Entry.Entity.GetType().Name, eve.Entry.State);
                                foreach (var ve in eve.ValidationErrors)
                                {
                                    Debug.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                                    ve.PropertyName, ve.ErrorMessage);
                                }
                            }
                            throw;
                        }
                    });


                    // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");


                    return(RedirectToAction("Index", "Home"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Ejemplo n.º 2
0
        public IActionResult Index(string searchString, string dep)
        {
            ViewData["CurrentFilter"] = searchString;
            List <Department> deps = deptManager.GetAll();

            deps.Insert(0, new Department {
                Id = 0, Name = "All Departments", Code = null
            });
            CustomViewModel cmView = new CustomViewModel
            {
                Employees   = empManager.GetAll(),
                Departments = deps
            };

            if (!String.IsNullOrEmpty(searchString) && dep != null)
            {
                cmView.Employees = cmView.Employees.Where(e => (e.FullName.Contains(searchString) ||
                                                                e.Code.Contains(searchString)) &&
                                                          e.DepartmentCode == dep).ToList();
            }
            else if (String.IsNullOrEmpty(searchString) && dep != null)
            {
                cmView.Employees = cmView.Employees.Where(e => e.DepartmentCode == dep).ToList();
            }
            else if (dep == null && !String.IsNullOrEmpty(searchString))
            {
                cmView.Employees = cmView.Employees.Where(e => e.FullName.Contains(searchString) ||
                                                          e.Code.Contains(searchString)).ToList();
            }
            else
            {
                cmView.Employees = cmView.Employees.ToList();
            }
            return(View(cmView));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Constructor for the custom code generator
 /// </summary>
 /// <param name="context">Context of the current code generation operation based on how scaffolder was invoked(such as selected project/folder) </param>
 /// <param name="information">Code generation information that is defined in the factory class.</param>
 public GenericRepositoryScaffold(
     CodeGenerationContext context,
     CodeGeneratorInformation information)
     : base(context, information)
 {
     _viewModel = new CustomViewModel(Context);
 }
Ejemplo n.º 4
0
        public IActionResult Create(Employee employee)
        {
            ViewBag.Error = null;
            var cmView = new CustomViewModel
            {
                Departments = deptManager.GetAll()
            };

            try
            {
                if (ModelState.IsValid)
                {
                    empManager.Create(employee);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View(cmView));
                }
            }
            catch
            {
                ViewBag.Error = "Employee with the same code already exists.";
                return(View(cmView));
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Constructor for the custom code generator
 /// </summary>
 /// <param name="context">Context of the current code generation operation based on how scaffolder was invoked(such as selected project/folder) </param>
 /// <param name="information">Code generation information that is defined in the factory class.</param>
 public CustomCodeGenerator(
     CodeGenerationContext context,
     CodeGeneratorInformation information)
     : base(context, information)
 {
     _viewModel = new CustomViewModel(Context);
 }
Ejemplo n.º 6
0
        public ActionResult Index(int pageId)
        {
            var resetCookie = Request.Cookies["PortalCMS_SSO"];

            if (!UserHelper.IsLoggedIn && resetCookie != null)
            {
                var cookieValues = resetCookie.Value.Split(',');

                var result = _loginService.SSO(Convert.ToInt32(cookieValues[0]), cookieValues[2]);

                if (result.HasValue)
                {
                    Session.Add("UserAccount", _userService.GetUser(result.Value));
                    Session.Add("UserRoles", _roleService.Get(result));
                }

                resetCookie.Expires = DateTime.Now.AddDays(-1);
                Response.Cookies.Add(resetCookie);
            }

            var model = new CustomViewModel()
            {
                Page = _pageService.View(UserHelper.UserId, pageId)
            };

            if (model.Page == null)
            {
                return(RedirectToAction("Index", "Home", new { area = "" }));
            }

            return(View("/Areas/Builder/Views/Build/Index.cshtml", model));
        }
Ejemplo n.º 7
0
            public void Setup()
            {
                Given(ClassThatImplments_ViewModelBase_is_created);
                And("another instnace of the same ViewModel is created", () =>
                    viewModel2 = new CustomViewModel());
                And(yet_another_ViewModel_is_created);
                And("dependencies are configured", () =>
                {
                    CustomViewModel.ConfigureGlobalDependencies(config =>
                    {
                        config.Bind <IBackgroundWorker>().To <CustomBackgroundWorker>().InSingletonScope();
                    });
                });

                When("Create the same type Controllers on all of the ViewModels", () =>
                {
                    viewModel.CreateController <TestController>();
                    viewModel.CreateController <AnotherController>();
                    viewModel.CreateController <YetAnotherController>();

                    viewModel2.CreateController <TestController>();
                    viewModel2.CreateController <AnotherController>();
                    viewModel2.CreateController <YetAnotherController>();

                    anotherViewModel.CreateController <TestController>();
                });
            }
        public async Task <IActionResult> Edit(int Id)
        {
            var Custom = await _customRepository.GetByIdAsync(Id);

            var customViewModel = new CustomViewModel();

            customViewModel.Id             = Custom.Id;
            customViewModel.Name           = Custom.Name;
            customViewModel.Contact_person = Custom.Contact_person;
            customViewModel.Title          = Custom.TitleId;
            customViewModel.Address        = Custom.Address;
            customViewModel.Postcode       = Custom.Postcode;
            customViewModel.Telphone       = Custom.Telphone;
            customViewModel.Fax            = Custom.Fax;

            var titles = await _titleRepository.ListAsync();

            //取得職稱資料後送到前端
            ViewBag.Titles = titles.Select(r => new SelectListItem
            {
                Text  = r.Name,
                Value = r.Id.ToString()
            });

            return(View(customViewModel));
        }
Ejemplo n.º 9
0
        public ActionResult Custom(CustomViewModel customViewModel)
        {
            customViewModel.PaymentFormHidden = false;
            var chargeOptions = new StripeChargeCreateOptions()
            {
                //required
                Amount   = 3900,
                Currency = "usd",
                Source   = new StripeSourceOptions()
                {
                    TokenId = customViewModel.StripeToken
                },

                //optional
                Description  = string.Format("JavaScript Framework Guide Ebook for {0}", customViewModel.StripeEmail),
                ReceiptEmail = customViewModel.StripeEmail
            };

            var chargeService = new StripeChargeService();

            try
            {
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

                var stripeCharge = chargeService.Create(chargeOptions);
            }
            catch (StripeException stripeException)
            {
                Debug.WriteLine(stripeException.Message);
                ModelState.AddModelError(string.Empty, stripeException.Message);
                return(View(customViewModel));
            }

            return(RedirectToAction("Confirmation"));
        }
Ejemplo n.º 10
0
        public CustomViewModel getAllVMComponentList()
        {
            var components = new CustomViewModel();

            components.MarkUpPlanList = _db.MarkUpPlans.ToList();
            return(components);
        }
Ejemplo n.º 11
0
        public async Task <ActionResult> SendSolution(int?id, HttpPostedFileBase upload)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            CustomViewModel customViewModel = await db.Customs.Include(c => c.User).FirstOrDefaultAsync(c => c.Id == id);

            if (customViewModel.ExecutorId == User.Identity.GetUserId())
            {
                if (ModelState.IsValid && upload != null)
                {
                    // получаем имя файла
                    string fileName = System.IO.Path.GetFileName(upload.FileName);
                    string path     = Server.MapPath("~/Files/" + fileName);
                    // сохраняем файл в папку Files в проекте
                    upload.SaveAs(path);
                    db.Entry(customViewModel).State = EntityState.Modified;
                    customViewModel.FilePath        = path;
                    customViewModel.Status          = CustomStatus.Check;        // заявка на проверке
                    customViewModel.AttachStatus    = AttachStatus.NotPurchased; // решение не куплено
                    await db.SaveChangesAsync();
                }
            }

            return(RedirectToAction("Details", "Custom", new { id = customViewModel.Id }));;
        }
Ejemplo n.º 12
0
        public ActionResult Search(string Search)
        {
            CustomViewModel listContainer = new CustomViewModel();
            DataManager     DataMng       = new DataManager();

            listContainer = DataMng.Search(Search);
            return(View(listContainer));
        }
Ejemplo n.º 13
0
    public CustomController(CustomViewModel viewModel)
    {
        viewModel.OnBtnClickedSignal.Action = cmd =>
        {
            Debug.Log("Button is clicked!");

            viewModel.content.Value = "点击事件被使用了";
        };
    }
Ejemplo n.º 14
0
        public ActionResult Custom()
        {
            var model = new CustomViewModel()
            {
                StripePublishableKey = stripePublishableKey, PaymentForHidden = true
            };

            return(View(model));
        }
Ejemplo n.º 15
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            CustomViewModel customViewModel = await db.Customs.FindAsync(id);

            db.Customs.Remove(customViewModel);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 16
0
        public IActionResult Create()
        {
            var cmView = new CustomViewModel
            {
                Departments = deptManager.GetAll()
            };

            return(View(cmView));
        }
Ejemplo n.º 17
0
        public ActionResult Custom()
        {
            string stripePublishableKey = ConfigurationManager.AppSettings["stripePublishableKey"];
            var    model = new CustomViewModel()
            {
                StripePublishableKey = stripePublishableKey, PaymentForHidden = true
            };

            return(View(model));
        }
Ejemplo n.º 18
0
        public CustomView()
        {
            InitializeComponent();
            var vm = new CustomViewModel();

            BindingContext   = vm;
            Add.Clicked     += (x, y) => vm.Add();
            Confirm.Clicked += (x, y) => vm.Confirm();
            Reset.Clicked   += (x, y) => vm.Reset();
        }
Ejemplo n.º 19
0
        public IActionResult OnGet()
        {
            //string stripePublishableKey = ConfigurationManager.AppSettings["Publishablekey"];
            var model = new CustomViewModel()
            {
                StripePublishableKey = stripePublishableKey, StripeEmail = HttpContext.User.Identity.Name
            };

            return(Page());
        }
Ejemplo n.º 20
0
        public IActionResult Edit(int?id)
        {
            var cmView = new CustomViewModel
            {
                Employee    = empManager.GetById(id),
                Departments = deptManager.GetAll()
            };

            return(View(cmView));
        }
        public void TestInitialize()
        {
            TokenManager.Current.Clear();

            this.accessToken = "DEF456";
            this.principal   = new GenericPrincipal(new GenericIdentity("TestUser", "Test"), new string[0]);
            this.viewModel   = new CustomViewModel()
            {
                AccessToken = this.accessToken
            };
            this.htmlHelper = TestHelper.CreateHtmlHelper(new ViewDataDictionary <CustomViewModel>(this.viewModel), this.principal);
        }
Ejemplo n.º 22
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Name,Description,AttachFilePath,AttachFile,UserId,TypeTaskId,CategoryTaskId,EndingDate,MinPrice,MaxPrice")] CustomViewModel customViewModel)
        {
            if (ModelState.IsValid)
            {
                db.Entry(customViewModel).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(customViewModel));
        }
Ejemplo n.º 23
0
        public ManualControlViewModel(Global global)
        {
            _global = global ?? throw new ArgumentNullException();

            AxisX = new AxisViewModel(this, global)
            {
                AxisIndex = 0
            };
            AxisY = new AxisViewModel(this, global)
            {
                AxisIndex = 1
            };
            AxisZ = new AxisViewModel(this, global)
            {
                AxisIndex = 2,
                HomeIsMax = true
            };
            AxisA = new AxisViewModel(this, global)
            {
                AxisIndex = 3
            };
            AxisB = new AxisViewModel(this, global)
            {
                AxisIndex = 4
            };
            AxisC = new AxisViewModel(this, global)
            {
                AxisIndex = 5
            };

            Move = new MoveViewModel(this, global);

            CommandHistory = new CommandHistoryViewModel(this, global);

            SD = new SDViewModel(this, global);

            DirectCommand = new DirectCommandViewModel(this, global);

            Shift = new ShiftViewModel(this, global);

            Tool = new ToolViewModel(this, global);

            Rotate = new RotateViewModel(this, global);

            Custom = new CustomViewModel(this, global);

            WorkOffset = new WorkOffsetViewModel(this, global);

            _global.Com.LocalCom.CommandQueueEmpty  += OnCommandQueueEmpty;
            _global.Com.RemoteCom.CommandQueueEmpty += OnCommandQueueEmpty;
        }
Ejemplo n.º 24
0
    // Start is called before the first frame update
    void Start()
    {
        var viewModel = new CustomViewModel();

        viewModel.Controller = new CustomController(viewModel);

        this.BindButtonToCommand(button, viewModel.OnBtnClickedSignal);
        this.BindInputFieldToProperty(inputField, viewModel.content);

        viewModel.content.ChangedObservable.Subscribe(content =>
        {
            Debug.Log(content);
        }).DisposeWith(viewModel);
    }
Ejemplo n.º 25
0
        public async Task SerializeAndEncodeTest()
        {
            //Arrange
            var sampleModel = new CustomViewModel
            {
                Description = "Fake description."
            };

            //Act
            var base64String = await sampleModel.SerializeAndEncode();

            //Assert
            base64String.Should().Be("eyJEZXNjcmlwdGlvbiI6IkZha2UgZGVzY3JpcHRpb24uIn0=");
        }
Ejemplo n.º 26
0
        public ManualControlViewModel()
        {
            AxisX = new AxisViewModel(this)
            {
                AxisIndex = 0
            };
            AxisY = new AxisViewModel(this)
            {
                AxisIndex = 1
            };
            AxisZ = new AxisViewModel(this)
            {
                AxisIndex = 2,
                HomeIsMax = true
            };
            AxisA = new AxisViewModel(this)
            {
                AxisIndex = 3
            };
            AxisB = new AxisViewModel(this)
            {
                AxisIndex = 4
            };
            AxisC = new AxisViewModel(this)
            {
                AxisIndex = 5
            };

            Move = new MoveViewModel(this);

            CommandHistory = new CommandHistoryViewModel(this);

            SD = new SDViewModel(this);

            DirectCommand = new DirectCommandViewModel(this);

            Shift = new ShiftViewModel(this);

            Tool = new ToolViewModel(this);

            Rotate = new RotateViewModel(this);

            Custom = new CustomViewModel(this);

            WorkOffset = new WorkOffsetViewModel(this);

            Global.Instance.Com.LocalCom.CommandQueueEmpty  += OnCommandQueueEmpty;
            Global.Instance.Com.RemoteCom.CommandQueueEmpty += OnCommandQueueEmpty;
        }
Ejemplo n.º 27
0
        public PaisesView()
        {
            InitializeComponent();

            this.txtId.Text     = "";
            this.txtNombre.Text = "";

            this.customViewModel = new CustomViewModel();

            this.ServiceConnect();

            this.SetGridSource();

            this.InitializeRowContextMenuItems();
        }
Ejemplo n.º 28
0
        public async Task SerializeToJsonStringTest()
        {
            //Arrange
            var sampleModel = new CustomViewModel
            {
                Description = "Fake description."
            };
            var expected = "{\"Description\":\"Fake description.\"}";

            //Act
            var jsonString = await sampleModel.SerializeToJsonString();

            //Assert
            jsonString.Should().Be(expected);
        }
Ejemplo n.º 29
0
        public CustomViewModel Search(string searched)
        {
            var Model = new CustomViewModel();

            if (searched.Count() > 0)
            {
                using (var db = new Ctx())
                {
                    Model.Books   = (from b in db.Books where b.Title.Contains(searched) select b).ToList();
                    Model.Authors = (from a in db.Authors where (a.Name.Contains(searched) || a.Surname.Contains(searched)) select a).ToList();
                    Model.Genres  = (from g in db.Genres where g.Name.Contains(searched) select g).ToList();
                }
            }
            return(Model);
        }
Ejemplo n.º 30
0
        public ActionResult People(string Description, int CustomViewModelId, int OfferPrice, int Days)
        {
            var comment = new CommentViewModel {
                Description = Description, OfferPrice = OfferPrice, Days = Days, UserId = User.Identity.GetUserId(), CustomViewModelId = CustomViewModelId
            };
            CustomViewModel customViewModel = db.Customs.Include(c => c.Comments).FirstOrDefault(c => c.Id == CustomViewModelId);

            if (customViewModel.Comments.Where(c => c.UserId == User.Identity.GetUserId()).Count() >= 1)
            {
                return(null);
            }
            else
            {
                db.Comments.Add(comment);
                db.SaveChanges();
                return(null);
            }
        }
Ejemplo n.º 31
0
            public void Setup()
            {
                Given(ClassThatImplments_ViewModelBase_is_created);
                And("another instnace of the same ViewModel is created", () =>
                    viewModel2 = new CustomViewModel());
                And(yet_another_ViewModel_is_created);
                And("dependencies are configured", () =>
                {
                    CustomViewModel.ConfigureGlobalDependencies(config =>
                    {
                        config.Bind<IBackgroundWorker>().To<CustomBackgroundWorker>().InSingletonScope();
                    });
                });

                When("Create the same type Controllers on all of the ViewModels", () =>
                {
                    viewModel.CreateController<TestController>();
                    viewModel.CreateController<AnotherController>();
                    viewModel.CreateController<YetAnotherController>();

                    viewModel2.CreateController<TestController>();
                    viewModel2.CreateController<AnotherController>();
                    viewModel2.CreateController<YetAnotherController>();

                    anotherViewModel.CreateController<TestController>();
                });
            }
        private void UpdateCurrentGrid()
        {
            int year = dtudSelectedYear.Value.Value.Year;

            switch (tcTratments.SelectedIndex)
            {
                case 0:
                    _dentristyViewModel = new CustomViewModel<Model.TreatmentPrice>(t => t.IsDeleted == false && t.CreatedDate.Year == year && t.Type == Utils.TREATMENT_DENTISTRY, "TreatmentKey", "asc");
                    dgDentristy.DataContext = _dentristyViewModel;
                    break;
                case 1:
                    if (tcPainClinic.SelectedIndex == 0)
                    {
                        _painClinicViewModel = new CustomViewModel<Model.TreatmentPrice>(t => t.IsDeleted == false && t.CreatedDate.Year == year && t.Type == Utils.TREATMENT_PAIN_CLINIC, "TreatmentKey", "asc");
                        dgPainClinic.DataContext = _painClinicViewModel;
                    }
                    else
                    {
                        _painClinicHIViewModel = new CustomViewModel<Model.TreatmentPrice>(t => t.IsDeleted == false && t.CreatedDate.Year == year && t.Type == Utils.TREATMENT_PAIN_CLINIC + Utils.TREATMENT_HEALTH_INSURANCE, "TreatmentKey", "asc");
                        dgPainClinicHI.DataContext = _painClinicHIViewModel;
                    }
                    break;
                case 2:
                    if (tcEndodontics.SelectedIndex == 0)
                    {
                        _endodonticsViewModel = new CustomViewModel<Model.TreatmentPrice>(t => t.IsDeleted == false && t.CreatedDate.Year == year && t.Type == Utils.TREATMENT_ENDODONTICS, "TreatmentKey", "asc");
                        dgEndodontics.DataContext = _endodonticsViewModel;
                    }
                    else
                    {
                        _endodonticsHIViewModel = new CustomViewModel<Model.TreatmentPrice>(t => t.IsDeleted == false && t.CreatedDate.Year == year && t.Type == Utils.TREATMENT_ENDODONTICS + Utils.TREATMENT_HEALTH_INSURANCE, "TreatmentKey", "asc");
                        dgEndodonticsHI.DataContext = _endodonticsHIViewModel;
                    }
                    break;
                case 3:
                    if (tcOrthodontics.SelectedIndex == 0)
                    {
                        _orthodonticsViewModel = new CustomViewModel<Model.TreatmentPrice>(t => t.IsDeleted == false && t.CreatedDate.Year == year && t.Type == Utils.TREATMENT_ORTHODONTICS, "TreatmentKey", "asc");
                        dgOrthodontics.DataContext = _orthodonticsViewModel;
                    }
                    else
                    {
                        _orthodonticsHIViewModel = new CustomViewModel<Model.TreatmentPrice>(t => t.IsDeleted == false && t.CreatedDate.Year == year && t.Type == Utils.TREATMENT_ORTHODONTICS + Utils.TREATMENT_HEALTH_INSURANCE, "TreatmentKey", "asc");
                        dgOrthodonticsHI.DataContext = _orthodonticsHIViewModel;
                    }
                    break;
                case 4:
                    if (tcCmf.SelectedIndex == 0)
                    {
                        _cmfViewModel = new CustomViewModel<Model.TreatmentPrice>(t => t.IsDeleted == false && t.CreatedDate.Year == year && t.Type == Utils.TREATMENT_CMF, "TreatmentKey", "asc");
                        dgCmf.DataContext = _cmfViewModel;
                    }
                    else
                    {
                        _cmfHIViewModel = new CustomViewModel<Model.TreatmentPrice>(t => t.IsDeleted == false && t.CreatedDate.Year == year && t.Type == Utils.TREATMENT_CMF + Utils.TREATMENT_HEALTH_INSURANCE, "TreatmentKey", "asc");
                        dgCmfHI.DataContext = _cmfHIViewModel;
                    }
                    break;
                case 5:
                    if (tcPeriodontics.SelectedIndex == 0)
                    {
                        _periodonticsViewModel = new CustomViewModel<Model.TreatmentPrice>(t => t.IsDeleted == false && t.CreatedDate.Year == year && t.Type == Utils.TREATMENT_PERIODONTICS, "TreatmentKey", "asc");
                        dgPeriodontics.DataContext = _periodonticsViewModel;
                    }
                    else
                    {
                        _periodonticsHIViewModel = new CustomViewModel<Model.TreatmentPrice>(t => t.IsDeleted == false && t.CreatedDate.Year == year && t.Type == Utils.TREATMENT_PERIODONTICS + Utils.TREATMENT_HEALTH_INSURANCE, "TreatmentKey", "asc");
                        dgPeriodonticsHI.DataContext = _periodonticsHIViewModel;
                    }
                    break;
                case 6:
                    if (tcPediatricDental.SelectedIndex == 0)
                    {
                        _pediatricDentalViewModel = new CustomViewModel<Model.TreatmentPrice>(t => t.IsDeleted == false && t.CreatedDate.Year == year && t.Type == Utils.TREATMENT_PEDIATRIC_DENTAL, "TreatmentKey", "asc");
                        dgPediatricDental.DataContext = _pediatricDentalViewModel;
                    }
                    else
                    {
                        _pediatricDentalHIViewModel = new CustomViewModel<Model.TreatmentPrice>(t => t.IsDeleted == false && t.CreatedDate.Year == year && t.Type == Utils.TREATMENT_PEDIATRIC_DENTAL + Utils.TREATMENT_HEALTH_INSURANCE, "TreatmentKey", "asc");
                        dgPediatricDentalHI.DataContext = _pediatricDentalHIViewModel;
                    }
                    break;
                default:
                    break;
            }
        }
        private void UpdateAllGrid()
        {
            int year = dtudSelectedYear.Value.Value.Year;

            List<Model.TreatmentPrice> allTreatments = BusinessController.Instance.FindBy<Model.TreatmentPrice>(t => t.IsDeleted == false && t.CreatedDate.Year == year).ToList();

            _dentristyViewModel = new CustomViewModel<Model.TreatmentPrice>(allTreatments.Where(t => t.Type == Utils.TREATMENT_DENTISTRY).ToList());

            _painClinicViewModel = new CustomViewModel<Model.TreatmentPrice>(allTreatments.Where(t => t.Type == Utils.TREATMENT_PAIN_CLINIC).ToList());
            _painClinicHIViewModel = new CustomViewModel<Model.TreatmentPrice>(allTreatments.Where(t => t.Type == Utils.TREATMENT_PAIN_CLINIC + Utils.TREATMENT_HEALTH_INSURANCE).ToList());

            _endodonticsViewModel = new CustomViewModel<Model.TreatmentPrice>(allTreatments.Where(t => t.Type == Utils.TREATMENT_ENDODONTICS).ToList());
            _endodonticsHIViewModel = new CustomViewModel<Model.TreatmentPrice>(allTreatments.Where(t => t.Type == Utils.TREATMENT_ENDODONTICS + Utils.TREATMENT_HEALTH_INSURANCE).ToList());

            _orthodonticsViewModel = new CustomViewModel<Model.TreatmentPrice>(allTreatments.Where(t => t.Type == Utils.TREATMENT_ORTHODONTICS).ToList());
            _orthodonticsHIViewModel = new CustomViewModel<Model.TreatmentPrice>(allTreatments.Where(t => t.Type == Utils.TREATMENT_ORTHODONTICS + Utils.TREATMENT_HEALTH_INSURANCE).ToList());

            _cmfViewModel = new CustomViewModel<Model.TreatmentPrice>(allTreatments.Where(t => t.Type == Utils.TREATMENT_CMF).ToList());
            _cmfHIViewModel = new CustomViewModel<Model.TreatmentPrice>(allTreatments.Where(t => t.Type == Utils.TREATMENT_CMF + Utils.TREATMENT_HEALTH_INSURANCE).ToList());

            _periodonticsViewModel = new CustomViewModel<Model.TreatmentPrice>(allTreatments.Where(t => t.Type == Utils.TREATMENT_PERIODONTICS).ToList());
            _periodonticsHIViewModel = new CustomViewModel<Model.TreatmentPrice>(allTreatments.Where(t => t.Type == Utils.TREATMENT_PERIODONTICS + Utils.TREATMENT_HEALTH_INSURANCE).ToList());

            _pediatricDentalViewModel = new CustomViewModel<Model.TreatmentPrice>(allTreatments.Where(t => t.Type == Utils.TREATMENT_PEDIATRIC_DENTAL).ToList());
            _pediatricDentalHIViewModel = new CustomViewModel<Model.TreatmentPrice>(allTreatments.Where(t => t.Type == Utils.TREATMENT_PEDIATRIC_DENTAL + Utils.TREATMENT_HEALTH_INSURANCE).ToList());

            dgDentristy.DataContext = _dentristyViewModel;

            dgPainClinic.DataContext = _painClinicViewModel;
            dgPainClinicHI.DataContext = _painClinicHIViewModel;

            dgEndodontics.DataContext = _endodonticsViewModel;
            dgEndodonticsHI.DataContext = _endodonticsHIViewModel;

            dgOrthodontics.DataContext = _orthodonticsViewModel;
            dgOrthodonticsHI.DataContext = _orthodonticsHIViewModel;

            dgCmf.DataContext = _cmfViewModel;
            dgCmfHI.DataContext = _cmfHIViewModel;

            dgPeriodontics.DataContext = _periodonticsViewModel;
            dgPeriodonticsHI.DataContext = _periodonticsHIViewModel;

            dgPediatricDental.DataContext = _pediatricDentalViewModel;
            dgPediatricDentalHI.DataContext = _pediatricDentalHIViewModel;
        }