Exemplo n.º 1
0
        /// <summary>
        /// Xóa một khoa
        /// Cập nhật lại mã khoa ở bộ môn liên quan
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DeleteFaculty(string codeview)
        {
            int        ret = 0;
            string     sql = "DeleteFaculty '" + codeview + "'";
            SqlCommand cm  = new SqlCommand();

            cm.CommandText = sql;
            cm.CommandType = CommandType.Text;
            ret            = db.doCommand(ref cm);
            return(ret);
        }
Exemplo n.º 2
0
        public int Update(NATION_OBJ obj)
        {
            int        ret = 0;
            DBBase     db  = new DBBase(ConfigurationSettings.AppSettings["connectionString"].ToString());
            string     sql = @"UPDATE NATION SET 
                    code=@code
                    ,codeview=@codeview
                    , name=@name
                    , note=@note
                    , edituser=@edituser
                    ,edittime=@edittime
                    ,lock=@lock
                    , lockdate=@lockdate
                    WHERE code=@code_key
                ";
            SqlCommand com = new SqlCommand();

            com.CommandText = sql;
            com.CommandType = CommandType.Text;
            com.Parameters.Add("@code", SqlDbType.VarChar).Value      = obj.CODE;
            com.Parameters.Add("@codeview", SqlDbType.VarChar).Value  = obj.CODEVIEW;
            com.Parameters.Add("@name", SqlDbType.NVarChar).Value     = obj.NAME;
            com.Parameters.Add("@note", SqlDbType.NVarChar).Value     = obj.NOTE;
            com.Parameters.Add("@edituser", SqlDbType.VarChar).Value  = obj.EDITUSER;
            com.Parameters.Add("@edittime", SqlDbType.DateTime).Value = obj.EDITTIME;
            com.Parameters.Add("@lock", SqlDbType.Int).Value          = obj.LOCK;
            com.Parameters.Add("@lockdate", SqlDbType.DateTime).Value = obj.LOCKDATE;
            com.Parameters.Add("@code_key", SqlDbType.VarChar).Value  = obj._ID.CODE;
            ret = db.doCommand(ref com);
            return(ret);
        }
        public int Update(DETAILEDREGISTRATION_OBJ obj)
        {
            int        ret = 0;
            DBBase     db  = new DBBase(ConfigurationSettings.AppSettings["connectionString"].ToString());
            string     sql = @"UPDATE detailedregistration SET 
                    code=@code
                    ,subjectcode=@subjectcode
                    , studentcode=@studentcode
                    , usedcredit=@usedcredit
                    , registrationdate=@registrationdate
                    ,educationprogramcode=@educationprogramcode
                    ,codeview=@codeview   
                    WHERE code=@code_key
                ";
            SqlCommand com = new SqlCommand();

            com.CommandText = sql;
            com.CommandType = CommandType.Text;
            com.Parameters.Add("@code", SqlDbType.VarChar).Value                  = obj.CODE;
            com.Parameters.Add("@codeview", SqlDbType.VarChar).Value              = obj.CODEVIEW;
            com.Parameters.Add("@subjectcode", SqlDbType.VarChar).Value           = obj.SUBJECTCODE;
            com.Parameters.Add("@studentcode", SqlDbType.NVarChar).Value          = obj.STUDENTCODE;
            com.Parameters.Add("@usedcredit", SqlDbType.Int).Value                = obj.USEDCREDIT;
            com.Parameters.Add("@registrationdate", SqlDbType.DateTime).Value     = obj.REGISTRATIONDATE;
            com.Parameters.Add("@educationprogramcode", SqlDbType.DateTime).Value = obj.EDUCATIONPROGRAMCODE;
            ret = db.doCommand(ref com);
            return(ret);
        }
Exemplo n.º 4
0
        public int Insert(MENU_OBJ obj)
        {
            int        ret = 0;
            string     sql = "INSERT INTO AU_MENU(ID , MENUID, MENUIDCHA , TITLE , URL , SORT , TRANGTHAI , I_CREATE_DATE) VALUES(@id,@menuid, @menuidcha, @title, @url,@sort,@trangthai,@create_Date)";
            SqlCommand com = new SqlCommand();

            com.CommandText = sql;
            com.CommandType = CommandType.Text;
            com.Parameters.Add("@id", SqlDbType.VarChar).Value           = obj.ID;
            com.Parameters.Add("@menuid", SqlDbType.VarChar).Value       = obj.MenuId;
            com.Parameters.Add("@menuidcha", SqlDbType.VarChar).Value    = obj.MenuIdCha;
            com.Parameters.Add("@title", SqlDbType.NVarChar).Value       = obj.Title;
            com.Parameters.Add("@url", SqlDbType.NVarChar).Value         = obj.Url;
            com.Parameters.Add("@trangthai", SqlDbType.Int).Value        = obj.TrangThai;
            com.Parameters.Add("@sort", SqlDbType.Int).Value             = obj.Sort;
            com.Parameters.Add("@create_Date", SqlDbType.DateTime).Value = DateTime.Now;
            ret = db.doCommand(ref com);
            return(ret);
        }
Exemplo n.º 5
0
        //public int Update(COURSETIME_OBJ obj)
        //{
        //    int ret = 0;
        //    DBBase db = new DBBase(ConfigurationSettings.AppSettings["connectionString"].ToString());
        //    string sql = @"UPDATE COURSETIME SET
        //            code=@code,
        //            ,timestart=@timestart
        //            ,timeend=@timeend
        //            ,dayinweek=@dayinweek
        //            ,codeview=@codeview
        //            WHERE code=@code_key
        //        ";
        //    SqlCommand com = new SqlCommand();
        //    com.CommandText = sql;
        //    com.CommandType = CommandType.Text;
        //    com.Parameters.Add("@code", SqlDbType.VarChar).Value = obj.CODE;
        //    com.Parameters.Add("@timestart", SqlDbType.VarChar).Value = obj.TIMESTART;
        //    com.Parameters.Add("@timeend", SqlDbType.VarChar).Value = obj.TIMEEND;
        //    com.Parameters.Add("@dayinweek", SqlDbType.VarChar).Value = obj.DAYINWEEK;
        //    com.Parameters.Add("@codeview", SqlDbType.VarChar).Value = obj.CODEVIEW;
        //    com.Parameters.Add("@code_key", SqlDbType.VarChar).Value = obj._ID.CODE;
        //    ret = db.doCommand(ref com);
        //    return ret;
        //}
        public int Delete(COURSETIME_OBJ.BusinessObjectID obj)
        {
            int        ret = 0;
            DBBase     db  = new DBBase(ConfigurationSettings.AppSettings["connectionString"].ToString());
            string     sql = @"DELETE FROM COURSETIME  WHERE code=@code_key";
            SqlCommand com = new SqlCommand();

            com.CommandText = sql;
            com.CommandType = CommandType.Text;
            com.Parameters.Add("@code_key", SqlDbType.VarChar).Value = obj.CODE;
            ret = db.doCommand(ref com);
            return(ret);
        }
Exemplo n.º 6
0
        public int Insert(graduatestudent_OBJ obj)
        {
            int        ret = 0;
            DBBase     db  = new DBBase(ConfigurationSettings.AppSettings["connectionString"].ToString());
            string     sql = "INSERT INTO graduatestudent(studentcode,graduationperiodcode) VALUES(@studentcode,@graduationperiodcode)";
            SqlCommand com = new SqlCommand();

            com.CommandText = sql;
            com.CommandType = CommandType.Text;
            com.Parameters.Add("@studentcode", SqlDbType.VarChar).Value          = obj.studentcode;
            com.Parameters.Add("@graduationperiodcode", SqlDbType.VarChar).Value = obj.graduationperiodcode;

            ret = db.doCommand(ref com);
            return(ret);
        }
Exemplo n.º 7
0
        public int Insert(COURSETIME_OBJ obj)
        {
            int        ret = 0;
            DBBase     db  = new DBBase(ConfigurationSettings.AppSettings["connectionString"].ToString());
            string     sql = "exec addcoursetime @start=@timestart @end=@timeend @day=@dayinweek";
            SqlCommand com = new SqlCommand();

            com.CommandText = sql;
            com.CommandType = CommandType.Text;
            com.Parameters.Add("@timestart", SqlDbType.VarChar).Value = obj.TIMESTART;
            com.Parameters.Add("@timeend", SqlDbType.VarChar).Value   = obj.TIMEEND;
            com.Parameters.Add("@dayinweek", SqlDbType.VarChar).Value = obj.DAYINWEEK;
            ret = db.doCommand(ref com);
            return(ret);
        }
Exemplo n.º 8
0
        //public string genNextCode(ROOM_OBJ obj)
        //{
        //    //Phải viết lại theo mô hình nào đó
        //    Random rnd = new Random();
        //    int i = rnd.Next(int.MaxValue);
        //    return (i % 10000000000).ToString();
        //}
        public int Insert(ROOM_OBJ obj)
        {
            int        ret = 0;
            DBBase     db  = new DBBase(ConfigurationSettings.AppSettings["connectionString"].ToString());
            string     sql = "INSERT INTO ROOM(code, numberfloor,codeview,buildingcode) VALUES(@code,@numberfloor,@codeview,@buildingcode)";
            SqlCommand com = new SqlCommand();

            com.CommandText = sql;
            com.CommandType = CommandType.Text;
            com.Parameters.Add("@code", SqlDbType.VarChar).Value         = obj.CODE;
            com.Parameters.Add("@numberfloor", SqlDbType.VarChar).Value  = obj.NUMBERFLOOR;
            com.Parameters.Add("@codeview", SqlDbType.VarChar).Value     = obj.CODEVIEW;
            com.Parameters.Add("@buildingcode", SqlDbType.VarChar).Value = obj.BUILDINGCODE;
            ret = db.doCommand(ref com);
            return(ret);
        }
Exemplo n.º 9
0
        public int Insert(MAJOR_OBJ obj)
        {
            int        ret = 0;
            DBBase     db  = new DBBase(ConfigurationSettings.AppSettings["connectionString"].ToString());
            string     sql = "INSERT INTO MAJOR(code,codeview,name,facilitycode) VALUES(@code,@codeview,@name,@facilitycode)";
            SqlCommand com = new SqlCommand();

            com.CommandText = sql;
            com.CommandType = CommandType.Text;
            com.Parameters.Add("@code", SqlDbType.VarChar).Value         = obj.CODE;
            com.Parameters.Add("@codeview", SqlDbType.VarChar).Value     = obj.CODEVIEW;
            com.Parameters.Add("@name", SqlDbType.NVarChar).Value        = obj.NAME;
            com.Parameters.Add("@facilitycode", SqlDbType.VarChar).Value = obj.FACILITYCODE;

            ret = db.doCommand(ref com);
            return(ret);
        }
Exemplo n.º 10
0
        public int Insert(NATION_OBJ obj)
        {
            int        ret = 0;
            DBBase     db  = new DBBase(ConfigurationSettings.AppSettings["connectionString"].ToString());
            string     sql = "INSERT INTO NATION(code,codeview, name, note, edituser,edittime,lock, lockdate) VALUES(@code,@codeview, @name, @note, @edituser,@edittime,@lock, @lockdate)";
            SqlCommand com = new SqlCommand();

            com.CommandText = sql;
            com.CommandType = CommandType.Text;
            com.Parameters.Add("@code", SqlDbType.VarChar).Value      = obj.CODE;
            com.Parameters.Add("@codeview", SqlDbType.VarChar).Value  = obj.CODEVIEW;
            com.Parameters.Add("@name", SqlDbType.NVarChar).Value     = obj.NAME;
            com.Parameters.Add("@note", SqlDbType.NVarChar).Value     = obj.NOTE;
            com.Parameters.Add("@edituser", SqlDbType.VarChar).Value  = obj.EDITUSER;
            com.Parameters.Add("@edittime", SqlDbType.DateTime).Value = obj.EDITTIME;
            com.Parameters.Add("@lock", SqlDbType.Int).Value          = obj.LOCK;
            com.Parameters.Add("@lockdate", SqlDbType.DateTime).Value = obj.LOCKDATE;
            ret = db.doCommand(ref com);
            return(ret);
        }
Exemplo n.º 11
0
        public int Update(graduatestudent_OBJ obj)
        {
            int        ret = 0;
            DBBase     db  = new DBBase(ConfigurationSettings.AppSettings["connectionString"].ToString());
            string     sql = @"UPDATE graduatestudent SET 
                    studentcode=@studentcode
                    ,graduationperiodcode=@graduationperiodcode
                    
                    WHERE code=@code_key
                ";
            SqlCommand com = new SqlCommand();

            com.CommandText = sql;
            com.CommandType = CommandType.Text;
            com.Parameters.Add("@studentcode", SqlDbType.VarChar).Value          = obj.studentcode;
            com.Parameters.Add("@graduationperiodcode", SqlDbType.VarChar).Value = obj.graduationperiodcode;

            com.Parameters.Add("@code_key", SqlDbType.VarChar).Value = obj._ID.CODE;

            ret = db.doCommand(ref com);
            return(ret);
        }
Exemplo n.º 12
0
        public int Insert(STUDENT_OBJ obj)
        {
            int        ret = 0;
            DBBase     db  = new DBBase(ConfigurationSettings.AppSettings["connectionString"].ToString());
            string     sql = "INSERT INTO branch(code,codeview, name, note, edituser,edittime,lock, lockdate, universitycode, lang) VALUES(@code,@codeview, @name, @note, @edituser,@edittime,@lock, @lockdate, @universitycode, @lang)";
            SqlCommand com = new SqlCommand();

            com.CommandText = sql;
            com.CommandType = CommandType.Text;
            com.Parameters.Add("@code", SqlDbType.VarChar).Value = obj.CODE;

            com.Parameters.Add("@name", SqlDbType.NVarChar).Value = obj.NAME;
            //com.Parameters.Add("@note", SqlDbType.NVarChar).Value = obj.NOTE;
            //com.Parameters.Add("@edituser", SqlDbType.VarChar).Value = obj.EDITUSER;
            //com.Parameters.Add("@edittime", SqlDbType.DateTime).Value = obj.EDITTIME;
            //com.Parameters.Add("@lock", SqlDbType.Int).Value = obj.LOCK;
            //com.Parameters.Add("@lockdate", SqlDbType.DateTime).Value = obj.LOCKDATE;
            //com.Parameters.Add("@universitycode", SqlDbType.VarChar).Value = obj.UNIVERSITYCODE;
            //com.Parameters.Add("@lang", SqlDbType.VarChar).Value = obj.LANG;
            ret = db.doCommand(ref com);
            return(ret);
        }
Exemplo n.º 13
0
        public int Update(ROOM_OBJ obj)
        {
            int        ret = 0;
            DBBase     db  = new DBBase(ConfigurationSettings.AppSettings["connectionString"].ToString());
            string     sql = @"UPDATE ROOM SET 
                    code=@code
                    ,numberfloor=@numberflorr
                    ,codeview=@codeview
                    ,buildingcode=@buildingcode
                    WHERE code=@code_key
                ";
            SqlCommand com = new SqlCommand();

            com.CommandText = sql;
            com.CommandType = CommandType.Text;
            com.Parameters.Add("@code", SqlDbType.VarChar).Value         = obj.CODE;
            com.Parameters.Add("@numberfloor", SqlDbType.VarChar).Value  = obj.NUMBERFLOOR;
            com.Parameters.Add("@codeview", SqlDbType.VarChar).Value     = obj.CODEVIEW;
            com.Parameters.Add("@buildingcode", SqlDbType.VarChar).Value = obj.BUILDINGCODE;
            com.Parameters.Add("@code_key", SqlDbType.VarChar).Value     = obj._ID.CODE;
            ret = db.doCommand(ref com);
            return(ret);
        }
Exemplo n.º 14
0
        public int Insert(EDUCATIONLEVEL_OBJ obj)
        {
            int        ret = 0;
            DBBase     db  = new DBBase(ConfigurationSettings.AppSettings["connectionString"].ToString());
            string     sql = "INSERT INTO EDUCATIONLEVEL(code,codeview, name, note, edituser,edittime,lock, lockdate, theorder, thetype, comparelevel, whois) VALUES(@code,@codeview, @name, @note, @edituser,@edittime,@lock, @lockdate, @theorder, @thetype, @comparelevel, @whois)";
            SqlCommand com = new SqlCommand();

            com.CommandText = sql;
            com.CommandType = CommandType.Text;
            com.Parameters.Add("@code", SqlDbType.VarChar).Value      = obj.CODE;
            com.Parameters.Add("@codeview", SqlDbType.VarChar).Value  = obj.CODEVIEW;
            com.Parameters.Add("@name", SqlDbType.NVarChar).Value     = obj.NAME;
            com.Parameters.Add("@note", SqlDbType.NVarChar).Value     = obj.NOTE;
            com.Parameters.Add("@edituser", SqlDbType.VarChar).Value  = obj.EDITUSER;
            com.Parameters.Add("@edittime", SqlDbType.DateTime).Value = obj.EDITTIME;
            com.Parameters.Add("@lock", SqlDbType.Int).Value          = obj.LOCK;
            com.Parameters.Add("@lockdate", SqlDbType.DateTime).Value = obj.LOCKDATE;
            com.Parameters.Add("@theorder", SqlDbType.Int).Value      = obj.THEORDER;
            com.Parameters.Add("@thetype", SqlDbType.VarChar).Value   = obj.THETYPE;
            com.Parameters.Add("@comparelevel", SqlDbType.Int).Value  = obj.COMPARELEVEL;
            com.Parameters.Add("@whois", SqlDbType.VarChar).Value     = obj.WHOIS;
            ret = db.doCommand(ref com);
            return(ret);
        }
Exemplo n.º 15
0
        public int Update(MAJOR_OBJ obj)
        {
            int        ret = 0;
            DBBase     db  = new DBBase(ConfigurationSettings.AppSettings["connectionString"].ToString());
            string     sql = @"UPDATE MAJOR SET 
                     code=@code
                    ,codeview=@codeview
                    , name=@name
                    , facilitycode =@facilitycode
                    WHERE code=@code_key
                ";
            SqlCommand com = new SqlCommand();

            com.CommandText = sql;
            com.CommandType = CommandType.Text;
            com.Parameters.Add("@code", SqlDbType.VarChar).Value         = obj.CODE;
            com.Parameters.Add("@codeview", SqlDbType.VarChar).Value     = obj.CODEVIEW;
            com.Parameters.Add("@name", SqlDbType.NVarChar).Value        = obj.NAME;
            com.Parameters.Add("@facilitycode", SqlDbType.VarChar).Value = obj.FACILITYCODE;
            com.Parameters.Add("@code_key", SqlDbType.VarChar).Value     = obj._ID.CODE;

            ret = db.doCommand(ref com);
            return(ret);
        }