Esempio n. 1
0
 //constructors
 public BlPatient()
 {
     this.MyModuleName = "Patients";
     MyModuleObj       = new blModule(MyModuleName);
     MyActiveModule    = MyModuleObj.ActiveModule();
     this.db           = new AppDbContext();
 }
        public void LoadData(int MuduleID)
        {
            dhModule objMod = new dhModule();

            objMod.IModuleID = MuduleID;
            //          if (objUser != null)
            //       {
            //#region "Allowed Menu"
            objMod.AllowdModule    = Globalized.objAppPreference.VEnableModules;
            objMod.IModuleParentID = 0;
            dsGeneral.dtPosModuleDataTable  dtm      = iFacede.GetModule(Globalized.ObjDbName, objMod);
            ObservableCollection <dhModule> sequence = ReflectionUtility.DataTableToObservableCollection <dhModule>(dtm);

            if (sequence.Count > 0)
            {
                objModule = sequence[0];
                if ((objModule.VIconName == null) || (objModule.VIconName == ""))
                {
                    this.Img1.Source = new BitmapImage(new Uri("/SublimeCareCloud;component/images/DumyIcon.png", UriKind.Relative));
                }
                else
                {
                    BitmapImage image = new BitmapImage(new Uri("/SublimeCareCloud;component/Images/" + objModule.VIconName, UriKind.Relative));
                    this.Img1.Source = image;
                }
            }
        }
Esempio n. 3
0
        private void GetAllowdModule()
        {
            List <dhModule> ObjLIst = new List <dhModule>();
            List <CheckBox> obj     = new List <CheckBox>();

            getChildListofType <CheckBox>(RightsGrid, obj);

            string Ids = null;

            foreach (CheckBox cb in obj)
            {
                dhModule objModule = (dhModule)cb.Tag;
                ObjLIst.Add(objModule);
                if (objModule.BIsActive == true)
                {
                    if (Ids == null)
                    {
                        Ids = objModule.IModuleID.ToString();
                    }
                    else
                    {
                        Ids = Ids + "," + objModule.IModuleID.ToString();
                    }
                }
                objModule.UriKind = "Relative";
                objModule.IUpdate = 1;
                DataSet ds = iFacede.InsertUpdateModule(Globalized.ObjDbName, objModule);
            }
            vEnableModulesTextBox.Text = "";
            this.GlobalObjPreference.VEnableModules = null;
            this.GlobalObjPreference.VEnableModules = Ids;

            //    VAllowdModule.Text = Ids;
        }
Esempio n. 4
0
        internal ObservableCollection <dhModule> GetUserSubMenu(dhDBnames objDBNames, dhAppPreference objAppPreference, dhUsers objuser, dhModule objdhModule)
        {
            DataTable temp        = new DataTable();
            blModule  ObjblModule = new blModule();
            dhModule  objModule   = new dhModule();
            ObservableCollection <dhModule> MenuModule = new ObservableCollection <dhModule>();

            if ((objAppPreference != null) && (objAppPreference.VEnableModules != "") && (objuser != null))
            {
                #region "Allowed Menu"

                objModule.AllowdModule = objAppPreference.VEnableModules;
                dsGeneral.dtPosModuleDataTable dtm = ObjblModule.GetModule(objDBNames, objModule);
                EnumerableRowCollection <dsGeneral.dtPosModuleRow> result2 = from r in dtm.AsEnumerable()
                                                                             where (r.Field <int>("iModuleParentID") == objdhModule.IModuleID) && (r.Field <bool>("bIsActive") == true)
                                                                             select r;
                // if there are any allowed
                int CountRow = result2.Count <dsGeneral.dtPosModuleRow>();
                if (CountRow > 0)
                {
                    DataTable dtResult2 = result2.CopyToDataTable();
                    ObservableCollection <dhModule> sequence = ReflectionUtility.DataTableToObservableCollection <dhModule>(dtResult2);
                    if (sequence.Count > 0)
                    {
                        foreach (dhModule Module in sequence)
                        {
                            string strDisplayName = Module.VDisplayName;
                            if (objuser.VAllowdModule == null)
                            {
                                if (objuser.VUserType == "Super")
                                {
                                    objuser.VAllowdModule = objAppPreference.VEnableModules;
                                }
                                else
                                {
                                    throw new ApplicationException("Disable User or have no rights.");
                                }
                            }

                            List <string> RootIds          = objuser.VAllowdModule.Split(',').ToList <string>();
                            string        RootAllowdUserID = RootIds.Distinct <string>().Cast <string>().Where(i => i.Equals(Module.IModuleID.ToString())).SingleOrDefault();

                            List <string> RootEnableModulesIds   = objAppPreference.VEnableModules.Split(',').ToList <string>();
                            string        RootAppEnableModulesId = RootEnableModulesIds.Distinct <string>().Cast <string>().Where(i => i.Equals(Module.IModuleID.ToString())).SingleOrDefault();
                            if ((RootAllowdUserID == null) || (RootAppEnableModulesId == null))
                            {
                                continue;
                            }
                            MenuModule.Add(Module);
                        }
                    }// end of dhModule sequence
                }



                #endregion
            }
            return(MenuModule);
        }
Esempio n. 5
0
        public dsGeneral.dtPosModuleDataTable GetModule(dhDBnames objDBNames, dhModule ObjModule)
        {
            dsGeneral ds       = new dsGeneral();
            DataSet   dsreturn = objDatabase.GetDataSet(objDBNames, ObjModule, "xmlGetModule", (DataSet)ds, "dtPosModule");

            dsGeneral.dtPosModuleDataTable retdt = ((dsGeneral)dsreturn).dtPosModule;
            return(retdt);
        }
Esempio n. 6
0
        internal static ObservableCollection <dhModule> LoadSubMenus(dhModule objdhModule)
        {
            ObservableCollection <dhModule> dtMenu = iFacede.GetUserSubMenu(Globalized.ObjDbName, Globalized.objAppPreference, Globalized.ObjCurrentUser, objdhModule);

            //  throw new NotImplementedException();

            return(dtMenu);
        }
Esempio n. 7
0
 public blAccount()
 {
     objDALGeneral     = new dalGeneral();
     this.MyModuleName = "Account";
     MyModuleObj       = new blModule(MyModuleName);
     MyActiveModule    = MyModuleObj.ActiveModule();
     this.db           = new AppDbContext();
 }
        public dhAccount InsertUpdateAccount(dhDoctors ObjDoctor)
        {
            //   Boolean ObjReturn =  false;
            dhAccount ObjAccount = new dhAccount();
            dhModule  objModule  = this.db.Modules.AsNoTracking().Where(x => x.VModuleName == "Doctors").First();

            if (objModule != null)
            {
                if (db.Accounts.Count() == 0)
                {
                    ObjAccount = new dhAccount();
                    ObjAccount.IModuleFK_ID     = ObjDoctor.IDocid;
                    ObjAccount.IModuleID        = objModule.IModuleID;
                    ObjAccount.AccountName      = ObjDoctor.VfName + " " + ObjDoctor.VlName;
                    ObjAccount.VAccountDesc     = BL.MsgTextCollection.MsgsList.Where(xx => xx.Key == "M_D01DEC").FirstOrDefault().Value;
                    ObjAccount.VAccountComments = BL.MsgTextCollection.MsgsList.Where(xx => xx.Key == "M_D02DEC").FirstOrDefault().Value;
                    ObjAccount.VAccountNo       = "D-" + DateTime.Now.ToString("ddmmyy") + "-" + ObjDoctor.IDocid; // D-For DOC and  DMY  - Day month year and Doc Id
                    ObjAccount.IFinaceType      = 3;
                    ObjAccount.BNominal         = false;
                    ObjAccount.BEditable        = false;

                    // db.Accounts.Add(ObjAccount);
                    return(ObjAccount);
                }

                ObjAccount = db.Accounts.Where(x => x.IModuleID == objModule.IModuleID && x.IModuleFK_ID == ObjDoctor.IDocid).FirstOrDefault();
                if (ObjAccount == null)
                {
                    ObjAccount = new dhAccount();
                    // create the account
                    ObjAccount.IModuleFK_ID     = ObjDoctor.IDocid;
                    ObjAccount.IModuleID        = objModule.IModuleID;
                    ObjAccount.AccountName      = ObjDoctor.VfName + " " + ObjDoctor.VlName;
                    ObjAccount.VAccountDesc     = BL.MsgTextCollection.MsgsList.Where(xx => xx.Key == "M_D01DEC").FirstOrDefault().Value;
                    ObjAccount.VAccountComments = BL.MsgTextCollection.MsgsList.Where(xx => xx.Key == "M_D02DEC").FirstOrDefault().Value;
                    ObjAccount.VAccountNo       = "D-" + DateTime.Now.ToString("ddMMyy") + "-" + ObjDoctor.IDocid; // D-For DOC and  DMY  - Day month year and Doc Id
                    ObjAccount.IFinaceType      = 3;
                    ObjAccount.BNominal         = false;
                    ObjAccount.BEditable        = false;
                    return(ObjAccount);
                    //  db.Accounts.Add(ObjAccount);
                }
                else
                {
                    // update existing acccount account title if needed
                    ObjAccount.AccountName = ObjDoctor.VfName + " " + ObjDoctor.VlName;
                }
            }
            return(ObjAccount);
            //    return ObjReturn;
        }
Esempio n. 9
0
        public static dsGeneral.dtPosModuleDataTable GetModule(dhDBnames objDBNames, dhModule ObjModule)
        {
            try
            {
                dsGeneral.dtPosModuleDataTable var_ret;

                if (ObjBlModule == null)
                {
                    ObjBlModule = new blModule();
                }
                var_ret = ObjBlModule.GetModule(objDBNames, ObjModule);

                return(var_ret);
            }
            catch (Exception ex) { throw ex; }
        }
Esempio n. 10
0
        public static DataSet InsertUpdateModule(dhDBnames objDBNames, dhModule ObjModule)
        {
            try
            {
                DataSet var_ret;

                if (ObjBlModule == null)
                {
                    ObjBlModule = new blModule();
                }
                var_ret = ObjBlModule.InsertUpdateModule(objDBNames, ObjModule);

                return(var_ret);
            }
            catch (Exception ex) { throw ex; }
        }
        public AddDoctorsViewModel(dhDoctors objTodisplay)
        {
            // load the moduel
            this.MyModuel = this.ActiveModule(MyName);

            this.ObjNewDoctor = objTodisplay;
            this.ObjNewDoctor.Specialization    = this.db.Specialization.AsNoTracking().Where(X => X.bIsActive == true).ToObservableCollection();
            this.ObjNewDoctor.Investigations    = this.db.Investigations.AsNoTracking().Where(i => i.bIsActive == true).ToObservableCollection();
            this.ObjNewDoctor.DocInvestigations = GetActiveDocInvestigations();

            // load the DocProcedures and Procedures
            this.ObjNewDoctor.Procedures = this.db.Procedures.AsNoTracking().Where(x => x.BIsActive == true).ToObservableCollection();

            //    this.ObjNewDoctor.DocProcedures = this.db.DocProcedures.Where(x => x.BIsActive == true && x.IDocid == this.ObjNewDoctor.IDocid).ToObservableCollection();
            this.ObjNewDoctor.DocProcedures = GetDocProcedures();
            DoctorAccount = GetDocAccount();
        }
Esempio n. 12
0
 public void CreateMenuItems(dhUsers objdhUsers = null)
 {
     if (objdhUsers != null)
     {
         dhModule objmod = new dhModule();
         Globalized.AppModuleList = iFacede.GetAllModule(Globalized.ObjDbName, objmod);
         // Create Mune Herre
         ObservableCollection <dhModule> dtMenu = iFacede.GetUserMenu(Globalized.ObjDbName, Globalized.objAppPreference, objdhUsers);
         List <Button> StackReturn = new List <Button>();
         foreach (dhModule Module in dtMenu)
         {
             // BitmapImage image = new BitmapImage(new Uri("/SublimeCareCloud;component/Images/" + Module.VIconName, UriKind.Relative));
             // Module.VIconName = new Uri("/SublimeCareCloud;component/Images/" + Module.VIconName, UriKind.Relative).ToString();
             this.MenuItems.Add(Module);
         }    // end main menu
     }
 }
Esempio n. 13
0
        public void CreateSubMenuItems(dhModule pModule)
        {
            // need check what sub module are allowed 14,15,29,30,31,26,27,38,1,2,3,4,5,6,7,8,9,10,11,12,13,22,23,24,34,35,19,20,21
            List <string> AllowedModuleIds = Globalized.ObjCurrentUser.VAllowdModule.Split(',').ToList();
            // I have list of module on local
            ObservableCollection <dhModule> submodule = Globalized.AppModuleList.Where(ob => ob.IModuleParentID == pModule.IModuleID).ToObservableCollection <dhModule>();

            SubMenu.Clear();
            foreach (dhModule Module in submodule)
            {
                //BitmapImage image = new BitmapImage(new Uri("/SublimeCareCloud;component/Images/" + Module.VIconName, UriKind.Relative));
                //Module.VIconName = new Uri("/SublimeCareCloud;component/Images/" + Module.VIconName, UriKind.Relative).ToString();

                if (AllowedModuleIds.Contains(Module.IModuleID.ToString()))
                {
                    this.SubMenu.Add(Module);
                }
            }// end main menu
        }
Esempio n. 14
0
        private void UserControl_Loaded_1(object sender, RoutedEventArgs e)
        {
            dhModule objMod = new dhModule();

            //objMod.IModuleID = MuduleID;
            //          if (objUser != null)
            //       {
            //#region "Allowed Menu"
            objMod.AllowdModule    = Globalized.objAppPreference.VEnableModules;
            objMod.IModuleParentID = 0;
            dsGeneral.dtPosModuleDataTable  dtm      = iFacede.GetModule(Globalized.ObjDbName, objMod);
            ObservableCollection <dhModule> sequence = ReflectionUtility.DataTableToObservableCollection <dhModule>(dtm);
            List <string> Ids = Globalized.ObjCurrentUser.VAllowdModule.Split(',').ToList <string>();

            ModuleControl objModuleToadd = new ModuleControl();

            MControls.Children.Clear();
            foreach (dhModule item in sequence)
            {
                string Contian = Ids.Distinct <string>().Cast <string>().Where(i => i.Equals(item.IModuleID.ToString())).SingleOrDefault();
                if ((Contian == null) || (item.IModuleParentID != 0))
                {
                    continue;
                }
                else
                {
                    MControls.Children.Add(objModuleToadd = new ModuleControl(item.IModuleID));
                }
            }

            //int length = 7;
            ////MControls
            //ModuleControl Test = new ModuleControl();
            //for (int i = 0; i < length; i++)
            //{

            //}
        }
Esempio n. 15
0
 public dsGeneral.dtPosModuleDataTable GetModule(dhDBnames objDBNames, dhModule ObjModule)
 {
     dsGeneral.dtPosModuleDataTable dt = objDALGeneral.GetModule(objDBNames, ObjModule);
     return(dt);
 }
Esempio n. 16
0
        public DataSet InsertUpdateModule(dhDBnames objDBNames, dhModule ObjModule)
        {
            DataSet dsreturn = objDatabase.GetDataSet(objDBNames, ObjModule, "xmlInsertUpdateModule");

            return(dsreturn);
        }
Esempio n. 17
0
 public static ObservableCollection <dhModule> GetUserSubMenu(dhDBnames objDbName, dhAppPreference objAppPreference, dhUsers objCurrentUser, dhModule objdhModule)
 {
     try
     {
         if (objBLUser == null)
         {
             objBLUser = new blUser();
         }
         return(objBLUser.GetUserSubMenu(objDbName, objAppPreference, objCurrentUser, objdhModule));
     }
     catch (Exception ex) { throw ex; }
 }
Esempio n. 18
0
        public static ObservableCollection <dhModule> GetAllModule(dhDBnames objDBNames, dhModule ObjModule)
        {
            try
            {
                dsGeneral.dtPosModuleDataTable var_ret;

                if (ObjBlModule == null)
                {
                    ObjBlModule = new blModule();
                }
                var_ret = ObjBlModule.GetModule(objDBNames, ObjModule);
                ObservableCollection <dhModule> returnlist = BL.ReflectionUtility.DataTableToObservableCollection <dhModule>(var_ret);
                return(returnlist);
            }
            catch (Exception ex) { throw ex; }
        }
Esempio n. 19
0
 public blDoctor()
 {
     this.db       = new AppDbContext();
     this.MyModuel = this.ActiveModule(MyName);
     LoadDoctors();
 }
Esempio n. 20
0
        private void BuildAllowdModuleCheckBox()
        {
            StackPanel OuterStock = new StackPanel();
            //OuterStock. = new Thickness(0, 5, 15, -25);
            dhModule objModule = new dhModule();

            //          if (objUser != null)
            //       {

            #region "Allowed Menu"

            // objModule.AllowdModule = Globalized.objAppPreference.VEnableModules;
            dsGeneral.dtPosModuleDataTable dtm = iFacede.GetModule(Globalized.ObjDbName, objModule);
            EnumerableRowCollection <dsGeneral.dtPosModuleRow> result2 = from r in dtm.AsEnumerable()
                                                                         where (r.Field <int>("iModuleParentID") == 0)
                                                                         select r;
            int CountRow = result2.Count <dsGeneral.dtPosModuleRow>();
            if (CountRow > 0)
            {
                DataTable dtResult2 = result2.CopyToDataTable();
                ObservableCollection <dhModule> sequence = ReflectionUtility.DataTableToObservableCollection <dhModule>(dtResult2);
                if (sequence.Count > 0)
                {
                    foreach (dhModule Module in sequence)
                    {
                        GroupBox objGroup = new GroupBox();
                        objGroup.Header = Module.VDisplayName;
                        objGroup.Margin = new Thickness(0, 0, 0, 15);

                        #region "Grid"

                        Grid grid = new Grid();
                        //  grid.Width = 400;
                        // Create column definitions.
                        ColumnDefinition columnDefinition1 = new ColumnDefinition();
                        ColumnDefinition columnDefinition2 = new ColumnDefinition();
                        columnDefinition1.Width = new GridLength(200);
                        columnDefinition2.Width = new GridLength(200);
                        // Attached definitions to grid.
                        grid.ColumnDefinitions.Add(columnDefinition1);
                        grid.ColumnDefinitions.Add(columnDefinition2);

                        CheckBox cb = new CheckBox();
                        cb.Name    = Module.VModuleName.ToString() + Module.IModuleID.ToString();
                        cb.Content = Module.VDisplayName.ToString();
                        //   cb.Width = 100;
                        cb.Margin      = new Thickness(5, 5, 5, 5);
                        cb.DataContext = Module;
                        Binding myBinding = new Binding("BIsActive");
                        myBinding.Source = Module;
                        cb.SetBinding(CheckBox.IsCheckedProperty, myBinding);
                        cb.Tag = Module;

                        cb.AddHandler(CheckBox.CheckedEvent, new RoutedEventHandler(DynamicCheckBox_Checked));
                        cb.AddHandler(CheckBox.UncheckedEvent, new RoutedEventHandler(DynamicCheckBox_Unchecked));

                        RowDefinition rowDefinition1 = new RowDefinition();
                        rowDefinition1.Height = new GridLength(30);
                        grid.RowDefinitions.Add(rowDefinition1);

                        grid.Children.Add(cb);
                        Grid.SetColumn(cb, 0);
                        Grid.SetRow(cb, 0);

                        #endregion "Grid"

                        EnumerableRowCollection <dsGeneral.dtPosModuleRow> Filter = from r2 in dtm.AsEnumerable()
                                                                                    where (r2.Field <int>("iModuleParentID") == Module.IModuleID)
                                                                                    select r2;
                        int CountRowInner = result2.Count <dsGeneral.dtPosModuleRow>();
                        if (CountRowInner > 0)
                        {
                            DataTable dtFilter;
                            if (Filter.Count() > 0)
                            {
                                dtFilter = Filter.CopyToDataTable();
                            }
                            else
                            {
                                dtFilter = new DataTable();
                            }


                            ObservableCollection <dhModule> sequencefilter = ReflectionUtility.DataTableToObservableCollection <dhModule>(dtFilter);
                            if (sequencefilter.Count > 0)
                            {
                                // int Bool = 1;

                                int           row           = 1;
                                int           col           = 0;
                                RowDefinition rowDefinition = new RowDefinition();
                                rowDefinition.Height = new GridLength(30);
                                grid.RowDefinitions.Add(rowDefinition);

                                #region "Child Module"

                                foreach (dhModule SubModule in sequencefilter)
                                {
                                    //for (int i = 0; i < sequencefilter.Count ; i++)
                                    //{
                                    CheckBox NestedCb = new CheckBox();
                                    //NestedStp.Orientation = Orientation.Horizontal;
                                    NestedCb.Name    = "Sub" + SubModule.VModuleName.ToString() + SubModule.IModuleID.ToString();
                                    NestedCb.Content = SubModule.VDisplayName.ToString();
                                    NestedCb.Margin  = new Thickness(35, 5, 5, 5);
                                    if (col == 2)
                                    {
                                        row = row + 1;
                                        col = 0;
                                        RowDefinition rowDefinition3 = new RowDefinition();
                                        rowDefinition3.Height = new GridLength(30);
                                        grid.RowDefinitions.Add(rowDefinition3);
                                    }

                                    NestedCb.DataContext = Module;
                                    Binding mySubBinding = new Binding("BIsActive");
                                    mySubBinding.Source = SubModule;
                                    NestedCb.SetBinding(CheckBox.IsCheckedProperty, mySubBinding);
                                    NestedCb.Tag = SubModule;

                                    grid.Children.Add(NestedCb);
                                    Grid.SetColumn(NestedCb, col);
                                    Grid.SetRow(NestedCb, row);
                                    col += 1;
                                }

                                #endregion "Child Module"

                                objGroup.Content = grid;
                            }
                            OuterStock.Children.Add(objGroup);
                        }
                    }
                    RightsGrid.Children.Add(OuterStock);
                }
            }

            #endregion "Allowed Menu"

            //            }
        }
Esempio n. 21
0
        internal DataSet InsertUpdateModule(dhDBnames objDBNames, dhModule ObjModule)
        {
            DataSet ds = objDALGeneral.InsertUpdateModule(objDBNames, ObjModule);

            return(ds);
        }