コード例 #1
0
        protected override object GetDataFromDataRow(DataTable dt, int i)
        {
            GIANGVIEN obj = new GIANGVIEN();

            obj.GIV_ID = int.Parse(dt.Rows[i]["GIV_ID"].ToString());
            //some column
            return((object)obj);
        }
コード例 #2
0
        public void delete(GIANGVIEN teacher)
        {
            SqlParameter[] prams     = { MakeInParam("@GIV_ID", SqlDbType.Int, 4, teacher.GIV_ID) };
            int            errorcode = RunProc("usp_DeleteGIANGVIEN", prams);

            if (errorcode > 0)
            {
                throw new Exception("Error");
            }
        }
コード例 #3
0
        /// <summary>
        /// GET TEACHER BY NAME
        /// </summary>
        /// <param name="teacher"></param>
        /// <returns></returns>
        public DataTable getDsTeacher_ByName(GIANGVIEN teacher)
        {
            connect();
            DataSet DS = new DataSet();

            SqlParameter[] prams =
            {
                MakeInParam("@GIV_ID", SqlDbType.Int, 4, teacher.GIV_ID)
            };

            int errorcode = RunProcDS("usp_SelectGIANGVIEN",
                                      prams, out DS);

            if (errorcode > 0)
            {
                throw new Exception("Error!");
            }

            return(DS.Tables[0]);
        }
コード例 #4
0
        public void insert(GIANGVIEN teacher)
        {
            SqlParameter[] prams = { MakeInParam("@GIV_Code",    SqlDbType.NVarChar,  50, teacher.GIV_Code),
                                     MakeInParam("@GIV_Name",    SqlDbType.NVarChar,  50, teacher.GIV_Name),
                                     MakeInParam("@GIV_Phone",   SqlDbType.VarChar,   12, teacher.GIV_Phone),
                                     MakeInParam("@GIV_Address", SqlDbType.NVarChar, 100, teacher.GIV_Address),
                                     MakeInParam("@GIV_Khoa",    SqlDbType.NVarChar,  50, teacher.GIV_Khoa),
                                     MakeInParam("@GIV_ID",      SqlDbType.Int,        4, teacher.GIV_ID)
                                     //MakeInParam("@Address",SqlDbType.NVarChar ,250,teacher.TRE_Address ),
                                     //MakeInParam("@GraduatedSpeciality",SqlDbType.NVarChar,150,teacher.TRE_GraduatedSpeciality),
                                     //MakeInParam("@GraduatedYear",SqlDbType.DateTime,0,Trainee.TRE_GraduatedYear ),
                                     //MakeInParam("@Certificates",SqlDbType.NVarChar,250,Trainee.TRE_Certificates ),
                                     //MakeInParam("@ActionOpt",SqlDbType.Bit,0,1)
            };
            int            errorcode = RunProc("usp_InsertGIANGVIEN", prams);

            if (errorcode > 0)
            {
                throw new Exception("Error");
            }
        }