Ejemplo n.º 1
0
 public static void UpdateMulti(KTNN KTNN_Active)
 {
     SqlParameter[] obj = new SqlParameter[2];
     obj[0] = new SqlParameter("KTNN_ID", KTNN_Active.multiID);
     obj[1] = new SqlParameter("KTNN_Active", KTNN_Active.Active);
     SqlHelper.ExecuteNonQuery(DAL.con(), CommandType.StoredProcedure, "sp_tblKTNN_Update_UpdateMultiById_hungpm", obj);
 }
Ejemplo n.º 2
0
        public static KTNN SelectByIdViewFD(Int64 KTNN_ID)
        {
            KTNN Item = new KTNN();

            SqlParameter[] obj = new SqlParameter[1];
            obj[0] = new SqlParameter("KTNN_ID", KTNN_ID);
            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblKTNN_Select_SelectById_linhnxViewFD", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
Ejemplo n.º 3
0
        public static KTNN SelectByIdView(Int32 VBD_ID)
        {
            KTNN Item = new KTNN();

            SqlParameter[] obj = new SqlParameter[1];
            obj[0] = new SqlParameter("KTNN_ID", VBD_ID);
            List <Files> filelist = new List <Files>();

            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblKTNN_Select_SelectByIdView_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                    Files item = new Files();
                    if (rd.FieldExists("F_Ten"))
                    {
                        item.Ten = (String)(rd["F_Ten"]);
                    }

                    if (rd.FieldExists("F_ID"))
                    {
                        item.ID = (Int32)(rd["F_ID"]);
                    }
                    if (rd.FieldExists("F_NguoiTao"))
                    {
                        item.NguoiTao = (String)(rd["F_NguoiTao"]);
                    }
                    if (rd.FieldExists("F_Size"))
                    {
                        item.Size = (Int32)(rd["F_Size"]);
                    }
                    if (rd.FieldExists("F_MimeType"))
                    {
                        item.MimeType = (String)(rd["F_MimeType"]);
                    }
                    if (rd.FieldExists("F_Download"))
                    {
                        item.Download = (Int32)(rd["F_Download"]);
                    }
                    filelist.Add(item);
                }
            }
            Item.Filelist = filelist;
            return(Item);
        }
Ejemplo n.º 4
0
        public static void UpdateHetHanMulti(KTNN TinHetHan)
        {
            SqlParameter[] obj = new SqlParameter[3];
            obj[0] = new SqlParameter("KTNN_ID", TinHetHan.multiID);
            obj[1] = new SqlParameter("KTNN_HetHan", TinHetHan.HetHan);
            obj[2] = new SqlParameter("KTNN_NgayHetHan", TinHetHan.NgayHetHan);
            string htl = string.Format("{0:dd/MM/yy}", TinHetHan.NgayHetHan);

            if (htl != "01/01/01")
            {
                obj[2] = new SqlParameter("KTNN_NgayHetHan", TinHetHan.NgayHetHan);
            }
            else
            {
                obj[2] = new SqlParameter("KTNN_NgayHetHan", DBNull.Value);
            }
            SqlHelper.ExecuteNonQuery(DAL.con(), CommandType.StoredProcedure, "sp_tblKTNN_Update_UpdateHetHanMultiById_hungpm", obj);
        }
Ejemplo n.º 5
0
        public static KTNN getFromReader(IDataReader rd)
        {
            KTNN Item = new KTNN();

            if (rd.FieldExists("KTNN_ID"))
            {
                Item.ID = (Int32)(rd["KTNN_ID"]);
            }
            if (rd.FieldExists("_KTNN_ID"))
            {
                Item._ID = (Int32)(rd["_KTNN_ID"]);
            }
            if (rd.FieldExists("KTNN_GH_ID"))
            {
                Item.GH_ID = (Int32)(rd["KTNN_GH_ID"]);
            }
            if (rd.FieldExists("KTNN_DM_ID"))
            {
                Item.DM_ID = (Int32)(rd["KTNN_DM_ID"]);
            }
            if (rd.FieldExists("KTNN_Lang"))
            {
                Item.Lang = (String)(rd["KTNN_Lang"]);
            }
            if (rd.FieldExists("KTNN_LangBased"))
            {
                Item.LangBased = (Boolean)(rd["KTNN_LangBased"]);
            }
            if (rd.FieldExists("KTNN_LangBased_ID"))
            {
                Item.LangBased_ID = (Int32)(rd["KTNN_LangBased_ID"]);
            }
            if (rd.FieldExists("KTNN_Alias"))
            {
                Item.Alias = (String)(rd["KTNN_Alias"]);
            }
            if (rd.FieldExists("KTNN_DM_Ten"))
            {
                Item.DM_Ten = (String)(rd["KTNN_DM_Ten"]);
            }
            if (rd.FieldExists("KTNN_Ten"))
            {
                Item.Ten = (String)(rd["KTNN_Ten"]);
            }
            if (rd.FieldExists("KTNN_MoTa"))
            {
                Item.MoTa = (String)(rd["KTNN_MoTa"]);
            }
            if (rd.FieldExists("KTNN_NoiDung"))
            {
                Item.NoiDung = (String)(rd["KTNN_NoiDung"]);
            }
            if (rd.FieldExists("KTNN_KeyWords"))
            {
                Item.KeyWords = (String)(rd["KTNN_KeyWords"]);
            }
            if (rd.FieldExists("KTNN_Description"))
            {
                Item.Description = (String)(rd["KTNN_Description"]);
            }
            if (rd.FieldExists("KTNN_TacGia"))
            {
                Item.TacGia = (String)(rd["KTNN_TacGia"]);
            }
            if (rd.FieldExists("KTNN_Anh"))
            {
                Item.Anh = (String)(rd["KTNN_Anh"]);
            }
            if (rd.FieldExists("KTNN_ThuTu"))
            {
                Item.ThuTu = (Int32)(rd["KTNN_ThuTu"]);
            }
            if (rd.FieldExists("KTNN_Nguon"))
            {
                Item.Nguon = (String)(rd["KTNN_Nguon"]);
            }
            if (rd.FieldExists("KTNN_NgayTao"))
            {
                Item.NgayTao = (DateTime)(rd["KTNN_NgayTao"]);
            }
            if (rd.FieldExists("KTNN_NguoiTao"))
            {
                Item.NguoiTao = (String)(rd["KTNN_NguoiTao"]);
            }
            if (rd.FieldExists("KTNN_NgayCapNhat"))
            {
                Item.NgayCapNhat = (DateTime)(rd["KTNN_NgayCapNhat"]);
            }
            if (rd.FieldExists("KTNN_NguoiCapNhat"))
            {
                Item.NguoiCapNhat = (String)(rd["KTNN_NguoiCapNhat"]);
            }
            if (rd.FieldExists("KTNN_NgayDang"))
            {
                Item.NgayDang = (DateTime)(rd["KTNN_NgayDang"]);
            }
            if (rd.FieldExists("KTNN_NgayHetHan"))
            {
                Item.NgayHetHan = (DateTime)(rd["KTNN_NgayHetHan"]);
            }
            if (rd.FieldExists("KTNN_Views"))
            {
                Item.Views = (Int32)(rd["KTNN_Views"]);
            }
            if (rd.FieldExists("KTNN_Hot"))
            {
                Item.Hot = (Boolean)(rd["KTNN_Hot"]);
            }
            if (rd.FieldExists("KTNN_Active"))
            {
                Item.Active = (Boolean)(rd["KTNN_Active"]);
            }
            if (rd.FieldExists("KTNN_Publish"))
            {
                Item.Publish = (Boolean)(rd["KTNN_Publish"]);
            }
            if (rd.FieldExists("KTNN_HetHan"))
            {
                Item.HetHan = (Boolean)(rd["KTNN_HetHan"]);
            }
            if (rd.FieldExists("KTNN_Moi"))
            {
                Item.Moi = (Boolean)(rd["KTNN_Moi"]);
            }
            if (rd.FieldExists("KTNN_RowId"))
            {
                Item.RowId = (Guid)(rd["KTNN_RowId"]);
            }
            if (rd.FieldExists("KTNN_DM_Ten"))
            {
                Item.DM_Ten = (String)(rd["KTNN_DM_Ten"]);
            }
            return(Item);
        }
Ejemplo n.º 6
0
        public static KTNN Update(KTNN Updated)
        {
            KTNN Item = new KTNN();

            SqlParameter[] obj = new SqlParameter[29];
            obj[0]  = new SqlParameter("KTNN_ID", Updated.ID);
            obj[1]  = new SqlParameter("KTNN_GH_ID", Updated.GH_ID);
            obj[2]  = new SqlParameter("KTNN_DM_ID", Updated.DM_ID);
            obj[3]  = new SqlParameter("KTNN_Lang", Updated.Lang);
            obj[4]  = new SqlParameter("KTNN_LangBased", Updated.LangBased);
            obj[5]  = new SqlParameter("KTNN_LangBased_ID", Updated.LangBased_ID);
            obj[6]  = new SqlParameter("KTNN_Alias", Updated.Alias);
            obj[7]  = new SqlParameter("KTNN_Ten", Updated.Ten);
            obj[8]  = new SqlParameter("KTNN_MoTa", Updated.MoTa);
            obj[9]  = new SqlParameter("KTNN_NoiDung", Updated.NoiDung);
            obj[10] = new SqlParameter("KTNN_TacGia", Updated.TacGia);
            obj[11] = new SqlParameter("KTNN_Anh", Updated.Anh);
            obj[12] = new SqlParameter("KTNN_ThuTu", Updated.ThuTu);
            obj[13] = new SqlParameter("KTNN_Nguon", Updated.Nguon);
            obj[14] = new SqlParameter("KTNN_NgayTao", Updated.NgayTao);
            obj[15] = new SqlParameter("KTNN_NguoiTao", Updated.NguoiTao);
            // obj[16] = new SqlParameter("KTNN_NgayCapNhat", Updated.NgayCapNhat);
            string capnhat = string.Format("{0:dd/MM/yy}", Updated.NgayCapNhat);

            if (capnhat != "01/01/01")
            {
                obj[16] = new SqlParameter("KTNN_NgayCapNhat", Updated.NgayCapNhat);
            }
            else
            {
                obj[16] = new SqlParameter("KTNN_NgayCapNhat", DBNull.Value);
            }
            obj[17] = new SqlParameter("KTNN_NguoiCapNhat", Updated.NguoiCapNhat);


            string htl = string.Format("{0:dd/MM/yy}", Updated.NgayDang);

            if (htl != "01/01/01")
            {
                obj[18] = new SqlParameter("KTNN_NgayDang", Updated.NgayDang);
            }
            else
            {
                obj[18] = new SqlParameter("KTNN_NgayDang", DBNull.Value);
            }
            // obj[16] = new SqlParameter("KTNN_NgayHetHan", Updated.NgayHetHan);
            string htl1 = string.Format("{0:dd/MM/yy}", Updated.NgayHetHan);

            if (htl1 != "01/01/01")
            {
                obj[19] = new SqlParameter("KTNN_NgayHetHan", Updated.NgayHetHan);
            }
            else
            {
                obj[19] = new SqlParameter("KTNN_NgayHetHan", DBNull.Value);
            }

            //obj[18] = new SqlParameter("KTNN_NgayDang", Updated.NgayDang);
            //obj[19] = new SqlParameter("KTNN_NgayHetHan", Updated.NgayHetHan);
            obj[20] = new SqlParameter("KTNN_Views", Updated.Views);
            obj[21] = new SqlParameter("KTNN_Hot", Updated.Hot);
            obj[22] = new SqlParameter("KTNN_Active", Updated.Active);
            obj[23] = new SqlParameter("KTNN_Publish", Updated.Publish);
            obj[24] = new SqlParameter("KTNN_HetHan", Updated.HetHan);
            obj[25] = new SqlParameter("KTNN_Moi", Updated.Moi);
            obj[26] = new SqlParameter("KTNN_RowId", Updated.RowId);
            obj[27] = new SqlParameter("KTNN_KeyWords", Updated.KeyWords);
            obj[28] = new SqlParameter("KTNN_Description", Updated.Description);
            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblKTNN_Update_UpdateNormal_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }