Beispiel #1
0
        private void DeleteForm(Hospital_Entity_Framework.Account acc)
        {
            var getManagement = _db.Managements.FirstOrDefault(v => v.AccountId == acc.Id);

            if (getManagement != null)
            {
                if (getManagement.Forms != null)
                {
                    foreach (var item in getManagement.Forms.ToList())
                    {
                        if (item.Id == 6)
                        {
                            continue;
                        }
                        var getItem = _db.Forms.First(v => v.Id == item.Id);
                        getManagement.Forms.Remove(getItem);
                    }
                }
            }
            else
            {
                var insert = new Hospital_Entity_Framework.Management()
                {
                    AccountId = acc.Id
                };
                _db.Managements.Add(insert);
            }
            _db.SaveChanges();
        }
Beispiel #2
0
        public void SubmitManagement(Hospital_Entity_Framework.Account acc)
        {
            DeleteForm(acc);

            var getTemp       = _db.TempManagements;
            var getManagement = _db.Managements.First(v => v.AccountId == acc.Id);

            foreach (var itemTemp in getTemp)
            {
                if (itemTemp.Forms == "Worker's Form")
                {
                    var get = Convert.ToInt32(itemTemp.Categorys);
                    var chk = _db.Forms.First(v => v.Id == get);
                    getManagement.Forms.Add(chk);
                }
                if (itemTemp.Forms == "Patient's Form")
                {
                    var get = Convert.ToInt32(itemTemp.Categorys);
                    var chk = _db.Forms.First(v => v.Id == get);
                    getManagement.Forms.Add(chk);
                }
                if (itemTemp.Forms == "CheckIn's Form")
                {
                    var get = Convert.ToInt32(itemTemp.Categorys);
                    var chk = _db.Forms.First(v => v.Id == get);
                    getManagement.Forms.Add(chk);
                }
                if (itemTemp.Forms == "Management's Form")
                {
                    var get = Convert.ToInt32(itemTemp.Categorys);
                    var chk = _db.Forms.First(v => v.Id == get);
                    getManagement.Forms.Add(chk);
                }
                if (itemTemp.Forms == "Sample's Form")
                {
                    var get = Convert.ToInt32(itemTemp.Categorys);
                    var chk = _db.Forms.First(v => v.Id == get);
                    getManagement.Forms.Add(chk);
                }
                if (itemTemp.Forms == "Category's Form")
                {
                    var get = Convert.ToInt32(itemTemp.Categorys);
                    var chk = _db.Forms.First(v => v.Id == get);
                    getManagement.Forms.Add(chk);
                }
                if (itemTemp.Forms == "Admin's Form")
                {
                    var get = Convert.ToInt32(itemTemp.Categorys);
                    var chk = _db.Forms.First(v => v.Id == get);
                    getManagement.Forms.Add(chk);
                }
                if (itemTemp.Forms == "WaitingList's Form")
                {
                    var get = Convert.ToInt32(itemTemp.Categorys);
                    var chk = _db.Forms.First(v => v.Id == get);
                    getManagement.Forms.Add(chk);
                }
            }
            _db.SaveChanges();
        }
Beispiel #3
0
        public void DeleteManagementAndAccount(Hospital_Entity_Framework.Account acc)
        {
            DeleteCategory(acc);
            DeleteForm(acc);
            var delete = _db.Managements.First(v => v.AccountId == acc.Id);

            _db.Managements.Remove(delete);
            _db.Accounts.Remove(acc);
            _db.SaveChanges();
        }
Beispiel #4
0
        private void DeleteCategory(Hospital_Entity_Framework.Account acc)
        {
            var getManagement = _db.Managements.FirstOrDefault(v => v.AccountId == acc.Id);

            if (getManagement != null)
            {
                if (getManagement.ConsultationCategories != null)
                {
                    foreach (var item in getManagement.ConsultationCategories.ToList())
                    {
                        var getItem = _db.ConsultationCategories.FirstOrDefault(v => v.Id == item.Id);
                        getManagement.ConsultationCategories.Remove(getItem);
                    }
                }
                if (getManagement.LaboratoryCategories != null)
                {
                    foreach (var item in getManagement.LaboratoryCategories.ToList())
                    {
                        var getItem = _db.LaboratoryCategories.First(v => v.Id == item.Id);
                        getManagement.LaboratoryCategories.Remove(getItem);
                    }
                }
                if (getManagement.MedicalImagingCategories != null)
                {
                    foreach (var item in getManagement.MedicalImagingCategories.ToList())
                    {
                        var getItem = _db.MedicalImagingCategories.First(v => v.Id == item.Id);
                        getManagement.MedicalImagingCategories.Remove(getItem);
                    }
                }
                if (getManagement.PrescriptionCategories != null)
                {
                    foreach (var item in getManagement.PrescriptionCategories.ToList())
                    {
                        var getItem = _db.PrescriptionCategories.First(v => v.Id == item.Id);
                        getManagement.PrescriptionCategories.Remove(getItem);
                    }
                }
                if (getManagement.VariousDocumentCategories != null)
                {
                    foreach (var item in getManagement.VariousDocumentCategories.ToList())
                    {
                        var getItem = _db.VariousDocumentCategories.First(v => v.Id == item.Id);
                        getManagement.VariousDocumentCategories.Remove(getItem);
                    }
                }
                if (getManagement.Forms.Any(v => v.Name == "Medical's Form"))
                {
                    var getItem = _db.Forms.First(v => v.Name == "Medical's Form");
                    getManagement.Forms.Remove(getItem);
                }
                _db.SaveChanges();
            }
        }
Beispiel #5
0
        public void Insert(int workerId, string username, string password)
        {
            var check = _db.Accounts.Any(v => v.WorkerId == workerId);

            if (check)
            {
                return;
            }

            var insert = new Hospital_Entity_Framework.Account {
                WorkerId = workerId, UserName = username, Password = password
            };

            _db.Accounts.Add(insert);
            _db.SaveChanges();
        }
Beispiel #6
0
        public Hospital_Entity_Framework.Account Selection(Hospital_Entity_Framework.Worker worker)
        {
            var selection = from v in _db.Accounts
                            where v.WorkerId == worker.Id
                            select new
            {
                v.Id,
                v.WorkerId,
                v.UserName,
                v.Password
            };

            foreach (var item in selection)
            {
                var account = new Hospital_Entity_Framework.Account()
                {
                    Id = item.Id, WorkerId = item.WorkerId, UserName = item.UserName, Password = item.Password
                };
                return(account);
            }
            return(null);
        }
Beispiel #7
0
        public FlowLayoutPanel ButtonToForm(Hospital_Entity_Framework.Account account)
        {
            var flpn = new FlowLayoutPanel()
            {
                FlowDirection = FlowDirection.TopDown,
                Dock          = DockStyle.Fill,
                Name          = @"flpnButtonForm",
                AutoScroll    = true,
                WrapContents  = false
            };

            _account = account;
            var firstOrDefault = _db.Managements.FirstOrDefault(v => v.AccountId == account.Id);

            if (firstOrDefault != null)
            {
                var checkForm = firstOrDefault.Forms;

                foreach (var form in checkForm)
                {
                    var color = ColorTranslator.FromHtml("#3399FF");
                    var btn   = new Button
                    {
                        Font      = new Font("Nova Cut", 12),
                        Text      = form.Name.Remove(form.Name.Length - 7),
                        Height    = 50,
                        Width     = flpn.Width,
                        BackColor = Color.FromArgb(128, color)
                    };

                    btn.MouseHover += MouseHover;
                    btn.MouseLeave += MouseLeave;
                    btn.Click      += OpenForm;

                    flpn.Controls.Add(btn);
                }
            }
            return(flpn);
        }
Beispiel #8
0
        public void ClearCatergory(Hospital_Entity_Framework.Account acc, CategorySelection categorySelection)
        {
            var chk = _db.TempManagements.Where(v => v.Forms == "Medical's Form");

            foreach (var item in chk.Where(v => v.Services == "Consultation"))
            {
                _db.TempManagements.Remove(item);
            }
            foreach (var item in chk.Where(v => v.Services == "Laboratory"))
            {
                _db.TempManagements.Remove(item);
            }
            foreach (var item in chk.Where(v => v.Services == "MedicalImaging"))
            {
                _db.TempManagements.Remove(item);
            }
            foreach (var item in chk.Where(v => v.Services == "Prescription"))
            {
                _db.TempManagements.Remove(item);
            }
            foreach (var item in chk.Where(v => v.Services == "VariousDocument"))
            {
                _db.TempManagements.Remove(item);
            }
            _db.SaveChanges();

            categorySelection.tabCategory.Controls.Clear();
            categorySelection.Account = _account;
            categorySelection.tabCategory.Controls.AddRange(new Control[]  {
                TabConsultation(acc, categorySelection),
                TabLaboratory(acc, categorySelection),
                TabMedicalImaging(acc, categorySelection),
                TabPrescription(acc, categorySelection),
                TabVariousDocument(acc, categorySelection)
            });
        }
Beispiel #9
0
        public TabPage TabVariousDocument(Hospital_Entity_Framework.Account acc, CategorySelection categorySelection)
        {
            var tab = new TabPage()
            {
                AutoScroll = true, Text = @"VariousDocument", Name = @"VariousDocument"
            };
            var flpn = new FlowLayoutPanel()
            {
                Dock = DockStyle.Fill, AutoScroll = true
            };

            flpn.Controls.Clear();
            _categorySelection = null;
            _categorySelection = categorySelection;
            _account           = acc;

            var getTemp     = _db.TempManagements.Where(v => v.Forms == "Medical's Form").Where(v => v.Services == "VariousDocument");
            var getCategory = _db.VariousDocumentCategories;

            foreach (var itemCategory in getCategory)
            {
                if (getTemp.Any(v => v.Categorys == itemCategory.Id.ToString()))
                {
                    var dic = new Dictionary <int, string> {
                        { acc.WorkerId, "VariousDocument" }
                    };
                    var btn = new Button
                    {
                        Size      = new Size(180, 90),
                        Text      = itemCategory.Name,
                        Name      = itemCategory.Id.ToString(),
                        BackColor = Color.LimeGreen,
                        Font      = new Font("November", 12),
                        Tag       = dic
                    };

                    flpn.Controls.Add(btn);
                    btn.Click += RemoveCategory_Click;
                }
                else
                {
                    var dic = new Dictionary <int, string> {
                        { acc.WorkerId, "VariousDocument" }
                    };
                    var btn = new Button
                    {
                        Location  = new Point(3, 3),
                        Size      = new Size(180, 90),
                        Text      = itemCategory.Name,
                        Name      = itemCategory.Id.ToString(),
                        BackColor = Color.Khaki,
                        Font      = new Font("November", 12),
                        Tag       = dic
                    };

                    flpn.Controls.Add(btn);
                    btn.Click += TakeCategory_Click;
                }
            }

            tab.Controls.Add(flpn);

            return(tab);
        }
Beispiel #10
0
        public TabPage TabConsultation(Hospital_Entity_Framework.Account acc, CategorySelection categorySelection)
        {
            var tab = new TabPage()
            {
                AutoScroll = true, Text = @"Consultation", Name = @"Consultation"
            };
            var flpn = new FlowLayoutPanel()
            {
                Dock = DockStyle.Fill, AutoScroll = true
            };

            flpn.Controls.Clear();
            _categorySelection = null;
            _categorySelection = categorySelection;
            _account           = acc;

            var chkMedicalForm = _db.TempManagements.Where(v => v.WorkerId == acc.WorkerId)
                                 .Any(v => v.Forms == "Medical's Form");

            if (chkMedicalForm)
            {
                var getTemp     = _db.TempManagements.Where(v => v.Forms == "Medical's Form").Where(v => v.Services == "Consultation");
                var getCategory = _db.ConsultationCategories;
                foreach (var itemCategory in getCategory)
                {
                    if (getTemp.Any(v => v.Categorys == itemCategory.Id.ToString()))
                    {
                        var dic = new Dictionary <int, string> {
                            { acc.WorkerId, "Consultation" }
                        };
                        var btn = new Button
                        {
                            Size      = new Size(180, 90),
                            Text      = itemCategory.Name,
                            Name      = itemCategory.Id.ToString(),
                            BackColor = Color.LimeGreen,
                            Font      = new Font("November", 12),
                            Tag       = dic
                        };

                        flpn.Controls.Add(btn);
                        btn.Click += RemoveCategory_Click;
                    }
                    else
                    {
                        var dic = new Dictionary <int, string> {
                            { acc.WorkerId, "Consultation" }
                        };
                        var btn = new Button
                        {
                            Location  = new Point(3, 3),
                            Size      = new Size(180, 90),
                            Text      = itemCategory.Name,
                            Name      = itemCategory.Id.ToString(),
                            BackColor = Color.Khaki,
                            Font      = new Font("November", 12),
                            Tag       = dic
                        };

                        flpn.Controls.Add(btn);
                        btn.Click += TakeCategory_Click;
                    }
                }
            }
            else
            {
                var getManagement = _db.Managements.Any(v => v.AccountId == acc.Id);
                if (getManagement)
                {
                    var getCategoryforManagement = _db.Managements.First(v => v.AccountId == acc.Id);
                    if (getCategoryforManagement.ConsultationCategories != null)
                    {
                        foreach (var item in getCategoryforManagement.ConsultationCategories.ToList())
                        {
                            var insertTemp = new TempManagement()
                            {
                                WorkerId = acc.WorkerId, Forms = "Medical's Form", Services = "Consultation", Categorys = item.Id.ToString()
                            };
                            _db.TempManagements.Add(insertTemp);
                        }
                    }
                    if (getCategoryforManagement.LaboratoryCategories != null)
                    {
                        foreach (var item in getCategoryforManagement.LaboratoryCategories.ToList())
                        {
                            var insertTemp = new TempManagement()
                            {
                                WorkerId = acc.WorkerId, Forms = "Medical's Form", Services = "Laboratory", Categorys = item.Id.ToString()
                            };
                            _db.TempManagements.Add(insertTemp);
                        }
                    }
                    if (getCategoryforManagement.MedicalImagingCategories != null)
                    {
                        foreach (var item in getCategoryforManagement.MedicalImagingCategories.ToList())
                        {
                            var insertTemp = new TempManagement()
                            {
                                WorkerId = acc.WorkerId, Forms = "Medical's Form", Services = "MedicalImaging", Categorys = item.Id.ToString()
                            };
                            _db.TempManagements.Add(insertTemp);
                        }
                    }
                    if (getCategoryforManagement.PrescriptionCategories != null)
                    {
                        foreach (var item in getCategoryforManagement.PrescriptionCategories.ToList())
                        {
                            var insertTemp = new TempManagement()
                            {
                                WorkerId = acc.WorkerId, Forms = "Medical's Form", Services = "Prescription", Categorys = item.Id.ToString()
                            };
                            _db.TempManagements.Add(insertTemp);
                        }
                    }
                    if (getCategoryforManagement.VariousDocumentCategories != null)
                    {
                        foreach (var item in getCategoryforManagement.VariousDocumentCategories.ToList())
                        {
                            var insertTemp = new TempManagement()
                            {
                                WorkerId = acc.WorkerId, Forms = "Medical's Form", Services = "VariousDocument", Categorys = item.Id.ToString()
                            };
                            _db.TempManagements.Add(insertTemp);
                        }
                    }
                    _db.SaveChanges();

                    var getTemp     = _db.TempManagements.Where(v => v.Forms == "Medical's Form").Where(v => v.Services == "Consultation");
                    var getCategory = _db.ConsultationCategories;
                    foreach (var itemCategory in getCategory)
                    {
                        if (getTemp.Any(v => v.Categorys == itemCategory.Id.ToString()))
                        {
                            var dic = new Dictionary <int, string> {
                                { acc.WorkerId, "Consultation" }
                            };
                            var btn = new Button
                            {
                                Size      = new Size(180, 90),
                                Text      = itemCategory.Name,
                                Name      = itemCategory.Id.ToString(),
                                BackColor = Color.LimeGreen,
                                Font      = new Font("November", 12),
                                Tag       = dic
                            };

                            flpn.Controls.Add(btn);
                            btn.Click += RemoveCategory_Click;
                        }
                        else
                        {
                            var dic = new Dictionary <int, string> {
                                { acc.WorkerId, "Consultation" }
                            };
                            var btn = new Button
                            {
                                Location  = new Point(3, 3),
                                Size      = new Size(180, 90),
                                Text      = itemCategory.Name,
                                Name      = itemCategory.Id.ToString(),
                                BackColor = Color.Khaki,
                                Font      = new Font("November", 12),
                                Tag       = dic
                            };

                            flpn.Controls.Add(btn);
                            btn.Click += TakeCategory_Click;
                        }
                    }
                }
                else
                {
                    var create = new Hospital_Entity_Framework.Management()
                    {
                        AccountId = acc.Id
                    };
                    _db.Managements.Add(create);
                    _db.SaveChanges();

                    var getTemp     = _db.TempManagements.Where(v => v.Forms == "Medical's Form").Where(v => v.Services == "Consultation");
                    var getCategory = _db.ConsultationCategories;
                    foreach (var itemCategory in getCategory)
                    {
                        if (getTemp.Any(v => v.Categorys == itemCategory.Id.ToString()))
                        {
                            var dic = new Dictionary <int, string> {
                                { acc.WorkerId, "Consultation" }
                            };
                            var btn = new Button
                            {
                                Size      = new Size(180, 90),
                                Text      = itemCategory.Name,
                                Name      = itemCategory.Id.ToString(),
                                BackColor = Color.LimeGreen,
                                Font      = new Font("November", 12),
                                Tag       = dic
                            };

                            flpn.Controls.Add(btn);
                            btn.Click += RemoveCategory_Click;
                        }
                        else
                        {
                            var dic = new Dictionary <int, string> {
                                { acc.WorkerId, "Consultation" }
                            };
                            var btn = new Button
                            {
                                Location  = new Point(3, 3),
                                Size      = new Size(180, 90),
                                Text      = itemCategory.Name,
                                Name      = itemCategory.Id.ToString(),
                                BackColor = Color.Khaki,
                                Font      = new Font("November", 12),
                                Tag       = dic
                            };

                            flpn.Controls.Add(btn);
                            btn.Click += TakeCategory_Click;
                        }
                    }
                }
            }


            tab.Controls.Add(flpn);

            return(tab);
        }
Beispiel #11
0
        public void SubmitCategory(Hospital_Entity_Framework.Account acc, CategorySelection categorySelection)
        {
            DeleteCategory(acc);

            var getTemp       = _db.TempManagements.Where(v => v.WorkerId == acc.WorkerId && v.Forms == "Medical's Form");
            var getManagement = _db.Managements.First(v => v.AccountId == acc.Id);
            var getItem       = _db.Forms.First(v => v.Name == "Medical's Form");

            getManagement.Forms.Add(getItem);
            foreach (var itemTemp in getTemp)
            {
                if (itemTemp.Services == "Consultation")
                {
                    var get = Convert.ToInt32(itemTemp.Categorys);
                    var chk = _db.ConsultationCategories.First(v => v.Id == get);
                    getManagement.ConsultationCategories.Add(chk);
                }
                if (itemTemp.Services == "Laboratory")
                {
                    var get = Convert.ToInt32(itemTemp.Categorys);
                    var chk = _db.LaboratoryCategories.First(v => v.Id == get);
                    getManagement.LaboratoryCategories.Add(chk);
                }
                if (itemTemp.Services == "MedicalImaging")
                {
                    var get = Convert.ToInt32(itemTemp.Categorys);
                    var chk = _db.MedicalImagingCategories.First(v => v.Id == get);
                    getManagement.MedicalImagingCategories.Add(chk);
                }
                if (itemTemp.Services == "Prescription")
                {
                    var get = Convert.ToInt32(itemTemp.Categorys);
                    var chk = _db.PrescriptionCategories.First(v => v.Id == get);
                    getManagement.PrescriptionCategories.Add(chk);
                }
                if (itemTemp.Services == "VariousDocument")
                {
                    var get = Convert.ToInt32(itemTemp.Categorys);
                    var chk = _db.VariousDocumentCategories.First(v => v.Id == get);
                    getManagement.VariousDocumentCategories.Add(chk);
                }
                if (itemTemp.Services == "Medical's Form")
                {
                    var get = Convert.ToInt32(itemTemp.Categorys);
                    var chk = _db.Forms.First(v => v.Id == get);
                    getManagement.Forms.Add(chk);
                }
            }
            _db.SaveChanges();

            categorySelection.tabCategory.Controls.Clear();
            categorySelection.Account = _account;
            categorySelection.tabCategory.Controls.AddRange(new Control[]  {
                TabConsultation(acc, categorySelection),
                TabLaboratory(acc, categorySelection),
                TabMedicalImaging(acc, categorySelection),
                TabPrescription(acc, categorySelection),
                TabVariousDocument(acc, categorySelection)
            });
            categorySelection.tabCategory.Enabled = false;
            categorySelection.tabCategory.SelectTab("Consultation");
            categorySelection.tabCategory.Enabled = true;
        }