Esempio n. 1
0
        public DataSet InsertUpdateAccounts(dhDBnames objDBNames, dhAccount objAccounts)
        {
            DataSet ds;

            ds = objDALGeneral.InsertUpdateAccounts(objDBNames, objAccounts);
            return(ds);
        }
Esempio n. 2
0
        public static dhAccount GetAccountByMdule(AppDbContext db, int IModuleFK_ID, int IModuleID)
        {
            dhAccount objReturn = new dhAccount();

            objReturn = db.Accounts.AsNoTracking().Where(x => x.IModuleFK_ID == IModuleFK_ID && x.IModuleID == IModuleID).FirstOrDefault();
            return(objReturn);
        }
Esempio n. 3
0
        public dhAccount AddNewAccount(string ModuleName, int iModuleId, int IModuleFK_ID, int?IModuleParentID = 0,
                                       string AccountName = "", string VAccountDesc = "", string AccountNoStart = "A-")
        {
            dhAccount ObjAccount = new dhAccount();
            dhAccount objAccount = this.db.Accounts.AsNoTracking()
                                   .Where(x => x.IModuleID == iModuleId && x.IModuleFK_ID == IModuleFK_ID).FirstOrDefault();

            //if (objModule != null)
            //{
            if (objAccount == null)
            {
                ObjAccount = new dhAccount();
                ObjAccount.IModuleFK_ID     = IModuleFK_ID;
                ObjAccount.IModuleID        = iModuleId;
                ObjAccount.AccountName      = AccountName;
                ObjAccount.VAccountDesc     = VAccountDesc;                                                          // MsgTextCollection.MsgsList.Where(xx => xx.Key == "M_D01DEC").FirstOrDefault().Value;
                ObjAccount.VAccountComments = VAccountDesc;                                                          //MsgTextCollection.MsgsList.Where(xx => xx.Key == "M_D02DEC").FirstOrDefault().Value;
                ObjAccount.VAccountNo       = AccountNoStart + DateTime.Now.ToString("ddmmyy") + "-" + IModuleFK_ID; // D-For DOC and  DMY  - Day month year and Doc Id
                ObjAccount.IFinaceType      = 3;
                ObjAccount.BNominal         = false;
                ObjAccount.BEditable        = false;
                // finally save
                this.AddNewAccount(ObjAccount);
                // db.Accounts.Add(ObjAccount);
                return(ObjAccount);
            }

            return(ObjAccount);
        }
Esempio n. 4
0
        public dsGeneral.dtPosAccountsDataTable GetAccounts(dhDBnames objDBName, dhAccount objAccounts)
        {
            dsGeneral ds = new dsGeneral();
            DataSet   dsreturn;

            dsreturn = objDatabase.GetDataSet(objDBName, objAccounts, "xmlGetAccounts", (DataSet)ds, "dtPosAccounts");
            dsGeneral.dtPosAccountsDataTable retdt = ((dsGeneral)dsreturn).dtPosAccounts;
            return(retdt);
        }
Esempio n. 5
0
        public long?InsertUpdatePatientAccount()
        {
            blAccount objBlAccount = new blAccount();
            string    AccountName  = this.MyPatient.vFullName;
            string    Desc         = MsgTextCollection.MsgsList.Where(xx => xx.Key == "P_A001").FirstOrDefault().Value;
            dhAccount objAccount   = objBlAccount.AddNewAccount(MyModuleName, MyActiveModule.IModuleID, Convert.ToInt32(MyPatient.iPatid), 0, AccountName, "jjj", "P-");

            // return new dhAccount();
            return(objAccount.IAccountid);
        }
Esempio n. 6
0
 public dhAccount AddNewAccount(dhAccount ObjNewAccount)
 {
     if (ObjNewAccount == null)
     {
         return(new dhAccount());
     }
     this.db.Accounts.Add(ObjNewAccount);
     this.db.SaveChanges();
     return(new dhAccount());
 }
 public AddAccountViewModel(dhAccount objPassed)
 {
     if (objPassed == null)
     {
         GlobalObjAccount = new dhAccount();
     }
     else
     {
         GlobalObjAccount = objPassed;
     }
 }
        // Functions

        public dhAccount GetDocAccount()
        {
            dhAccount objReturn = new dhAccount();

            if (this.ObjNewDoctor == null)
            {
                return(objReturn);
            }
            DocID     = this.ObjNewDoctor.IDocid;
            objReturn = this.db.Accounts.AsNoTracking().Where(x => x.IModuleFK_ID == DocID && x.IModuleID == this.MyModuel.IModuleID).FirstOrDefault();
            return(objReturn);
        }
Esempio n. 9
0
        private void InsertUpdateAccount()
        {
            dhAccount objInsert = new dhAccount();

            objInsert = (dhAccount)this.AccountDt.DataContext;



            dhAccountValidator validator = new dhAccountValidator();

            FluentValidation.Results.ValidationResult results = validator.Validate(objInsert);

            bool validationSucceeded           = results.IsValid;
            IList <ValidationFailure> failures = results.Errors;

            if (validationSucceeded)
            {
                if (this.vAccountType.SelectedValue != null)
                {
                    objInsert.IFinaceType = Convert.ToInt32(this.vAccountType.SelectedValue.ToString());
                }
                else
                {
                    throw new ApplicationException("Please Select Account Type.");
                }
                DataSet ds = iFacede.InsertUpdateAccount(Globalized.ObjDbName, objInsert);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (objInsert.IUpdate == 1)
                    {
                        string msg = "Account  '" + objInsert.AccountName + "' information is updated successfully.";
                        Globalized.setException(msg, lblErrorMsg, DataHolders.MsgType.Info);
                        //Globalized.SetMsg(msg, DataHolders.MsgType.Info);
                        //Globalized.ShowMsg(lblErrorMsg);
                    }
                    else
                    {
                        System.Media.SystemSounds.Beep.Play();
                        lblErrorMsg.Visibility = Visibility.Hidden;
                        Globalized.SetMsg("New Acount '" + objInsert.AccountName + "' is added successfully.", DataHolders.MsgType.Info);
                        objTodisplay.IUpdate = 1;
                        this.DataContext     = objTodisplay;
                        Globalized.ShowMsg(lblErrorMsg);
                    }
                }
                Globalized.AccountListOptimizated();
            }
            else
            {
                throw new ApplicationException(failures.First().ErrorMessage);
            }
        }
Esempio n. 10
0
        private void showall_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ObjFilterObject = new dhAccount();

                loadData(ObjFilterObject);
            }
            catch (Exception ex)
            {
                Globalized.setException(ex, lblErrorMsg, MsgType.Error);
            }
        }
        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. 12
0
 private void Button_Click_2(object sender, RoutedEventArgs e)
 {
     try
     {
         dhAccount objSearchAccount = new dhAccount();
         //   objSearchAccount = (dhAccount)AccountSearchBox.DataContext;
         //    objSearchAccount.VUserType = string.IsNullOrEmpty(VUserType.SelectedValue.ToString()) ? null : VUserType.SelectedValue.ToString();
         loadData(objSearchAccount, true);
     }
     catch (Exception ex)
     {
         Globalized.setException(ex, lblErrorMsg, MsgType.Error);
     }
 }
Esempio n. 13
0
        public static DataSet InsertUpdateAccount(dhDBnames objDBNames, dhAccount objAccounts)
        {
            try
            {
                DataSet var_ret;

                if (objblAccount == null)
                {
                    objblAccount = new blAccount();
                }
                var_ret = objblAccount.InsertUpdateAccounts(objDBNames, objAccounts);

                return(var_ret);
            }
            catch (Exception ex) { throw ex; }
        }
Esempio n. 14
0
        public static DataSet GetDailyIncom(dhDBnames dhDBnames, dhAccount objAccount)
        {
            try
            {
                DataSet var_ret;

                if (objblAccount == null)
                {
                    objblAccount = new blAccount();
                }
                var_ret = objblAccount.GetDailyIncom(dhDBnames, objAccount);

                return(var_ret);
            }
            catch (Exception ex) { throw ex; }
        }
Esempio n. 15
0
        public static dhAccount GetdhAccount(dhDBnames objDBNames, dhAccount objAccount)
        {
            try
            {
                dhAccount var_ret = null;

                if (objblAccount == null)
                {
                    objblAccount = new blAccount();
                }
                {
                    var_ret = objblAccount.GetdhAccount(objDBNames, objAccount);
                }

                return(var_ret);
            }
            catch (Exception ex) { throw ex; }
        }
Esempio n. 16
0
        private void AddTabItem(dhAccount objTodisplay)
        {
            // create new tab AccountIn
            TabItem tab     = new TabItem();
            string  tabName = "";

            if (objTodisplay.AccountName != null)
            {
                tabName = "Account No - ' " + objTodisplay.VAccountNo + " '";
            }
            else
            {
                tabName = "Add New Account";
            }

            tab.Header         = string.Format(tabName);
            tab.Name           = string.Format("Account{0}", tabDynamic.Items.Count + 1);
            tab.HeaderTemplate = tabDynamic.FindResource("TabHeader") as DataTemplate;
            //    tab.MouseDoubleClick += new MouseButtonEventHandler(tab_MouseDoubleClick);
            AddAccountView wintoOpen = new AddAccountView(objTodisplay);

            tab.Content    = wintoOpen;
            tab.IsSelected = true;

            //var AccountIn = tabDynamic.Items.Cast<TabItem>().Where(i => i.Name.Equals(tab.Name)).SingleOrDefault();
            //if (AccountIn == null)
            //{
            if (tabDynamic.Items.Count > 1)
            {
                tabDynamic.Items.Insert(tabDynamic.Items.Count - 1, tab); // inset the Eid tab
            }
            else
            {
                tabDynamic.Items.Insert(tabDynamic.Items.Count, tab); // inset the Eid tab
            }

            //}
            //else
            //{
            //    AccountIn.IsSelected = true;
            //}
            //  tabDynamic.DataContext = _TabItems;
        }
Esempio n. 17
0
        public AddAccountView(DataHolders.dhAccount objTodisplay)
        {
            // TODO: Complete member initialization
            InitializeComponent();
            this.objTodisplay = new dhAccount();
            this.objTodisplay = objTodisplay;
            this.objTodisplay.FinanceTypeList = new ObservableCollection <dhFinanceType>();
            this.AccountGrid.DataContext      = this.objTodisplay;

            //this.vAccountType.DataContext =

            dsGeneral.dtPosFinaceTypeDataTable dtF = iFacede.GetFinaceType(Globalized.ObjDbName, objTodisplay);
            objTodisplay.FinanceTypeList = ReflectionUtility.DataTableToObservableCollection <dhFinanceType>(dtF);

            this.vAccountType.ItemsSource       = objTodisplay.FinanceTypeList;// iFacede.GetFinaceType(Globalized.ObjDbName, objTodisplay);
            this.vAccountType.DisplayMemberPath = "vFinaceType";
            this.vAccountType.SelectedValuePath = "iFinaceType";
            this.vAccountType.SelectedValue     = this.objTodisplay.IFinaceType;
            LoadData();
        }
Esempio n. 18
0
        private void tabAdd_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            TabItem tab     = tabDynamic.SelectedItem as TabItem;
            TabItem _tabAdd = tabDynamic.Items[0] as TabItem;

            if (tab == null)
            {
                return;
            }

            if ((tab.Header.Equals(" + ")) && (tabDynamic.Items.Count > 1))
            {
                TabItem   Newtabs = new TabItem();
                string    tabName = "";
                dhAccount Obj     = new dhAccount();
                // AddTabItem(Obj);

                tabName                = "Add New Account";
                Newtabs.Header         = string.Format(tabName);
                Newtabs.Name           = string.Format("AddAccountView");
                Newtabs.HeaderTemplate = tabDynamic.FindResource("TabHeader") as DataTemplate;
                // Newtabs.MouseDoubleClick += new MouseButtonEventHandler(tab_MouseDoubleClick);
                AddAccountView wintoOpen = new AddAccountView();
                Newtabs.Content    = wintoOpen;
                Newtabs.IsSelected = true;

                var Account = tabDynamic.Items.Cast <TabItem>().Where(i => i.Name.Equals(Newtabs.Name)).SingleOrDefault();
                if (Account == null)
                {
                    tabDynamic.Items.Insert(tabDynamic.Items.Count - 1, Newtabs);
                }
                else
                {
                    Account.IsSelected = true;
                }
            }
            else
            {
                tab.IsSelected = true;
            }
        }
Esempio n. 19
0
        private void Account_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (sender != null)
            {
                DataGridRow dgr = sender as DataGridRow;
                // get the obect and then Invoice ID opne the Id in readonly mode

                dhAccount objTodisplay = new dhAccount();

                objTodisplay.IAccountid = ((dhAccount)dgr.Item).IAccountid;
                dsGeneral.dtPosAccountsDataTable dtAccount   = iFacede.GetAccount(Globalized.ObjDbName, objTodisplay);
                ObservableCollection <dhAccount> listAccount = ReflectionUtility.DataTableToObservableCollection <dhAccount>(dtAccount);
                if (listAccount.Count > 0)
                {
                    objTodisplay         = listAccount.Cast <dhAccount>().Where(i => i.IAccountid.Equals(objTodisplay.IAccountid)).SingleOrDefault();
                    objTodisplay.IUpdate = 1;
                    //dsGeneral.dtPosFinaceTypeDataTable dtF = iFacede.GetFinaceType(Globalized.ObjDbName, objTodisplay);
                    //objTodisplay.FinanceTypeList = ReflectionUtility.DataTableToObservableCollection<dhFinanceType>(dtF);
                    AddTabItem(objTodisplay);
                }
            }
        }
Esempio n. 20
0
        private void LoadData()
        {
            dhAccount objFinaceType = new dhAccount();


            dsGeneral.dtPosFinaceTypeDataTable dtF = iFacede.GetFinaceType(Globalized.ObjDbName, objFinaceType);

            objTodisplay.FinanceTypeList = ReflectionUtility.DataTableToObservableCollection <dhFinanceType>(dtF);

            this.vAccountType.ItemsSource = objTodisplay.FinanceTypeList;

            this.vAccountType.DisplayMemberPath = "VFinaceType";
            this.vAccountType.SelectedValuePath = "IFinaceType";
            this.AccountDt.DataContext          = this.objTodisplay;
            this.vAccountType.SelectedValue     = this.objTodisplay.IFinaceType;
            if (objTodisplay.BEditable == false)
            {
                //accountNameTextBox.IsEnabled = false;
                //vAccountNoTextBox.IsEnabled = false;
                //vAccountDescTextBox.IsEnabled = false;
                //vAccountCommentsTextBox.IsEnabled = false;
                //vAccountType.IsEnabled = false;
                //bNominalCheckBox.IsEnabled = false;
                AccountDt.IsEnabled       = false;
                this.btnSaveAcc.IsEnabled = false;
                Globalized.SetMsg("This is non-editable account.", MsgType.Info);
                Globalized.ShowMsg(lblErrorMsg);
            }
            else
            {
                AccountDt.IsEnabled = true;
            }

            if (objTodisplay.IUpdate > 0)
            {
                this.vAccountNoTextBox.IsEnabled = false;
                // this.vAccountNoTextBox.Background = new SolidColorBrush(Colors.Gray);
            }
        }
Esempio n. 21
0
        public dhAccount GetdhAccount(dhDBnames objDBNames, dhAccount objAccount)
        {
            dsGeneral ds       = new dsGeneral();
            DataSet   dsreturn = objDatabase.GetDataSet(objDBNames, objAccount, "xmlGetAccounts", (DataSet)ds, "dtPosAccounts");

            //     dhAccount returnObject = null;
            dsGeneral.dtPosAccountsDataTable retdt       = ((dsGeneral)dsreturn).dtPosAccounts;
            ObservableCollection <dhAccount> listAccount = ReflectionUtility.DataTableToObservableCollection <dhAccount>(retdt);

            if (listAccount.Count > 0)
            {
                return(listAccount.SingleOrDefault());
            }
            else
            {
                return(null);
            }
            //retdt.ToList<dhAccount>();
            //foreach (DataRow row in retdt.Rows)
            //{

            //    returnObject = new dhAccount
            //    {
            //        IItemID = Convert.ToInt32(row["IItemID"]),
            //        FUnitePrice = Convert.ToDouble(row["FUnitePrice"]),
            //        VItemName = Convert.ToString(row["VItemName"]),
            //        FMaxDiscountPresent = Convert.ToDouble(row["fMaxDiscountPresent"]),
            //        IQuantity = 1,
            //        Ammount = Convert.ToDouble(row["FUnitePrice"]) * 1,
            //        IStockIn = Convert.ToInt32(String.IsNullOrEmpty(row["IStockIn"].ToString()) ? 0 : row["IStockIn"]),
            //        IStockOut = Convert.ToInt32(String.IsNullOrEmpty(row["IStockOut"].ToString()) ? 0 : row["IStockOut"]),
            //        ICurrantStock = Convert.ToInt32(String.IsNullOrEmpty(row["ICurrantStock"].ToString()) ? 0 : row["ICurrantStock"]),
            //        IsAvailable = Convert.ToInt32(String.IsNullOrEmpty(row["ICurrantStock"].ToString()) ? 0 : row["ICurrantStock"]) > 0 ? true : false,
            //        StockStatus = Convert.ToInt32(String.IsNullOrEmpty(row["ICurrantStock"].ToString()) ? 0 : row["ICurrantStock"]) > 0 ? "Available" : "Not Available",
            //    };
            //}
            //      return returnObject;
        }
Esempio n. 22
0
        public static dsGeneral.dtPosFinaceTypeDataTable GetFinaceType(dhDBnames objDBNames, dhAccount objAccounts)
        {
            try
            {
                dsGeneral.dtPosFinaceTypeDataTable var_ret;

                if (objblAccount == null)
                {
                    objblAccount = new blAccount();
                }
                var_ret = objblAccount.GetFinaceType(objDBNames, objAccounts);

                return(var_ret);
            }
            catch (Exception ex) { throw ex; }
        }
 public AddAccountViewModel()
 {
     GlobalObjAccount = new dhAccount();
 }
Esempio n. 24
0
        private void loadData(dhAccount objAccount, Boolean ShowResultCount = false)
        {
            dsGeneral.dtPosAccountsDataTable dtAccounts = iFacede.GetAccount(Globalized.ObjDbName, objAccount);

            EnumerableRowCollection <dsGeneral.dtPosAccountsRow> Filter = null;

            sequence.Clear();
            sequence = ReflectionUtility.DataTableToObservableCollection <dhAccount>(dtAccounts);
            //if (Globalized.ObjCurrentUser.VUserType == "Super")
            //{
            //    Filter = from r in dtAccounts.AsEnumerable()
            //             where (r.Field<int>("VUserType") == Module.IModuleID) && (r.Field<bool>("bIsActive") == true)
            //             select r;
            //}
            //if (Globalized.ObjCurrentUser.VUserType == "Owner")
            //{
            //    Filter = from r in dtAccounts.AsEnumerable()
            //             where (r.Field<string>("VUserType") == "Admin") || (r.Field<string>("VUserType") == "AccountIn") || (r.Field<string>("VUserType") == "Owner")
            //             select r;
            //}

            //if (Globalized.ObjCurrentUser.VUserType == "Admin")
            //{
            //    Filter = from r in dtAccounts.AsEnumerable()
            //             where ((r.Field<string>("VUserType") == "Admin") && (r.Field<int>("iAccountid") == Globalized.ObjCurrentUser.IAccountid) ) || (r.Field<string>("VUserType") == "AccountIn")
            //             select r;
            //}
            //if (Globalized.ObjCurrentUser.VUserType == "AccountIn")
            //{
            //    Filter = from r in dtAccounts.AsEnumerable()
            //             where (r.Field<string>("VUserType") == "AccountIn") && (r.Field<int>("iAccountid") == Globalized.ObjCurrentUser.IAccountid)
            //             select r;
            //}

            if (Filter != null)
            {
                int CountRowInner = Filter.Count <dsGeneral.dtPosAccountsRow>();
                if (CountRowInner > 0)
                {
                    DataTable dtFilter = Filter.CopyToDataTable();
                    sequence = ReflectionUtility.DataTableToObservableCollection <dhAccount>(dtFilter);
                }
                else
                {
                    sequence = null;
                }
            }

            AccountList.ItemsSource = sequence;
            //pageControl.PageContract = null;
            //pageControl.PageContract = this;

            // pageControl_PreviewPageChange(null, null);
            // Globalized.ShowMsg(lblErrorMsg);
            //if (Globalized.lastMsg != null)
            //{
            //    //System.Windows.Forms.MessageBox.Show( );
            //    lblErrorMsg.Content = Globalized.lastMsg;
            //    lblErrorMsg.Visibility = System.Windows.Visibility.Visible;
            //    Globalized.lastMsg = null;
            //}
            //else
            //{
            //    lblErrorMsg.Content = "";
            //    lblErrorMsg.Visibility = System.Windows.Visibility.Hidden;
            //}
            //    show msg for local search
            if ((ShowResultCount) && (sequence != null))
            {
                String msg = String.Format("  {0}  Search Results Found", sequence.Count);
                //pageControl.ReLoad();
                Globalized.setException(msg, lblErrorMsg, DataHolders.MsgType.Info);
                Globalized.ShowMsg(lblErrorMsg);
            }
            else
            {
                if (sequence == null)
                {
                    String msg = String.Format("  {0}  Search Results Found", 0);
                    Globalized.setException(msg, lblErrorMsg, DataHolders.MsgType.Info);
                    Globalized.ShowMsg(lblErrorMsg);
                }

                if (ShowResultCount == false)
                {
                    lblErrorMsg.Visibility = Visibility.Hidden;
                }
            }
        }
Esempio n. 25
0
        internal dhAccount GetdhAccount(dhDBnames objDBNames, dhAccount objAccount)
        {
            dhAccount dh = objDALGeneral.GetdhAccount(objDBNames, objAccount);

            return(dh);
        }
Esempio n. 26
0
 public dsGeneral.dtPosFinaceTypeDataTable GetFinaceType(dhDBnames objDBNames, dhAccount objAccounts)
 {
     dsGeneral.dtPosFinaceTypeDataTable dt = objDALGeneral.GetFinaceType(objDBNames, objAccounts);
     return(dt);
 }
Esempio n. 27
0
 public dsGeneral.dtPosAccountsDataTable GetAccountPR(dhDBnames objDBNames, dhAccount objAccounts)
 {
     dsGeneral.dtPosAccountsDataTable dt = objDALGeneral.GetAccountPR(objDBNames, objAccounts);
     return(dt);
 }
        private void BtnSaveDoctor_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (objNewDoctor.IUpdate == 0 || objNewDoctor.IUpdate == null)
                {
                    if (objNewDoctor.TokenStart == "" || objNewDoctor.TokenStart == null)
                    {
                        objNewDoctor.TokenStart = objNewDoctor.VfName.Substring(0, 2).ToUpper();
                    }
                    MyViewModel.db.Doctors.Add(objNewDoctor);
                    MyViewModel.db.SaveChanges();;
                    // for investigations
                    foreach (DocInvestigations item in objNewDoctor.DocInvestigations)
                    {
                        item.IDocid    = objNewDoctor.IDocid;
                        item.BIsActive = true;
                        MyViewModel.db.DocInvestigations.Add(item);
                    }
                    // for doc procedures
                    dhAccount objAccount = MyViewModel.InsertUpdateAccount(objNewDoctor);
                    MyViewModel.db.Accounts.Add(objAccount);
                    //  need to set for doc proc
                    this.AddEditDocProcedures();
                    Globalized.SetMsg("DOC01", DataHolders.MsgType.Info);
                }
                // if update flag is set
                if (objNewDoctor.IUpdate == 1)
                {
                    // dhDoctors temp =  MyViewModel.db.Doctors.Find(objNewDoctor.IDocid);
                    objNewDoctor = (dhDoctors)this.NewDoctorGrid.DataContext;
                    if (objNewDoctor.TokenStart == "" || objNewDoctor.TokenStart == null)
                    {
                        objNewDoctor.TokenStart = objNewDoctor.VfName.Substring(0, 2).ToUpper();
                    }
                    MyViewModel.db.Doctors.Attach(objNewDoctor);
                    //.State = EntityState.Added;
                    MyViewModel.db.Entry(objNewDoctor).State = EntityState.Modified;

                    dhAccount objAccount = MyViewModel.InsertUpdateAccount(objNewDoctor);

                    //
                    MyViewModel.db.Accounts.Attach(objAccount);
                    MyViewModel.db.Entry(objAccount).State = EntityState.Modified;


                    // check existing investigation
                    ObservableCollection <DocInvestigations> crntInv = MyViewModel.db.DocInvestigations.Where(x => x.IDocid == objNewDoctor.IDocid && x.BIsActive == true).ToObservableCollection();
                    foreach (DocInvestigations item in objNewDoctor.DocInvestigations)
                    {
                        item.IDocid = objNewDoctor.IDocid;
                        // make this investigation active
                        item.BIsActive = true;
                        if (crntInv.Select(x => x.IDocInvestigationsId == item.IDocInvestigationsId).FirstOrDefault() == false)
                        {
                            MyViewModel.db.DocInvestigations.Add(item);
                        }
                        else
                        {
                            DocInvestigations tempDoinv = this.MyViewModel.db.DocInvestigations.Find(item.IDocInvestigationsId);
                            if (tempDoinv != null)
                            {
                                tempDoinv = item;
                            }
                        }
                        // if(crntInv.fi)
                    }

                    //  need to set for doc proc
                    this.AddEditDocProcedures();

                    Globalized.SetMsg("DOC02", DataHolders.MsgType.Info);
                }



                //  final save and update model
                objNewDoctor.IUpdate = 1; //  now it will ebe update object

                MyViewModel.db.SaveChanges();
                // set Doctor
                MyViewModel.ObjNewDoctor = objNewDoctor;
                MyViewModel.ObjNewDoctor.DocInvestigations = MyViewModel.GetActiveDocInvestigations();


                MyViewModel.DoctorAccount    = MyViewModel.GetDocAccount();
                this.AccountInfo.DataContext = MyViewModel.DoctorAccount;

                Globalized.ShowMsg(lblErrorMsg);
            }
            catch (Exception ex)
            {
                Globalized.SetMsg(ex.Message, MsgType.Error);
                Globalized.ShowMsg(lblErrorMsg);
            }


            //  this.DataContext
        }
Esempio n. 29
0
        internal DataSet GetAccountsWithBalance(dhDBnames dhDBnames, dhAccount objAccount)
        {
            DataSet ds = objDALGeneral.GetAccountsWithBalance(dhDBnames, objAccount);

            return(ds);
        }
Esempio n. 30
0
        internal DataSet GetDailyIncom(dhDBnames dhDBnames, dhAccount objAccount)
        {
            DataSet ds = objDALGeneral.GetDailyIncom(dhDBnames, objAccount);

            return(ds);
        }