示例#1
0
        public void ConnectionTestDB()
        {
            ADODB.Connection conn      = null;
            AdoHelper        helper    = null;
            AdoHelper        helperRef = null;

            AdoHelper newHelper = null;

            try
            {
                helper = AdoHelper.ThreadInstance("DSN={2};DB={2};UID={0};PWD={1};HOST=192.6.4.*;PORT=5900", DbProviderType.Odbc);
                conn   = helper.Connection();
                //是否成功连接到数据库。
                Assert.AreEqual(conn.State, 1);
                helperRef = AdoHelper.ThreadInstance("DSN={2};DB={2};UID={0};PWD={1};HOST=192.6.4.*;PORT=5900", DbProviderType.Odbc);
                //线程实例是否有效
                Assert.AreEqual(helper, helperRef);
                using (newHelper = AdoHelper.ThreadInstance("DSN={2};DB={2};UID={0};PWD={1};HOST=192.6.4.*;PORT=5900", DbProviderType.Odbc))
                {
                    //一个新的helper
                    Assert.AreNotEqual(helper, newHelper);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(string.Format("{0}\n{1}", ex.Message, ex.ToString()));
                throw;
            }
            finally
            {
                helper.Dispose();
                //是否正常关闭了数据库。
                Assert.AreEqual(conn.State, 0);
            }
        }
示例#2
0
        public static string UpdateAdmissionCriteria(AdmissionCriteria admissionCriteria)
        {
            AdoHelper objHelper = new AdoHelper(ConfigurationManager.ConnectionStrings["con"].ToString());

            SqlParameter[] sqlParameter =
            {
                new SqlParameter("@SetAction",           admissionCriteria.SetAction.ToUpper()),
                new SqlParameter("@CriteriaId",          admissionCriteria.CriteriaId),
                new SqlParameter("@CriteriaDescription", admissionCriteria.CriteriaDescription)
            };

            Object obj    = objHelper.ExecScalarProc("Gkl_USP_UpdateAdmissionCriteria", sqlParameter);
            string status = "updated";

            objHelper.Dispose();
            return(status);
        }
示例#3
0
        public static string InsUpdDelRole(Role role)
        {
            AdoHelper objHelper = new AdoHelper(ConfigurationManager.ConnectionStrings["con"].ToString());

            SqlParameter[] sqlParameter =
            {
                new SqlParameter("@SetAction", role.SetAction.ToUpper()),
                new SqlParameter("@RoleId",    role.RoleId),
                new SqlParameter("@RoleName",  role.RoleName),
                new SqlParameter("@Active",    role.Active)
            };
            Object obj = objHelper.ExecScalarProc("GKL_USP_UpdateRoleMaster", sqlParameter);
            string status;

            status = "updated";
            objHelper.Dispose();
            return(status);
        }
示例#4
0
        public static string UpdateFeeType(FeeType feeType)
        {
            AdoHelper objHelper = new AdoHelper(ConfigurationManager.ConnectionStrings["con"].ToString());

            SqlParameter[] sqlParameter =
            {
                new SqlParameter("@SetAction",           feeType.SetAction.ToUpper()),
                new SqlParameter("@FeeTypeId",           feeType.FeeTypeId),
                new SqlParameter("@FeeTypeName",         feeType.FeeTypeName),
                new SqlParameter("@FeeTypeDescription ", feeType.FeeTypeDescription)
            };

            Object obj    = objHelper.ExecScalarProc("GKL_USP_UpdateFeeType", sqlParameter);
            string status = "updated";

            objHelper.Dispose();
            return(status);
        }
示例#5
0
        public static string UpdateChapter(Chapter chapter)
        {
            AdoHelper objHelper = new AdoHelper(ConfigurationManager.ConnectionStrings["con"].ToString());

            SqlParameter[] sqlParameter =
            {
                new SqlParameter("@SetAction",    chapter.SetAction.ToUpper()),
                new SqlParameter("@ChapterId",    chapter.ChapterId),
                new SqlParameter("@ChapterCode",  chapter.ChapterCode),
                new SqlParameter("@ChapterName ", chapter.ChapterName)
            };

            Object obj    = objHelper.ExecScalarProc("Gkl_USP_UpdateChapter", sqlParameter);
            string status = "updated";

            objHelper.Dispose();
            return(status);
        }
示例#6
0
        public static string UpdateDegreeCategory(DegreeCategory degreeCategory)
        {
            AdoHelper objHelper = new AdoHelper(ConfigurationManager.ConnectionStrings["con"].ToString());

            SqlParameter[] sqlParameter =
            {
                new SqlParameter("@SetAction",           degreeCategory.SetAction.ToUpper()),
                new SqlParameter("@DegreeCategoryId",    degreeCategory.DegreeCategoryId),
                new SqlParameter("@DegreeCategoryCode",  degreeCategory.DegreeCategoryCode),
                new SqlParameter("@DegreeCategoryName ", degreeCategory.DegreeCategoryName)
            };

            Object obj    = objHelper.ExecScalarProc("Gkl_USP_UpdateDegreeCategory", sqlParameter);
            string status = "updated";

            objHelper.Dispose();
            return(status);
        }
示例#7
0
        public static string UpdateProgram(Program program)
        {
            AdoHelper objHelper = new AdoHelper(ConfigurationManager.ConnectionStrings["con"].ToString());

            SqlParameter[] sqlParameter =
            {
                new SqlParameter("@SetAction",    program.SetAction.ToUpper()),
                new SqlParameter("@ProgramId",    program.ProgramId),
                new SqlParameter("@ProgramCode",  program.ProgramCode),
                new SqlParameter("@ProgramName",  program.ProgramName),
                new SqlParameter("@DegreeTypeId", program.DegreeTypeId),
            };

            Object obj    = objHelper.ExecScalarProc("Gkl_USP_UpdateProgram", sqlParameter);
            string strRes = (String)obj;

            objHelper.Dispose();
            return(strRes);
        }
示例#8
0
        public static string UpdateBranch(Branch branch)
        {
            AdoHelper objHelper = new AdoHelper(ConfigurationManager.ConnectionStrings["con"].ToString());

            SqlParameter[] sqlParameter =
            {
                new SqlParameter("@SetAction",   branch.SetAction.ToUpper()),
                new SqlParameter("@BranchId",    branch.BranchId),
                new SqlParameter("@BranchCode",  branch.BranchCode),
                new SqlParameter("@BranchName ", branch.BranchName),
                new SqlParameter("@ProgramId ",  branch.ProgramId)
            };

            Object obj = objHelper.ExecScalarProc("Gkl_USP_UpdateBranch", sqlParameter);
            string status;

            status = "updated";
            objHelper.Dispose();
            return(status);
        }
示例#9
0
        public static string UpdateCourse(Course course)
        {
            AdoHelper objHelper = new AdoHelper(ConfigurationManager.ConnectionStrings["con"].ToString());

            SqlParameter[] sqlParameter =
            {
                new SqlParameter("@SetAction",    course.SetAction.ToUpper()),
                new SqlParameter("@CourseId",     course.CourseId),
                new SqlParameter("@CourseCode",   course.CourseCode),
                new SqlParameter("@CourseName ",  course.CourseName),
                new SqlParameter("@CourseTypeId", course.CourseTypeId),
                new SqlParameter("@SemesterId",   course.@SemesterId)
            };

            Object obj = objHelper.ExecScalarProc("Gkl_USP_UpdateCourse", sqlParameter);
            string status;

            status = "updated";
            objHelper.Dispose();
            return(status);
        }
示例#10
0
        public static string InsUpdDelUser(User user)
        {
            AdoHelper objHelper = new AdoHelper(ConfigurationManager.ConnectionStrings["con"].ToString());

            SqlParameter[] sqlParameter =
            {
                new SqlParameter("@SetAction",    user.SetAction.ToUpper()),
                new SqlParameter("@UserId",       user.UserId),
                new SqlParameter("@UserName",     user.UserName),
                new SqlParameter("@EmailAddress", user.EmailAddress),
                new SqlParameter("@PhoneNumber",  user.PhoneNumber),
                new SqlParameter("@Gender",       user.Gender),
                new SqlParameter("@password",     user.password),
                new SqlParameter("@RoleId",       user.RoleId),
                new SqlParameter("@Active",       user.Active)
            };
            Object obj = objHelper.ExecScalarProc("GKL_USP_UpdateUserMaster", sqlParameter);
            string status;

            status = "updated";
            objHelper.Dispose();
            return(status);
        }
示例#11
0
        public static string InsUpdDelMenu(Menu menu)
        {
            AdoHelper objHelper = new AdoHelper(ConfigurationManager.ConnectionStrings["con"].ToString());

            SqlParameter[] sqlParameter =
            {
                new SqlParameter("@SetAction", menu.SetAction.ToUpper()),
                new SqlParameter("@MenuId",    menu.MenuId),
                new SqlParameter("@MenuName",  menu.MenuName),
                new SqlParameter("@MenuType",  menu.MenuType),
                new SqlParameter("@MenuOrder", menu.MenuOrder),
                new SqlParameter("@MenuIcon",  menu.MenuIcon),
                new SqlParameter("@Menu_Uri",  menu.Menu_Uri),
                new SqlParameter("@ParentId",  menu.ParentId),
                new SqlParameter("@Active",    menu.Active)
            };
            Object obj = objHelper.ExecScalarProc("GKL_USP_UpateMenuMaster", sqlParameter);
            string status;

            status = "updated";
            objHelper.Dispose();
            return(status);
        }