public static int Update(IEntity2 entity, IRelationPredicateBucket filter)
 {
     using (DataAccessAdapter adapter = DataAccessAdapterManagerBase.CreateAdapter())
     {
         return(adapter.UpdateEntitiesDirectly(entity, filter));
     }
 }
 public static object GetSum(IEntityField2 field, IRelationPredicateBucket filter)
 {
     using (DataAccessAdapter adapter = DataAccessAdapterManagerBase.CreateAdapter())
     {
         return(adapter.GetScalar(field, null, AggregateFunction.Sum, filter.PredicateExpression, null, filter.Relations));
     }
 }
 public static bool InsUpdate(TEntity entity2Update, bool refetch, bool recurse)
 {
     using (DataAccessAdapter adapter = DataAccessAdapterManagerBase.CreateAdapter())
     {
         return(adapter.SaveEntity(entity2Update, refetch, recurse));
     }
 }
 public static int InsUpdateCollection(EntityCollection ecEntity)
 {
     using (DataAccessAdapter adapter = DataAccessAdapterManagerBase.CreateAdapter())
     {
         return(adapter.SaveEntityCollection(ecEntity, false, false));
     }
 }
        public static bool DeleteById(Guid id)
        {
            TEntity _entity = (TEntity)Activator.CreateInstance(typeof(TEntity), new object[] { id });

            using (DataAccessAdapter adapter = DataAccessAdapterManagerBase.CreateAdapter())
            {
                return(adapter.DeleteEntity(_entity));
            }
        }
        public static int GetDbCount(IRelationPredicateBucket filter)
        {
            EntityCollection ec = new EntityCollection(new TEntityFactory());

            using (DataAccessAdapter adapter = DataAccessAdapterManagerBase.CreateAdapter())
            {
                return(adapter.GetDbCount(ec, filter));
            }
        }
        public static int GetDbCount(IRelationPredicateBucket filter, EntityField2 fieldStatus)
        {
            EntityCollection ec = new EntityCollection(new TEntityFactory());

            using (DataAccessAdapter adapter = DataAccessAdapterManagerBase.CreateAdapter())
            {
                filter.PredicateExpression.Add(fieldStatus == true);
                return(adapter.GetDbCount(ec, filter));
            }
        }
        public static EntityCollection SelectAllWFKAPaging(int iTop, ISortExpression sorter, IRelationPredicateBucket filter, IPrefetchPath2 paths, int pageNumber, int pageSize)
        {
            EntityCollection ec = new EntityCollection(new TEntityFactory());

            using (DataAccessAdapter adapter = DataAccessAdapterManagerBase.CreateAdapter())
            {
                adapter.FetchEntityCollection(ec, filter, iTop, sorter, paths, pageNumber, pageSize);
            }
            return(ec);
        }
        public static EntityCollection SelectAll(int iTop, ISortExpression sorter, IRelationPredicateBucket filter, IncludeFieldsList includeFields)
        {
            EntityCollection ec = new EntityCollection(new TEntityFactory());

            using (DataAccessAdapter adapter = DataAccessAdapterManagerBase.CreateAdapter())
            {
                adapter.FetchEntityCollection(ec, filter, iTop, sorter, null, includeFields);
            }
            return(ec);
        }
示例#10
0
        public static DataTable SelectAllRDT(int iTop, ISortExpression sorter, IRelationPredicateBucket filter)
        {
            DataTable        toReturn = new DataTable();
            EntityCollection ec       = new EntityCollection(new TEntityFactory());

            using (DataAccessAdapter adapter = DataAccessAdapterManagerBase.CreateAdapter())
            {
                adapter.FetchTypedList(ec.EntityFactoryToUse.CreateFields(), toReturn, filter, iTop, sorter, false);
            }
            return(toReturn);
        }
示例#11
0
        public static EntityCollection SelectAllWPaging(int iTop, ISortExpression sorter, EntityField2 fieldStatus, IRelationPredicateBucket filter, int pageNumber, int pageSize)
        {
            EntityCollection ec = new EntityCollection(new TEntityFactory());

            using (DataAccessAdapter adapter = DataAccessAdapterManagerBase.CreateAdapter())
            {
                filter.PredicateExpression.Add(fieldStatus == true);
                adapter.FetchEntityCollection(ec, filter, iTop, sorter, null, pageNumber, pageSize);
            }
            return(ec);
        }
示例#12
0
        public static int DeleteByCondition(IRelationPredicateBucket filter)
        {
            int         toReturn    = 0;
            TEntity     _entity     = (TEntity)Activator.CreateInstance(typeof(TEntity));
            IEntityCore _entityCore = (IEntityCore)_entity;

            using (DataAccessAdapter adapter = DataAccessAdapterManagerBase.CreateAdapter())
            {
                toReturn = adapter.DeleteEntitiesDirectly(_entityCore.LLBLGenProEntityName, filter);
            }
            return(toReturn);
        }
示例#13
0
        public static EntityCollection SelectByField(EntityField2 fieldColumn, object fkValue)
        {
            EntityCollection        ec     = new EntityCollection(new TEntityFactory());
            RelationPredicateBucket filter = new RelationPredicateBucket();

            filter.PredicateExpression.Add(fieldColumn == fkValue);
            using (DataAccessAdapter adapter = DataAccessAdapterManagerBase.CreateAdapter())
            {
                adapter.FetchEntityCollection(ec, filter, 0, null);
            }
            return(ec);
        }
示例#14
0
        public static TEntity SelectOne(Guid id)
        {
            TEntity result = null;

            using (DataAccessAdapter adapter = DataAccessAdapterManagerBase.CreateAdapter())
            {
                TEntity _resultEntity = (TEntity)Activator.CreateInstance(typeof(TEntity), new object[] { id });
                if (adapter.FetchEntity(_resultEntity))
                {
                    result = _resultEntity;
                }
            }
            return(result);
        }
示例#15
0
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            dictionary.Add("Data Source", this.txtServerName.Text.Trim());
            dictionary.Add("Database", this.txtDatabasename.Text.Trim());
            dictionary.Add("User ID", this.txtUsernameSQL.Text.Trim());
            dictionary.Add("Password", this.txtPasswordSQL.Text.Trim());
            string text = ProcessConfigXML.Dictionary2ConfigString(dictionary);
            bool   flag = ManageBase.IsConnectDatabase(text);

            if (flag)
            {
                DataAccessAdapterManagerBase.SetCustomConnectString(text);
                string          text2           = Util.Encrypt(this.txtLISloginPassword.Text.Trim());
                NguoiDungEntity nguoiDungEntity = ManageBase.SelectNguoiDung(this.txtLISloginUserName.Text.Trim(), text2);
                bool            flag2           = nguoiDungEntity != null;
                if (flag2)
                {
                    Dictionary <string, object> dictionary2 = new Dictionary <string, object>();
                    bool @checked = this.chkLoginRemember.Checked;
                    if (@checked)
                    {
                        dictionary2.Add("User", this.txtLISloginUserName.Text.Trim());
                        dictionary2.Add("Pass", text2);
                        dictionary2.Add("Remember", this.chkLoginRemember.Checked ? "true" : "false");
                    }
                    else
                    {
                        dictionary2.Add("User", "");
                        dictionary2.Add("Pass", "");
                        dictionary2.Add("Remember", "false");
                    }
                    GlobalVariable.NguoiDungId      = nguoiDungEntity.NguoiDungId;
                    GlobalVariable.TenDangNhap      = nguoiDungEntity.TenDangNhap;
                    GlobalVariable.HoTenNguoiDung   = nguoiDungEntity.HoTenNguoiDung;
                    GlobalVariable.MatKhau          = nguoiDungEntity.MatKhau;
                    GlobalVariable.LaQuanTriHeThong = (nguoiDungEntity.VaiTro == 1);
                    dictionary["Password"]          = Util.Encrypt(this.txtPasswordSQL.Text.Trim());
                    text = ProcessConfigXML.Dictionary2ConfigString(dictionary);
                    string strValue = ProcessConfigXML.Dictionary2ConfigString(dictionary2);
                    ProcessConfigXML.SaveData("ConnectiontString", text);
                    ProcessConfigXML.SaveData("Account", strValue);
                    bool flag3 = GlobalVariable.CreateFTP();
                    if (flag3)
                    {
                        base.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        bool laQuanTriHeThong = GlobalVariable.LaQuanTriHeThong;
                        if (laQuanTriHeThong)
                        {
                            FormKetNoiFTP formKetNoiFTP = new FormKetNoiFTP();
                            formKetNoiFTP.ShowDialog();
                            bool flag4 = GlobalVariable.FTPLib != null;
                            if (flag4)
                            {
                                base.DialogResult = DialogResult.OK;
                                base.Close();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Hiện tại không thể kết nối tới FTP. Hãy liên hệ quản trị hệ thống thiết lập lại thông số kết nối.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Tên đăng nhập hoặc mật khẩu không đúng!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    this.txtLISloginUserName.Focus();
                }
            }
            else
            {
                MessageBox.Show("Không kết nối được cơ sở dữ liệu. Kiểm tra lại thông số kết nối!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.txtServerName.Focus();
            }
            this.Cursor = Cursors.Default;
        }