Exemplo n.º 1
0
        public static void SaveList(List <UserType> list)
        {
            BLL.UserType bv = new BLL.UserType();
            foreach (UserType v in list)
            {
                // try to load by primary key
                bv.LoadByPrimaryKey(v.ID.Value);

                // if the entry doesn't exist, create it
                if (bv.RowCount == 0)
                {
                    bv.AddNew();
                }
                // populate the contents of v on the to the database list
                if (v.ID.HasValue)
                {
                    bv.ID = v.ID.Value;
                }
                if (v.Type != "" && v.Type != null)
                {
                    bv.Type = v.Type;
                }
                //if( v.IsDeleted.HasValue )
                //     bv.IsDeleted = v.IsDeleted.Value;
                //if( v.UpdateTime.HasValue )
                //     bv.UpdateTime = v.UpdateTime.Value;

                bv.Save();
            }
        }
Exemplo n.º 2
0
        public static List <UserType> ToList(BLL.UserType v)
        {
            List <UserType> list = new List <UserType>();

            while (!v.EOF)
            {
                UserType t = new UserType();
                if (!v.IsColumnNull("ID"))
                {
                    t.ID = v.ID;
                }
                if (!v.IsColumnNull("Type"))
                {
                    t.Type = v.Type;
                }
                //if(!v.IsColumnNull("IsDeleted"))
                //      t.IsDeleted = v.IsDeleted;
                //if(!v.IsColumnNull("UpdateTime"))
                //      t.UpdateTime = v.UpdateTime;

                list.Add(t);
                v.MoveNext();
            }
            return(list);
        }
Exemplo n.º 3
0
        private BLL.UserType UserTypeDAL_BLL(DAL.UserType d)
        {
            BLL.UserType b = d.toCopy <BLL.UserType>(new BLL.UserType());

            if (d != null)
            {
                b.UserTypeDetails = new ObservableCollection <BLL.UserTypeDetail>(d.UserTypeDetails.Select(x => UserTypeDetailDAL_BLL(x)).ToList());
                b.Company         = d.CompanyDetail.toCopy <BLL.CompanyDetail>(new BLL.CompanyDetail());
            }
            return(b);
        }
Exemplo n.º 4
0
        private BLL.UserType UserTypeDAL_BLL(DAL.UserType d)
        {
            BLL.UserType b = d.toCopy <BLL.UserType>(new BLL.UserType());

            if (d != null)
            {
                b.UserTypeDetails = new ObservableCollection <BLL.UserTypeDetail>(d.UserTypeDetails.Select(x => UserTypeDetailDAL_BLL(x)).ToList());
                b.Fund            = d.FundMaster.toCopy <BLL.FundMaster>(new BLL.FundMaster());
            }
            return(b);
        }
Exemplo n.º 5
0
        public static List <int> GetDeletedIDsAfter(long LastVersion)
        {
            BLL.UserType v = new BLL.UserType();
            //v.LoadDeletedIDs(LastVersion);
            List <int> list = new List <int>();

            while (!v.EOF)
            {
                list.Add((int)v.GetColumn("ID"));
                v.MoveNext();
            }
            return(list);
        }
Exemplo n.º 6
0
        public int userType_Save(BLL.UserType ut)
        {
            try
            {
                DAL.UserType d = DB.UserTypes.Where(x => x.Id == ut.Id).FirstOrDefault();

                if (d == null)
                {
                    var c = DB.CompanyDetails.Where(x => x.Id == ut.CompanyId).FirstOrDefault();

                    d = new DAL.UserType();
                    c.UserTypes.Add(d);
                    ut.toCopy <DAL.UserType>(d);

                    foreach (var utd in ut.UserTypeDetails)
                    {
                        d.UserTypeDetails.Add(utd.toCopy <DAL.UserTypeDetail>(new DAL.UserTypeDetail()));
                    }
                    DB.SaveChanges();
                    ut.Id      = d.Id;
                    ut.Company = c.toCopy <BLL.CompanyDetail>(new BLL.CompanyDetail());
                    LogDetailStore(ut, LogDetailType.INSERT);
                }
                else
                {
                    ut.toCopy <DAL.UserType>(d);

                    foreach (var utd in ut.UserTypeDetails)
                    {
                        DAL.UserTypeDetail dd = d.UserTypeDetails.Where(x => x.Id == utd.Id).FirstOrDefault();
                        if (dd == null)
                        {
                            dd = new DAL.UserTypeDetail();
                            d.UserTypeDetails.Add(dd);
                        }
                        utd.toCopy <DAL.UserTypeDetail>(dd);
                    }

                    DB.SaveChanges();
                    LogDetailStore(ut, LogDetailType.UPDATE);
                }

                Clients.Clients(OtherLoginClientsOnGroup).userType_Save(ut);

                return(ut.Id);
            }
            catch (Exception ex) { }
            return(0);
        }
Exemplo n.º 7
0
 public static void DeleteList(List <int> list)
 {
     BLL.UserType bv = new BLL.UserType();
     foreach (int v in list)
     {
         // try to load by primary key
         bv.LoadByPrimaryKey(v);
         // if the entry doesn't exist, create it
         if (bv.RowCount > 0)
         {
             bv.MarkAsDeleted();
             bv.Save();
         }
         // populate the contents of v on the to the database list
     }
 }
        private void onClientEvents()
        {
            BLL.NubeAccountClient.NubeAccountHub.On <BLL.UserType>("userType_Save", (rv) => {
                this.Dispatcher.Invoke(() =>
                {
                    rv.Save(true);
                });
            });

            BLL.NubeAccountClient.NubeAccountHub.On("userType_Delete", (Action <int>)((pk) => {
                this.Dispatcher.Invoke((Action)(() => {
                    BLL.UserType d = new BLL.UserType();
                    d.Find((int)pk);
                    d.Delete((bool)true);
                }));
            }));
        }
Exemplo n.º 9
0
 public static List <UserType> GetUpdatesAfter(long?lastVersion, DateTime?lastUpdateTime)
 {
     BLL.UserType v = new BLL.UserType();
     if (lastVersion.HasValue && lastVersion.Value != 0)
     {
         v.LoadUpdatesAfter(Convert.ToInt32(lastVersion.Value));
     }
     else if (lastUpdateTime.HasValue)
     {
         // v.LoadUpdatesAfterByTime(lastUpdateTime.Value);
     }
     else
     {
         v.LoadAll();
     }
     return(ToList(v));
 }
        public static void DeleteList(List<int> list)
        {
            BLL.UserType bv = new BLL.UserType();
            foreach (int v in list)
            {
                // try to load by primary key
                bv.LoadByPrimaryKey(v);
                // if the entry doesn't exist, create it
                if (bv.RowCount > 0)
                {
                    bv.MarkAsDeleted();
                    bv.Save();
                }
                // populate the contents of v on the to the database list

            }
        }
Exemplo n.º 11
0
 public static List <UserType> GetAll()
 {
     BLL.UserType v = new BLL.UserType();
     v.LoadAll();
     return(ToList(v));
 }
 public static List<UserType> GetAll()
 {
     BLL.UserType v = new BLL.UserType();
     v.LoadAll();
     return ToList(v);
 }
        public static void SaveList(List<UserType> list)
        {
            BLL.UserType bv = new BLL.UserType();
            foreach (UserType v in list)
            {
                // try to load by primary key
                bv.LoadByPrimaryKey(v.ID.Value);

                // if the entry doesn't exist, create it
                if (bv.RowCount == 0)
                {
                    bv.AddNew();
                }
                // populate the contents of v on the to the database list
              if( v.ID.HasValue )
                   bv.ID = v.ID.Value;
              if( v.Type != "" && v.Type != null )
                   bv.Type = v.Type;
              //if( v.IsDeleted.HasValue )
              //     bv.IsDeleted = v.IsDeleted.Value;
              //if( v.UpdateTime.HasValue )
              //     bv.UpdateTime = v.UpdateTime.Value;

                bv.Save();
            }
        }
 public static List<UserType> GetUpdatesAfter(long? lastVersion,DateTime? lastUpdateTime)
 {
     BLL.UserType v = new BLL.UserType();
     if(lastVersion.HasValue && lastVersion.Value != 0)
     {
         v.LoadUpdatesAfter( Convert.ToInt32(lastVersion.Value) );
     }else if(lastUpdateTime.HasValue)
     {
        // v.LoadUpdatesAfterByTime(lastUpdateTime.Value);
     }else
     {
         v.LoadAll();
     }
     return ToList(v);
 }
 public static List<int> GetDeletedIDsAfter(long LastVersion)
 {
     BLL.UserType v = new BLL.UserType();
     //v.LoadDeletedIDs(LastVersion);
     List<int> list = new List<int>();
     while (!v.EOF)
     {
         list.Add((int)v.GetColumn("ID"));
         v.MoveNext();
     }
     return list;
 }
Exemplo n.º 16
0
        private void OnUserTypeBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
        {
            _currentUserType = uxUserTypeBindingSource.Current as BLL.UserType;

            if (_currentUserType != null)
            {
                _currentUserType.Validate();
            }
            //_UserType.Validate();
            OnCurrentEntityChanged();
        }