当前位置: 首页>>代码示例>>C#>>正文


C# DAL.ClassConnectDB类代码示例

本文整理汇总了C#中DAL.ClassConnectDB的典型用法代码示例。如果您正苦于以下问题:C# ClassConnectDB类的具体用法?C# ClassConnectDB怎么用?C# ClassConnectDB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ClassConnectDB类属于DAL命名空间,在下文中一共展示了ClassConnectDB类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: checkForgotPassword

        public static Entity.Employee checkForgotPassword(string username, string email)
        {

            try
            {
                string sqlforgot = "  SELECT * FROM Employee WHERE [email protected] AND [email protected]";
                string Addvalue = "@user,@email";
                string value = username + "," + email;

                Entity.Employee empCheck = new Entity.Employee();

                ClassConnectDB conn = new ClassConnectDB();
                SqlDataReader readCheckRole = conn.SelectWhereSqlDataReader(sqlforgot, Addvalue, value);
                //SqlDataReader readCheckRole = conn.SelectSqlDataReader(sqlforgot);
                if (readCheckRole.Read())
                {
                    empCheck.Emp_FName = readCheckRole["Emp_FName"].ToString();
                    empCheck.Emp_LName = readCheckRole["Emp_LName"].ToString();
                    empCheck.Emp_username = readCheckRole["Emp_username"].ToString();
                    empCheck.Emp_password = readCheckRole["Emp_password"].ToString();
                    empCheck.Emp_Email = readCheckRole["Emp_Email"].ToString();
                }
                conn.Close();
                return empCheck;

            }
            catch (Exception)
            {

                return null;
            }

        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:33,代码来源:Employee.cs

示例2: selectCuriID

        public static string selectCuriID(string curYear, string curCourse, string curGroup)
        {
                    ClassConnectDB con=new ClassConnectDB();
            string reid="";
            try
            {
            string [email protected]"SELECT Curri_Id
                                FROM Curriculum Where [email protected] AND [email protected] AND [email protected]";
            string Addvalue="@year,@co,@group";
            string value=curYear+","+curCourse+","+curGroup;
           SqlDataReader dr= con.SelectWhereSqlDataReader(sqlSelect,Addvalue,value);
           if (dr.Read())
           {
               reid = dr["Curri_Id"].ToString();
           }


            return reid;

            }
            catch (Exception)
            {

                return "";
            }
            con.Close();
            
        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:28,代码来源:Curriculum.cs

示例3: insertDetailTeachAfter

        public static bool insertDetailTeachAfter(string year, string level, string term, string group, string subject, string userid)
        {
            ClassConnectDB conn = new ClassConnectDB();

            string sqlcheckvalue = "SELECT  DetailTech_ID FROM  DetailTech WHERE [email protected] and [email protected] and DetailTeach_Year [email protected] and [email protected] and  [email protected]";
            string addvaluecheck = "@level,@class,@year,@term,@code";
            string valuecheck = level + "," + group + "," + year + "," + term + "," + subject;
            SqlDataReader drrcheck = conn.SelectWhereSqlDataReader(sqlcheckvalue, addvaluecheck, valuecheck);
            if (!drrcheck.HasRows)
            {
                string sql = @"INSERT INTO DetailTech
                      (DetailTech_Level, DetailTech_Class, DetailTeach_Year, DetailTech_Term, StructSub_Code, Create_user, CreateDate)
                        VALUES(@level,@class,@year,@term,@code,@user,getDate())";

                string addvalue = "@level,@class,@year,@term,@code,@user";
                string value = level + "," + group + "," + year + "," + term + "," + subject + "," + userid;
                bool insert = conn.InsertValue(sql, addvalue, value);
                conn.Close();
                if (insert) { return true; }
                else { return false; }
            }
            else
            {
                return false;
            }
        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:26,代码来源:DetailTeach.cs

示例4: getCommentForPost

        public static DataTable getCommentForPost(int thePost)
        {
            try
                {
                    string sql = @"SELECT   TOP 1  [KmComPost_ID]
                                  ,[KmPost_ID]
                                  ,[ComPost_Detail]
                                  ,REPLACE(CONVERT(VARCHAR(11), Create_date, 106), ' ', '-') AS datepostkm
                                  ,CONVERT(VARCHAR(12),Create_time ,114) as timepostkm
                                  ,[Create_user_id]
								  ,[Create_user_type]
                                  FROM KmCommentPost where KmPost_ID='" + thePost + "'order by [Create_date]  asc ";

                    ClassConnectDB conn = new ClassConnectDB();
                    SqlDataReader drr = conn.SelectSqlDataReader(sql);
                    DataTable dt = new DataTable();
                    dt.Load(drr);

                    conn.Close();
                    return dt;
                }
                catch (Exception)
                {
                    return null;
                }


        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:28,代码来源:Knowledge.cs

示例5: checkCredit

        public static int checkCredit(string year, string level, string term, string group)
        {
            try
            {
                /****************************
                 * function ตรวจสอบหน่วยกิตทั้งหมด
                 *
                 * **************************/
                int creditAll = 0;
                ClassConnectDB conn = new ClassConnectDB();
                string sql = @"SELECT sum (CONVERT(int,(SUBSTRING([StructSub_Credit], 1 , 1 )) ))as credit
                          FROM [WEBCSDB].[dbo].[StructSubject]
                          where StructSub_Code in (
                          SELECT TOP 1000 [StructSub_Code]
                          FROM  [DetailTech]
                          where [DetailTech_Level]='" + level + "' and [DetailTech_Class]='" + group + "' and [DetailTeach_Year]='" + year + "' and [DetailTech_Term]='" + term + "' )";

                SqlDataReader drr = conn.SelectSqlDataReader(sql);
                if (drr.Read())
                {
                    creditAll = Convert.ToInt32(drr["credit"].ToString());
                }
                return creditAll;
            }
            catch (Exception)
            {
                return 0;
            }
        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:29,代码来源:DetailTeach.cs

示例6: insertSubject

        public static bool insertSubject(Entity.CurriculumInfo subject)
        {
            
             subcode=subject.StructSub_Code.ToString();
            subNameTha=subject.StructSub_NameTha.ToString();
            subNameEn=subject.StructSub_NameEn.ToString();
             detail=subject.StructSub_Detail.ToString();
            subCre=subject.StructSub_Credit.ToString();
            curID=subject.Curri_Id.ToString();

            ClassConnectDB conn = new ClassConnectDB();
            //conn.TransStart();
            try
            {

                string insertSubject = "INSERT INTO StructSubject(StructSub_Code, StructSub_NameTha, StructSub_NameEn, StructSub_Detail, StructSub_Credit, Curri_Id)VALUES(@code,@nameTha,@nameEn,@detail,@struCre,@curiID)";
                string AddvalueSubject = "@code,@nameTha,@nameEn,@detail,@struCre,@curiID";
                string value = subcode + "," + subNameTha + "," + subNameEn + "," + detail + "," + subCre + "," + curID;
                conn.InsertValue(insertSubject,AddvalueSubject,value);

                return true;

            }
            catch (Exception)
            {
                return true;
            }
            conn.Close();

            
        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:31,代码来源:Curriculum.cs

示例7: checkForgotPassword

        public static Entity.Teacher checkForgotPassword(string username, string email)
        {
            try
            {
                string sqlforgot = "  SELECT * FROM Teacher WHERE [email protected] AND [email protected]";
                string Addvalue = "@user,@email";
                string value = username + "," + email;

                Entity.Teacher tchCheck = new Entity.Teacher();

                ClassConnectDB conn = new ClassConnectDB();
                SqlDataReader readCheckRole = conn.SelectWhereSqlDataReader(sqlforgot, Addvalue, value);
                //SqlDataReader readCheckRole = conn.SelectSqlDataReader(sqlforgot);
                if (readCheckRole.Read())
                {
                    tchCheck.Tch_FName = readCheckRole["Tch_FName"].ToString();
                    tchCheck.Tch_LName = readCheckRole["Tch_LName"].ToString();
                    tchCheck.Tch_username = readCheckRole["Tch_username"].ToString();
                    tchCheck.Tch_password = readCheckRole["Tch_password"].ToString();
                    tchCheck.Tch_email = readCheckRole["Tch_email"].ToString();
                }
                conn.Close();
                return tchCheck;

            }
            catch (Exception)
            {

                return null;
            }
        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:31,代码来源:Teacher.cs

示例8: checkForgotPassword

        public static Entity.Student checkForgotPassword(string username, string email)
        {
            try
            {
                string sqlforgot = "  SELECT * FROM Student WHERE [email protected] AND [email protected]";
                string Addvalue = "@user,@email";
                string value = username + "," + email;

                Entity.Student stdCheck = new Entity.Student();

                ClassConnectDB conn = new ClassConnectDB();
                SqlDataReader readCheckRole = conn.SelectWhereSqlDataReader(sqlforgot, Addvalue, value);
                //SqlDataReader readCheckRole = conn.SelectSqlDataReader(sqlforgot);
                if (readCheckRole.Read())
                {
                    stdCheck.Std_FName = readCheckRole["Std_FName"].ToString();
                    stdCheck.Std_LName = readCheckRole["Std_LName"].ToString();
                    stdCheck.Std_Username = readCheckRole["Std_Username"].ToString();
                    stdCheck.Std_Password = readCheckRole["Std_Password"].ToString();
                    stdCheck.Std_email = readCheckRole["Std_email"].ToString();
                }
                conn.Close();
                return stdCheck;

            }
            catch (Exception)
            {

                return null;
            }
        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:31,代码来源:Student.cs

示例9: deleteDetailTeach

 public static bool deleteDetailTeach(string dchID)
 {
     ClassConnectDB conn = new ClassConnectDB();
     string sql = "DELETE FROM DetailTech WHERE DetailTech_ID='" + dchID + "'";
     bool del = conn.QueryExecuteNonQuery(sql);
     conn.Close();
     return del;
 }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:8,代码来源:DetailTeach.cs

示例10: selectTestCode

 public static DataTable selectTestCode()
 {
     ClassConnectDB conn = new ClassConnectDB();
     string sql = "  SELECT *  FROM [WEBCSDB].[dbo].[Teacher] ";
     SqlDataReader drr = conn.SelectSqlDataReader(sql);
     DataTable dt = new DataTable();
     dt.Load(drr);
     return dt;
 }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:9,代码来源:DetailTeach.cs

示例11: manateYear

        public static System.Data.DataTable manateYear()
        {
            string sql = "select YEAR(getdate())+542 as passYear,YEAR(getdate())+543 as curYear,YEAR(getdate())+544 as fuYear";

            ClassConnectDB conn = new ClassConnectDB();
            SqlDataReader drr = conn.SelectSqlDataReader(sql);
            DataTable dt = new DataTable();
            dt.Load(drr);
            return dt;
           
        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:11,代码来源:ManageDate.cs

示例12: showSubject

 public static DataTable showSubject(string code)
 {
     try
     {
         string sql = "SELECT  *  FROM StructSubject Where StructSub_Code='" + code + "'";
         ClassConnectDB conn = new ClassConnectDB();
         SqlDataReader dr = conn.SelectSqlDataReader(sql);
         DataTable dt = new DataTable();
         dt.Load(dr);
         return dt;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
         throw;
         // return null;
     }
 }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:18,代码来源:PlanEducate.cs

示例13: insertGetcoment

 public static DataTable insertGetcoment(int clickPostID)
 {
     ClassConnectDB conn = new ClassConnectDB();
     string sql = @" SELECT   [ComPost_ID]
                       ,[Post_ID]
                       ,[ComPost_Detail]
                       ,[Create_date]
                       ,[Create_time]
                       ,[Create_user_id]
                       ,[Create_user_type]
                     FROM [CommentPost]
                     where Post_ID = " + clickPostID + " ORDER BY Create_date asc ,  Create_time asc";
     SqlDataReader drr = conn.SelectSqlDataReader(sql);
     DataTable dt = new DataTable();
     dt.Load(drr);
     conn.Close();
     return dt;
 }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:18,代码来源:mainManage.cs

示例14: checkRoleLogin

        public static Entity.Student checkRoleLogin(string username, string password)
        {
            try
            {
                Entity.Student stdlog = new Entity.Student();

                string sqlchekRole = " SELECT * FROM Student WHERE (Std_Username = @user) AND (Std_Password = @pass)";
                string Addvalue = "@user,@pass";
                string value = username + "," + password;

                ClassConnectDB conn = new ClassConnectDB();
                SqlDataReader readCheckRole = conn.SelectWhereSqlDataReader(sqlchekRole, Addvalue, value);
                if (readCheckRole.Read())
                {

                    stdlog.Std_Type = readCheckRole["Std_Type"].ToString();
                    stdlog.Std_FName = readCheckRole["Std_FName"].ToString();
                    stdlog.Std_LName = readCheckRole["Std_LName"].ToString();
                    stdlog.Std_Campus_Code = readCheckRole["Std_Campus_Code"].ToString();
                    stdlog.Std_YearEducate = readCheckRole["Std_YearEducate"].ToString();
                    stdlog.Std_Username = readCheckRole["Std_Username"].ToString();
                    stdlog.Std_Password = readCheckRole["Std_Password"].ToString();
                    stdlog.std_picturepath = readCheckRole["Std_picturepath"].ToString();
                }

                string iplog = Common.network.showIp();
                string logdate = "CONVERT(VARCHAR(10), GETDATE(), 104)";
                string logtime = "CONVERT(VARCHAR(8), GETDATE(), 108)";
                string tid = readCheckRole["Std_Campus_Code"].ToString();
                string insertLog = "INSERT INTO LogLogInStd(Log_IP, Log_Date, Log_timeStart, Std_Campus_Code) VALUES('" + iplog + "'," + logdate + "," + logtime + "," + tid + ")";
                conn.QueryExecuteNonQuery(insertLog);


                conn.Close();
                return stdlog;


            }
            catch (Exception)
            {

                return null;
            }
        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:44,代码来源:Student.cs

示例15: checkRoleLogin

        public static Entity.Teacher checkRoleLogin(string username, string password)
        {
            Entity.Teacher tch = new Entity.Teacher();
            try
            {
                string sqlchekRole = "  SELECT * FROM Teacher WHERE   [email protected] AND [email protected]";
                string Addvalue = "@user,@pass";
                string value = username + "," + password;

                ClassConnectDB conn = new ClassConnectDB();
                SqlDataReader readCheckRole = conn.SelectWhereSqlDataReader(sqlchekRole, Addvalue, value);
                if (readCheckRole.Read())
                {
                    tch.Tch_ID = readCheckRole["Tch_ID"].ToString();
                    tch.Tch_Type = readCheckRole["Tch_Type"].ToString();
                    tch.Tch_FName = readCheckRole["Tch_FName"].ToString();
                    tch.Tch_LName = readCheckRole["Tch_LName"].ToString();
                    tch.Tch_username = readCheckRole["Tch_username"].ToString();
                    tch.Tch_password = readCheckRole["Tch_password"].ToString();
                    tch.Tch_picturepath = readCheckRole["Tch_picturepath"].ToString();

                }

                string iplog = Common.network.showIp();
                string logdate = "CONVERT(VARCHAR(10), GETDATE(), 104)";
                string logtime = "CONVERT(VARCHAR(8), GETDATE(), 108)";
                string tid = readCheckRole["Tch_ID"].ToString();
                string insertLog = "INSERT INTO LogLoginTeach(Log_IP, Log_Date, Log_timeStart, Tch_ID) VALUES('" + iplog + "'," + logdate + "," + logtime + "," + tid + ")";
                conn.QueryExecuteNonQuery(insertLog);
                conn.Close();

                return tch;



            }
            catch (Exception)
            {

                return null;
            }

        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:43,代码来源:Teacher.cs


注:本文中的DAL.ClassConnectDB类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。