Beispiel #1
0
        public static CoQuan Insert(SqlTransaction tran, int Pid, string Ten, String Username, bool active)
        {
            CoQuan Item = new CoQuan();

            SqlParameter[] obj = new SqlParameter[14];
            obj[0]  = new SqlParameter("CQ_PID", Pid);
            obj[1]  = new SqlParameter("CQ_ThuTu", 0);
            obj[2]  = new SqlParameter("CQ_Loai", 0);
            obj[3]  = new SqlParameter("CQ_Ten", Ten);
            obj[4]  = new SqlParameter("CQ_Ma", string.Empty);
            obj[5]  = new SqlParameter("CQ_MoTa", string.Empty);
            obj[6]  = new SqlParameter("CQ_PIDList", string.Empty);
            obj[7]  = new SqlParameter("CQ_Level", 0);
            obj[8]  = new SqlParameter("CQ_RowId", Guid.NewGuid());
            obj[9]  = new SqlParameter("CQ_NgayTao", DateTime.Now);
            obj[10] = new SqlParameter("CQ_NgayCapNhat", DateTime.Now);
            obj[11] = new SqlParameter("CQ_NguoiTao", Username);
            obj[12] = new SqlParameter("CQ_Active", active);
            obj[13] = new SqlParameter("CQ_NguoiCapNhat", Username);

            using (IDataReader rd = SqlHelper.ExecuteReader(tran, CommandType.StoredProcedure, "sp_tblCoQuan_Insert_InsertNormal_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
Beispiel #2
0
        public static CoQuan Update(CoQuan Updated)
        {
            CoQuan Item = new CoQuan();

            SqlParameter[] obj = new SqlParameter[15];
            obj[0]  = new SqlParameter("CQ_ID", Updated.ID);
            obj[1]  = new SqlParameter("CQ_PID", Updated.PID);
            obj[2]  = new SqlParameter("CQ_ThuTu", Updated.ThuTu);
            obj[3]  = new SqlParameter("CQ_Loai", Updated.Loai);
            obj[4]  = new SqlParameter("CQ_Ten", Updated.Ten);
            obj[5]  = new SqlParameter("CQ_Ma", Updated.Ma);
            obj[6]  = new SqlParameter("CQ_MoTa", Updated.MoTa);
            obj[7]  = new SqlParameter("CQ_PIDList", Updated.PIDList);
            obj[8]  = new SqlParameter("CQ_Level", Updated.Level);
            obj[9]  = new SqlParameter("CQ_RowId", Updated.RowId);
            obj[10] = new SqlParameter("CQ_NgayTao", Updated.NgayTao);
            obj[11] = new SqlParameter("CQ_NgayCapNhat", Updated.NgayCapNhat);
            obj[12] = new SqlParameter("CQ_NguoiTao", Updated.NguoiTao);
            obj[13] = new SqlParameter("CQ_Active", Updated.Active);
            obj[14] = new SqlParameter("CQ_NguoiCapNhat", Updated.NguoiCapNhat);

            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblCoQuan_Update_UpdateNormal_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
Beispiel #3
0
        public static CoQuan getFromReaderAuto(IDataReader rd)
        {
            CoQuan Item = new CoQuan();

            Item.ID    = (Int32)(rd["CQ_ID"]);
            Item.Ten   = (String)(rd["CQ_Ten"]);
            Item.RowId = (Guid)(rd["CQ_RowId"]);
            return(Item);
        }
Beispiel #4
0
        public static CoQuan SelectByUsername(string Username)
        {
            CoQuan Item = new CoQuan();

            SqlParameter[] obj = new SqlParameter[1];
            obj[0] = new SqlParameter("Username", Username);
            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblCoQuan_Select_SelectByUsername_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
Beispiel #5
0
        public static Member SelectByRowId(String MEM_RowId)
        {
            Member Item = new Member();
            CoQuan _cq  = new CoQuan();

            SqlParameter[] obj = new SqlParameter[1];
            obj[0] = new SqlParameter("MEM_RowId", MEM_RowId);
            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblMember_Select_SelectByRowId_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
Beispiel #6
0
        public static Member Select_InsertIntoLhByUser(string User)
        {
            Member Item = new Member();
            CoQuan _cq  = new CoQuan();

            SqlParameter[] obj = new SqlParameter[1];
            obj[0] = new SqlParameter("username", User);
            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblMember_Select_InsertIntoLhByUser_hiennb", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
Beispiel #7
0
        public static CoQuan SelectByMa(SqlTransaction tran, string CQ_Ma)
        {
            CoQuan Item = new CoQuan();

            SqlParameter[] obj = new SqlParameter[1];
            obj[0] = new SqlParameter("CQ_Ma", CQ_Ma);
            CoQuan _Item = new CoQuan();

            using (IDataReader rd = SqlHelper.ExecuteReader(tran, CommandType.StoredProcedure, "sp_tblCoQuan_Select_SelectByMa_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
Beispiel #8
0
        public static Member SelectByUser(SqlConnection con, string username)
        {
            Member Item = new Member();
            CoQuan _cq  = new CoQuan();

            SqlParameter[] obj = new SqlParameter[1];
            obj[0] = new SqlParameter("username", username);
            using (IDataReader rd = SqlHelper.ExecuteReader(con, CommandType.StoredProcedure, "sp_tblMember_Select_SelectByUsername_Hoangda", obj))
            {
                while (rd.Read())
                {
                    Item    = getFromReader(rd);
                    _cq.Ten = rd["CQ_Ten"].ToString();
                }
            }
            Item._CoQuan = _cq;
            return(Item);
        }
Beispiel #9
0
        public static Member SelectById(Int32 MEM_ID)
        {
            Member Item = new Member();
            CoQuan _cq  = new CoQuan();

            SqlParameter[] obj = new SqlParameter[1];
            obj[0] = new SqlParameter("MEM_ID", MEM_ID);
            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblMember_Select_SelectById_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item    = getFromReader(rd);
                    _cq.Ten = rd["CQ_Ten"].ToString();
                }
            }
            Item._CoQuan = _cq;
            return(Item);
        }
Beispiel #10
0
        public static Role SelectById(Int32 ROLE_ID)
        {
            Role Item = new Role();

            SqlParameter[] obj = new SqlParameter[1];
            obj[0] = new SqlParameter("ROLE_ID", ROLE_ID);
            CoQuan _Item = new CoQuan();

            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblRole_Select_SelectById_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item      = getFromReader(rd);
                    _Item.Ten = rd["CQ_Ten"].ToString();
                }
            }
            Item._CoQuan = _Item;
            return(Item);
        }
Beispiel #11
0
        public static RoleCollection TreeByUsername(string Username, string q, string ROLE_CQ_ID, string Sort)
        {
            RoleCollection List = new RoleCollection();

            SqlParameter[] obj = new SqlParameter[4];
            obj[0] = new SqlParameter("Username", Username);
            if (string.IsNullOrEmpty(q))
            {
                obj[1] = new SqlParameter("q", DBNull.Value);
            }
            else
            {
                obj[1] = new SqlParameter("q", q);
            }
            if (string.IsNullOrEmpty(ROLE_CQ_ID))
            {
                obj[2] = new SqlParameter("ROLE_CQ_ID", DBNull.Value);
            }
            else
            {
                obj[2] = new SqlParameter("ROLE_CQ_ID", ROLE_CQ_ID);
            }
            obj[3] = new SqlParameter("Sort", Sort);
            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblRole_Select_TreeByUsername_linhnx", obj))
            {
                while (rd.Read())
                {
                    CoQuan _item = new CoQuan();
                    _item.Ten = rd["CQ_Ten"].ToString();
                    Role item = new Role();
                    item         = getFromReader(rd);
                    item._CoQuan = _item;
                    List.Add(item);
                }
            }
            return(List);
        }
Beispiel #12
0
        public static Member getFromReader(IDataReader rd)
        {
            Member Item = new Member();

            if (rd.FieldExists("MEM_ID"))
            {
                Item.ID = (Int32)(rd["MEM_ID"]);
            }
            if (rd.FieldExists("MEM_Ho"))
            {
                Item.Ho = (String)(rd["MEM_Ho"]);
            }
            if (rd.FieldExists("MEM_Ten"))
            {
                Item.Ten = (String)(rd["MEM_Ten"]);
            }
            if (rd.FieldExists("MEM_Mota"))
            {
                Item.Mota = (String)(rd["MEM_Mota"]);
            }
            if (rd.FieldExists("MEM_Anh"))
            {
                Item.Anh = (String)(rd["MEM_Anh"]);
            }
            if (rd.FieldExists("MEM_CQ_ID"))
            {
                Item.CQ_ID = (Int32)(rd["MEM_CQ_ID"]);
            }
            if (rd.FieldExists("MEM_Username"))
            {
                Item.Username = (String)(rd["MEM_Username"]);
            }
            if (rd.FieldExists("MEM_Password"))
            {
                Item.Password = (String)(rd["MEM_Password"]);
            }
            if (rd.FieldExists("MEM_Luong"))
            {
                Item.Luong = (double)(rd["MEM_Luong"]);
            }
            if (rd.FieldExists("MEM_NgayTao"))
            {
                Item.NgayTao = (DateTime)(rd["MEM_NgayTao"]);
            }
            if (rd.FieldExists("MEM_NgayCapNhat"))
            {
                Item.NgayCapNhat = (DateTime)(rd["MEM_NgayCapNhat"]);
            }
            if (rd.FieldExists("MEM_Email"))
            {
                Item.Email = (String)(rd["MEM_Email"]);
            }
            if (rd.FieldExists("MEM_Mobile"))
            {
                Item.Mobile = (String)(rd["MEM_Mobile"]);
            }
            if (rd.FieldExists("MEM_Phone"))
            {
                Item.Phone = (String)(rd["MEM_Phone"]);
            }
            if (rd.FieldExists("MEM_DiaChi"))
            {
                Item.DiaChi = (String)(rd["MEM_DiaChi"]);
            }
            if (rd.FieldExists("MEM_Active"))
            {
                Item.Active = (Boolean)(rd["MEM_Active"]);
            }
            if (rd.FieldExists("MEM_Khoa"))
            {
                Item.Khoa = (Boolean)(rd["MEM_Khoa"]);
            }
            if (rd.FieldExists("MEM_XacNhan"))
            {
                Item.XacNhan = (Boolean)(rd["MEM_XacNhan"]);
            }
            if (rd.FieldExists("MEM_NgayXacNhan"))
            {
                Item.NgayXacNhan = (Boolean)(rd["MEM_NgayXacNhan"]);
            }
            if (rd.FieldExists("MEM_ChungThuc"))
            {
                Item.ChungThuc = (Boolean)(rd["MEM_ChungThuc"]);
            }
            if (rd.FieldExists("MEM_Admin"))
            {
                Item.Admin = (Boolean)(rd["MEM_Admin"]);
            }
            if (rd.FieldExists("MEM_RowId"))
            {
                Item.RowId = (Guid)(rd["MEM_RowId"]);
            }
            if (rd.FieldExists("MEM_NguoiTao"))
            {
                Item.NguoiTao = (String)(rd["MEM_NguoiTao"]);
            }
            if (rd.FieldExists("MEM_Loai"))
            {
                Item.Loai = (Int32)(rd["MEM_Loai"]);
            }
            if (rd.FieldExists("MEM_RefUsername"))
            {
                Item.RefUsername = (String)(rd["MEM_RefUsername"]);
            }
            if (rd.FieldExists("MEM_ThuKy"))
            {
                Item.ThuKy = (Boolean)(rd["MEM_ThuKy"]);
            }
            if (rd.FieldExists("MEM_Loai_Ten"))
            {
                Item.Loai_Ten = (String)(rd["MEM_Loai_Ten"]);
            }
            if (rd.FieldExists("GH_Ten"))
            {
                Item.GH_Ten = (String)(rd["GH_Ten"]);
            }
            if (rd.FieldExists("GH_ID"))
            {
                Item.GH_ID = (Int32)(rd["GH_ID"]);
            }
            if (rd.FieldExists("MEM_Tinh"))
            {
                Item.Tinh = (Int32)(rd["MEM_Tinh"]);
            }
            CoQuan _CQ = new CoQuan();

            if (rd.FieldExists("CQ_Ten"))
            {
                _CQ.Ten = (String)(rd["CQ_Ten"]);
            }
            Item._CoQuan = _CQ;
            return(Item);
        }
Beispiel #13
0
        public static CoQuan getFromReaderNSD(IDataReader rd)
        {
            CoQuan Item = new CoQuan();

            if (rd.FieldExists("CQ_ID"))
            {
                Item.ID = (Int32)(rd["CQ_ID"]);
            }
            if (rd.FieldExists("CQ_PID"))
            {
                Item.PID = (Int32)(rd["CQ_PID"]);
            }
            if (rd.FieldExists("CQ_ThuTu"))
            {
                Item.ThuTu = (Int32)(rd["CQ_ThuTu"]);
            }
            if (rd.FieldExists("CQ_Loai"))
            {
                Item.Loai = (Int32)(rd["CQ_Loai"]);
            }
            if (rd.FieldExists("CQ_Ten"))
            {
                Item.Ten = (String)(rd["CQ_Ten"]);
            }
            if (rd.FieldExists("CQ_Ma"))
            {
                Item.Ma = (String)(rd["CQ_Ma"]);
            }
            if (rd.FieldExists("CQ_MoTa"))
            {
                Item.MoTa = (String)(rd["CQ_MoTa"]);
            }
            if (rd.FieldExists("CQ_PIDList"))
            {
                Item.PIDList = (String)(rd["CQ_PIDList"]);
            }
            if (rd.FieldExists("CQ_Level"))
            {
                Item.Level = (Int32)(rd["CQ_Level"]);
            }
            if (rd.FieldExists("CQ_RowId"))
            {
                Item.RowId = (Guid)(rd["CQ_RowId"]);
            }
            if (rd.FieldExists("CQ_NgayTao"))
            {
                Item.NgayTao = (DateTime)(rd["CQ_NgayTao"]);
            }
            if (rd.FieldExists("CQ_NgayCapNhat"))
            {
                Item.NgayCapNhat = (DateTime)(rd["CQ_NgayCapNhat"]);
            }
            if (rd.FieldExists("CQ_NguoiTao"))
            {
                Item.NguoiTao = (String)(rd["CQ_NguoiTao"]);
            }
            if (rd.FieldExists("CQ_Active"))
            {
                Item.Active = (Boolean)(rd["CQ_Active"]);
            }
            if (rd.FieldExists("CQ_NguoiCapNhat"))
            {
                Item.NguoiCapNhat = (String)(rd["CQ_NguoiCapNhat"]);
            }
            if (rd.FieldExists("NSD"))
            {
                Item.NSD = Convert.ToInt32(rd["NSD"]);
            }
            return(Item);
        }