Exemple #1
0
        public bool Modify(homeworkData dathomework)
        {
            int  iRel = -1;
            bool bRel = false;

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            try
            {
                objDB.OpenConnection();
                string strSql = "update homework set hwtit=@hwtit,hwtime=@hwtime,hwer=@hwer,press=@press,userclass=@userclass where Id = @Id";
                objDB.Command.CommandType = System.Data.CommandType.Text;
                objDB.Command.CommandText = strSql;
                objDB.Command.Parameters.AddWithValue("@hwtit", dathomework.hwtit);
                objDB.Command.Parameters.AddWithValue("@hwtime", dathomework.hwtime);
                objDB.Command.Parameters.AddWithValue("@hwer", dathomework.hwer);
                objDB.Command.Parameters.AddWithValue("@press", dathomework.press);
                objDB.Command.Parameters.AddWithValue("@userclass", dathomework.userclass);
                objDB.Command.Parameters.AddWithValue("@Id", dathomework.Id);
                iRel = objDB.Command.ExecuteNonQuery();
            }
            catch (Exception ex)
            { iRel = -1; }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            bRel  = (iRel.Equals(1) ? true : false); return(bRel);
        }
Exemple #2
0
        public bool Modify(thetitleData datthetitle)
        {
            int  iRel = -1;
            bool bRel = false;

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            try
            {
                objDB.OpenConnection();
                string strSql = "update thetitle set hwid=@hwid,thetitle=@thetitle,memos=@memos where Id = @Id";
                objDB.Command.CommandType = System.Data.CommandType.Text;
                objDB.Command.CommandText = strSql;
                objDB.Command.Parameters.AddWithValue("@hwid", datthetitle.hwid);
                objDB.Command.Parameters.AddWithValue("@thetitle", datthetitle.thetitle);
                objDB.Command.Parameters.AddWithValue("@memos", datthetitle.memos);
                objDB.Command.Parameters.AddWithValue("@Id", datthetitle.Id);
                iRel = objDB.Command.ExecuteNonQuery();
            }
            catch (Exception ex)
            { iRel = -1; }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            bRel  = (iRel.Equals(1) ? true : false); return(bRel);
        }
Exemple #3
0
        public bool Insert(homeworkData dathomework)
        {
            int  iRel = -1;
            bool bRel = false;

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            try
            {
                objDB.OpenConnection();
                string strSql = " insert into homework (hwtit,hwtime,hwer,press,userclass)  values (@hwtit,@hwtime,@hwer,@press,@userclass) ";
                objDB.Command.CommandType = System.Data.CommandType.Text;
                objDB.Command.CommandText = strSql;
                objDB.Command.Parameters.AddWithValue("@hwtit", dathomework.hwtit);
                objDB.Command.Parameters.AddWithValue("@hwtime", dathomework.hwtime);
                objDB.Command.Parameters.AddWithValue("@hwer", dathomework.hwer);
                objDB.Command.Parameters.AddWithValue("@press", dathomework.press);
                objDB.Command.Parameters.AddWithValue("@userclass", dathomework.userclass);
                iRel = objDB.Command.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                iRel = -1;
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            bRel  = (iRel.Equals(1) ? true : false);
            return(bRel);
        }
Exemple #4
0
        public bool Insert(usersData datusers)
        {
            int  iRel = -1;
            bool bRel = false;

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            try
            {
                objDB.OpenConnection();
                string strSql = " insert into users (userid,userpwrd,username,usertype,userclass)  values (@userid,@userpwrd,@username,@usertype,@userclass) ";
                objDB.Command.CommandType = System.Data.CommandType.Text;
                objDB.Command.CommandText = strSql;
                objDB.Command.Parameters.AddWithValue("@userid", datusers.userid);
                objDB.Command.Parameters.AddWithValue("@userpwrd", datusers.userpwrd);
                objDB.Command.Parameters.AddWithValue("@username", datusers.username);
                objDB.Command.Parameters.AddWithValue("@usertype", datusers.usertype);
                objDB.Command.Parameters.AddWithValue("@userclass", datusers.userclass);
                iRel = objDB.Command.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                iRel = -1;
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            bRel  = (iRel.Equals(1) ? true : false);
            return(bRel);
        }
Exemple #5
0
        public bool Modify(materialData datmaterial)
        {
            int  iRel = -1;
            bool bRel = false;

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            try
            {
                objDB.OpenConnection();
                string strSql = "update material set materialtype=@materialtype,materialtit=@materialtit,materialfile=@materialfile,materialtime=@materialtime where Id = @Id";
                objDB.Command.CommandType = System.Data.CommandType.Text;
                objDB.Command.CommandText = strSql;
                objDB.Command.Parameters.AddWithValue("@materialtype", datmaterial.materialtype);
                objDB.Command.Parameters.AddWithValue("@materialtit", datmaterial.materialtit);
                objDB.Command.Parameters.AddWithValue("@materialfile", datmaterial.materialfile);
                objDB.Command.Parameters.AddWithValue("@materialtime", datmaterial.materialtime);
                objDB.Command.Parameters.AddWithValue("@Id", datmaterial.Id);
                iRel = objDB.Command.ExecuteNonQuery();
            }
            catch (Exception ex)
            { iRel = -1; }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            bRel  = (iRel.Equals(1) ? true : false); return(bRel);
        }
Exemple #6
0
        public bool Insert(correctingData datcorrecting)
        {
            int  iRel = -1;
            bool bRel = false;

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            try
            {
                objDB.OpenConnection();
                string strSql = " insert into correcting (hwtit,userid,ctime,ccon,ter,cdate,scores,messages)  values (@hwtit,@userid,@ctime,@ccon,@ter,@cdate,@scores,@messages) ";
                objDB.Command.CommandType = System.Data.CommandType.Text;
                objDB.Command.CommandText = strSql;
                objDB.Command.Parameters.AddWithValue("@hwtit", datcorrecting.hwtit);
                objDB.Command.Parameters.AddWithValue("@userid", datcorrecting.userid);
                objDB.Command.Parameters.AddWithValue("@ctime", datcorrecting.ctime);
                objDB.Command.Parameters.AddWithValue("@ccon", datcorrecting.ccon);
                objDB.Command.Parameters.AddWithValue("@ter", datcorrecting.ter);
                objDB.Command.Parameters.AddWithValue("@cdate", datcorrecting.cdate);
                objDB.Command.Parameters.AddWithValue("@scores", datcorrecting.scores);
                objDB.Command.Parameters.AddWithValue("@messages", datcorrecting.messages);
                iRel = objDB.Command.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                iRel = -1;
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            bRel  = (iRel.Equals(1) ? true : false);
            return(bRel);
        }
Exemple #7
0
        public bool Modify(informationsData datinformations)
        {
            int  iRel = -1;
            bool bRel = false;

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            try
            {
                objDB.OpenConnection();
                string strSql = "update informations set thetit=@thetit,thetype=@thetype,thetime=@thetime,userid=@userid,memos=@memos,userclass=@userclass where Id = @Id";
                objDB.Command.CommandType = System.Data.CommandType.Text;
                objDB.Command.CommandText = strSql;
                objDB.Command.Parameters.AddWithValue("@thetit", datinformations.thetit);
                objDB.Command.Parameters.AddWithValue("@thetype", datinformations.thetype);
                objDB.Command.Parameters.AddWithValue("@thetime", datinformations.thetime);
                objDB.Command.Parameters.AddWithValue("@userid", datinformations.userid);
                objDB.Command.Parameters.AddWithValue("@memos", datinformations.memos);
                objDB.Command.Parameters.AddWithValue("@userclass", datinformations.userclass);
                objDB.Command.Parameters.AddWithValue("@Id", datinformations.Id);
                iRel = objDB.Command.ExecuteNonQuery();
            }
            catch (Exception ex)
            { iRel = -1; }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            bRel  = (iRel.Equals(1) ? true : false); return(bRel);
        }
Exemple #8
0
        public bool Modify(userinfoData datuserinfo)
        {
            int  iRel = -1;
            bool bRel = false;

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            try
            {
                objDB.OpenConnection();
                string strSql = "update userinfo set subscribe=@subscribe,openid=@openid,nickname=@nickname,sex=@sex,language=@language,city=@city,province=@province,country=@country,headimgurl=@headimgurl,subscribe_time=@subscribe_time,unionid=@unionid,remark=@remark,privilege=@privilege where Id = @Id";
                objDB.Command.CommandType = System.Data.CommandType.Text;
                objDB.Command.CommandText = strSql;
                objDB.Command.Parameters.AddWithValue("@subscribe", datuserinfo.subscribe);
                objDB.Command.Parameters.AddWithValue("@openid", datuserinfo.openid);
                objDB.Command.Parameters.AddWithValue("@nickname", datuserinfo.nickname);
                objDB.Command.Parameters.AddWithValue("@sex", datuserinfo.sex);
                objDB.Command.Parameters.AddWithValue("@language", datuserinfo.language);
                objDB.Command.Parameters.AddWithValue("@city", datuserinfo.city);
                objDB.Command.Parameters.AddWithValue("@province", datuserinfo.province);
                objDB.Command.Parameters.AddWithValue("@country", datuserinfo.country);
                objDB.Command.Parameters.AddWithValue("@headimgurl", datuserinfo.headimgurl);
                objDB.Command.Parameters.AddWithValue("@subscribe_time", datuserinfo.subscribe_time);
                objDB.Command.Parameters.AddWithValue("@unionid", datuserinfo.unionid);
                objDB.Command.Parameters.AddWithValue("@remark", datuserinfo.remark);
                objDB.Command.Parameters.AddWithValue("@privilege", datuserinfo.privilege);
                objDB.Command.Parameters.AddWithValue("@Id", datuserinfo.Id);
                iRel = objDB.Command.ExecuteNonQuery();
            }
            catch (Exception ex)
            { iRel = -1; }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            bRel  = (iRel.Equals(1) ? true : false); return(bRel);
        }
Exemple #9
0
        public bool Modify(menulevel2Data datmenulevel2)
        {
            int  iRel = -1;
            bool bRel = false;

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            try
            {
                objDB.OpenConnection();
                string strSql = "update menulevel2 set level1id=@level1id,menutype=@menutype,menuname=@menuname,menuurl=@menuurl,nums=@nums where Id = @Id";
                objDB.Command.CommandType = System.Data.CommandType.Text;
                objDB.Command.CommandText = strSql;
                objDB.Command.Parameters.AddWithValue("@level1id", datmenulevel2.level1id);
                objDB.Command.Parameters.AddWithValue("@menutype", datmenulevel2.menutype);
                objDB.Command.Parameters.AddWithValue("@menuname", datmenulevel2.menuname);
                objDB.Command.Parameters.AddWithValue("@menuurl", datmenulevel2.menuurl);
                objDB.Command.Parameters.AddWithValue("@nums", datmenulevel2.nums);
                objDB.Command.Parameters.AddWithValue("@Id", datmenulevel2.Id);
                iRel = objDB.Command.ExecuteNonQuery();
            }
            catch (Exception ex)
            { iRel = -1; }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            bRel  = (iRel.Equals(1) ? true : false); return(bRel);
        }
Exemple #10
0
        public bool Login(string userid, string userpwrd)
        {
            bool   flag   = false;
            string strSql = "SELECT * FROM Users WHERE (userid = '" + userid + "')";

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            DataTable           dt    = objDB.QueryDataTable(strSql, "Users");

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow tempRow in dt.Rows)
                {
                    if (tempRow["userpwrd"].ToString().Trim().Equals(userpwrd))
                    {
                        this.UserType  = tempRow["UserType"].ToString().Trim();
                        this.UserName  = tempRow["UserName"].ToString().Trim();
                        this.UserClass = tempRow["UserClass"].ToString().Trim();

                        flag = true;
                    }
                    else
                    {
                        this.ErrMsg = "密码不正确。";
                    }
                }
            }
            else
            {
                this.ErrMsg = "用户名不存在。";
            }
            dt = null;
            return(flag);
        }
Exemple #11
0
        public bool Insert(messgaeData datmessgae)
        {
            int  iRel = -1;
            bool bRel = false;

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            try
            {
                objDB.OpenConnection();
                string strSql = " insert into messgae (messtit,messtime,messcon)  values (@messtit,@messtime,@messcon) ";
                objDB.Command.CommandType = System.Data.CommandType.Text;
                objDB.Command.CommandText = strSql;
                objDB.Command.Parameters.AddWithValue("@messtit", datmessgae.messtit);
                objDB.Command.Parameters.AddWithValue("@messtime", datmessgae.messtime);
                objDB.Command.Parameters.AddWithValue("@messcon", datmessgae.messcon);
                iRel = objDB.Command.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                iRel = -1;
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            bRel  = (iRel.Equals(1) ? true : false);
            return(bRel);
        }
Exemple #12
0
        public List <materialData> GetList(string casestr)
        {
            List <materialData> listdata = new List <materialData>();
            DataTable           dt       = new DataTable();

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            string sql = "select * from material where 1 = 1 ";

            sql += casestr;
            objDB.OpenConnection();
            dt = objDB.QueryDataTable(sql, "tabname");

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow tempRow in dt.Rows)
                {
                    materialData hd = new materialData();
                    hd.Id          = tempRow["Id"].ToString().Trim();
                    hd.materialtit = tempRow["materialtit"].ToString().Trim();
                    listdata.Add(hd);
                }
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            return(listdata);
        }
Exemple #13
0
        public bool DeleteByCase(string strcase)
        {
            int  iRel = -1;
            bool bRel = false;

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            try
            {
                objDB.OpenConnection();
                string strSql = "delete from userinfo where 1 = 1";
                strSql += strcase;
                objDB.Command.CommandType = System.Data.CommandType.Text;
                objDB.Command.CommandText = strSql;
                iRel = objDB.Command.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                iRel = -1;
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            bRel  = (iRel.Equals(1) ? true : false);
            return(bRel);
        }
Exemple #14
0
        public bool Modify(themessData datthemess)
        {
            int  iRel = -1;
            bool bRel = false;

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            try
            {
                objDB.OpenConnection();
                string strSql = "update themess set userid=@userid,messtime=@messtime,messcon=@messcon,ter=@ter,replys=@replys where Id = @Id";
                objDB.Command.CommandType = System.Data.CommandType.Text;
                objDB.Command.CommandText = strSql;
                objDB.Command.Parameters.AddWithValue("@userid", datthemess.userid);
                objDB.Command.Parameters.AddWithValue("@messtime", datthemess.messtime);
                objDB.Command.Parameters.AddWithValue("@messcon", datthemess.messcon);
                objDB.Command.Parameters.AddWithValue("@ter", datthemess.ter);
                objDB.Command.Parameters.AddWithValue("@replys", datthemess.replys);
                objDB.Command.Parameters.AddWithValue("@Id", datthemess.Id);
                iRel = objDB.Command.ExecuteNonQuery();
            }
            catch (Exception ex)
            { iRel = -1; }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            bRel  = (iRel.Equals(1) ? true : false); return(bRel);
        }
Exemple #15
0
        public bool Modify(articleData datarticle)
        {
            int  iRel = -1;
            bool bRel = false;

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            try
            {
                objDB.OpenConnection();
                string strSql = "update article set thumb_media_id=@thumb_media_id,author=@author,title=@title,content_source_url=@content_source_url,content=@content,digest=@digest,show_cover_pic=@show_cover_pic where Id = @Id";
                objDB.Command.CommandType = System.Data.CommandType.Text;
                objDB.Command.CommandText = strSql;
                objDB.Command.Parameters.AddWithValue("@thumb_media_id", datarticle.thumb_media_id);
                objDB.Command.Parameters.AddWithValue("@author", datarticle.author);
                objDB.Command.Parameters.AddWithValue("@title", datarticle.title);
                objDB.Command.Parameters.AddWithValue("@content_source_url", datarticle.content_source_url);
                objDB.Command.Parameters.AddWithValue("@content", datarticle.content);
                objDB.Command.Parameters.AddWithValue("@digest", datarticle.digest);
                objDB.Command.Parameters.AddWithValue("@show_cover_pic", datarticle.show_cover_pic);
                objDB.Command.Parameters.AddWithValue("@Id", datarticle.Id);
                iRel = objDB.Command.ExecuteNonQuery();
            }
            catch (Exception ex)
            { iRel = -1; }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            bRel  = (iRel.Equals(1) ? true : false); return(bRel);
        }
Exemple #16
0
        public DataTable Get(string casestr)
        {
            DataTable dt = new DataTable();

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            string sql = "select * from informations where 1 = 1 ";

            sql += casestr;
            objDB.OpenConnection();
            dt = objDB.QueryDataTable(sql, "tabname");
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            return(dt);
        }
Exemple #17
0
        public int CalcCountSearch(string casestr)
        {
            DataTable dt = new DataTable();

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            string sql = "select count (1)  from informations where id > 0";

            sql += casestr;
            objDB.OpenConnection();
            dt = objDB.QueryDataTable(sql, "tabname");
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            return((dt == null) ? 0 : int.Parse(dt.Rows[0][0].ToString()));
        }
Exemple #18
0
        public userinfoData[] Select(string Id)
        {
            int iRel = -1;

            DataAccess.CommonDB objDB       = new DataAccess.CommonDB();
            userinfoData[]      datuserinfo = new userinfoData[1];
            string sql = "select * from userinfo where Id= " + Id + " ";

            try
            {
                objDB.OpenConnection();
                DataSet ds = objDB.QueryData(sql, "departmentinfo");
                if (ds.Tables.Count > 0)
                {
                    long nRow = ds.Tables[0].Rows.Count;
                    if (nRow > 0)
                    {
                        datuserinfo = new userinfoData[nRow];
                        for (int i = 0; i < nRow; i++)
                        {
                            datuserinfo[i]                = new userinfoData();
                            datuserinfo[i].subscribe      = ds.Tables[0].Rows[i]["subscribe"].ToString();
                            datuserinfo[i].openid         = ds.Tables[0].Rows[i]["openid"].ToString();
                            datuserinfo[i].nickname       = ds.Tables[0].Rows[i]["nickname"].ToString();
                            datuserinfo[i].sex            = ds.Tables[0].Rows[i]["sex"].ToString();
                            datuserinfo[i].language       = ds.Tables[0].Rows[i]["language"].ToString();
                            datuserinfo[i].city           = ds.Tables[0].Rows[i]["city"].ToString();
                            datuserinfo[i].province       = ds.Tables[0].Rows[i]["province"].ToString();
                            datuserinfo[i].country        = ds.Tables[0].Rows[i]["country"].ToString();
                            datuserinfo[i].headimgurl     = ds.Tables[0].Rows[i]["headimgurl"].ToString();
                            datuserinfo[i].subscribe_time = ds.Tables[0].Rows[i]["subscribe_time"].ToString();
                            datuserinfo[i].unionid        = ds.Tables[0].Rows[i]["unionid"].ToString();
                            datuserinfo[i].remark         = ds.Tables[0].Rows[i]["remark"].ToString();
                            datuserinfo[i].privilege      = ds.Tables[0].Rows[i]["privilege"].ToString();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                iRel = -1;
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            return(datuserinfo);
        }
Exemple #19
0
        public correctingData[] Select(string Id)
        {
            int iRel = -1;

            DataAccess.CommonDB objDB         = new DataAccess.CommonDB();
            correctingData[]    datcorrecting = new correctingData[1];
            string sql = "select * from correcting where Id= " + Id + " ";

            try
            {
                objDB.OpenConnection();
                DataSet ds = objDB.QueryData(sql, "departmentinfo");
                if (ds.Tables.Count > 0)
                {
                    long nRow = ds.Tables[0].Rows.Count;
                    if (nRow > 0)
                    {
                        datcorrecting = new correctingData[nRow];
                        for (int i = 0; i < nRow; i++)
                        {
                            datcorrecting[i]          = new correctingData();
                            datcorrecting[i].hwtit    = ds.Tables[0].Rows[i]["hwtit"].ToString();
                            datcorrecting[i].userid   = ds.Tables[0].Rows[i]["userid"].ToString();
                            datcorrecting[i].ctime    = ds.Tables[0].Rows[i]["ctime"].ToString();
                            datcorrecting[i].ccon     = ds.Tables[0].Rows[i]["ccon"].ToString();
                            datcorrecting[i].ter      = ds.Tables[0].Rows[i]["ter"].ToString();
                            datcorrecting[i].cdate    = ds.Tables[0].Rows[i]["cdate"].ToString();
                            datcorrecting[i].scores   = ds.Tables[0].Rows[i]["scores"].ToString();
                            datcorrecting[i].messages = ds.Tables[0].Rows[i]["messages"].ToString();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                iRel = -1;
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            return(datcorrecting);
        }
Exemple #20
0
        public informationsData[] Put(string casestr)
        {
            int iRel = -1;

            DataAccess.CommonDB objDB           = new DataAccess.CommonDB();
            informationsData[]  datinformations = new informationsData[1];
            string sql = "select * from informations where 1 = 1 ";

            sql += casestr;
            try
            {
                objDB.OpenConnection();
                DataSet ds = objDB.QueryData(sql, "departmentinfo");
                if (ds.Tables.Count > 0)
                {
                    long nRow = ds.Tables[0].Rows.Count;
                    if (nRow > 0)
                    {
                        datinformations = new informationsData[nRow];
                        for (int i = 0; i < nRow; i++)
                        {
                            datinformations[i]           = new informationsData();
                            datinformations[i].thetit    = ds.Tables[0].Rows[i]["thetit"].ToString();
                            datinformations[i].thetype   = ds.Tables[0].Rows[i]["thetype"].ToString();
                            datinformations[i].thetime   = ds.Tables[0].Rows[i]["thetime"].ToString();
                            datinformations[i].userid    = ds.Tables[0].Rows[i]["userid"].ToString();
                            datinformations[i].memos     = ds.Tables[0].Rows[i]["memos"].ToString();
                            datinformations[i].userclass = ds.Tables[0].Rows[i]["userclass"].ToString();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                iRel = -1;
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            return(datinformations);
        }
Exemple #21
0
        public articleData[] Select(string Id)
        {
            int iRel = -1;

            DataAccess.CommonDB objDB      = new DataAccess.CommonDB();
            articleData[]       datarticle = new articleData[1];
            string sql = "select * from article where Id= " + Id + " ";

            try
            {
                objDB.OpenConnection();
                DataSet ds = objDB.QueryData(sql, "departmentinfo");
                if (ds.Tables.Count > 0)
                {
                    long nRow = ds.Tables[0].Rows.Count;
                    if (nRow > 0)
                    {
                        datarticle = new articleData[nRow];
                        for (int i = 0; i < nRow; i++)
                        {
                            datarticle[i] = new articleData();
                            datarticle[i].thumb_media_id     = ds.Tables[0].Rows[i]["thumb_media_id"].ToString();
                            datarticle[i].author             = ds.Tables[0].Rows[i]["author"].ToString();
                            datarticle[i].title              = ds.Tables[0].Rows[i]["title"].ToString();
                            datarticle[i].content_source_url = ds.Tables[0].Rows[i]["content_source_url"].ToString();
                            datarticle[i].content            = ds.Tables[0].Rows[i]["content"].ToString();
                            datarticle[i].digest             = ds.Tables[0].Rows[i]["digest"].ToString();
                            datarticle[i].show_cover_pic     = ds.Tables[0].Rows[i]["show_cover_pic"].ToString();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                iRel = -1;
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            return(datarticle);
        }
Exemple #22
0
        public usersData[] Put(string Id)
        {
            int iRel = -1;

            DataAccess.CommonDB objDB    = new DataAccess.CommonDB();
            usersData[]         datusers = new usersData[1];
            string sql = "select * from users where 1 = 1 ";

            sql += Id;
            try
            {
                objDB.OpenConnection();
                DataSet ds = objDB.QueryData(sql, "departmentinfo");
                if (ds.Tables.Count > 0)
                {
                    long nRow = ds.Tables[0].Rows.Count;
                    if (nRow > 0)
                    {
                        datusers = new usersData[nRow];
                        for (int i = 0; i < nRow; i++)
                        {
                            datusers[i]           = new usersData();
                            datusers[i].userid    = ds.Tables[0].Rows[i]["userid"].ToString();
                            datusers[i].userpwrd  = ds.Tables[0].Rows[i]["userpwrd"].ToString();
                            datusers[i].username  = ds.Tables[0].Rows[i]["username"].ToString();
                            datusers[i].usertype  = ds.Tables[0].Rows[i]["usertype"].ToString();
                            datusers[i].userclass = ds.Tables[0].Rows[i]["userclass"].ToString();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                iRel = -1;
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            return(datusers);
        }
Exemple #23
0
        public DataTable SelectAllFenyeSearch(int pagesize, int pageindex, string casestr)
        {
            DataTable dt = new DataTable();

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            string sql = "";

            if ((pageindex - 1) * pagesize == 0)
            {
                sql = "select top " + pagesize + " * from informations where id > 0 " + casestr + " order by id desc";
            }
            else
            {
                sql = "select top " + pagesize + " * from informations where id not in (select top " + (pageindex - 1) * pagesize + " id from informations order by id desc) " + casestr + " order by id desc";
            }
            objDB.OpenConnection();
            dt = objDB.QueryDataTable(sql, "tabname");
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            return(dt);
        }
Exemple #24
0
        public themessData[] Select(string Id)
        {
            int iRel = -1;

            DataAccess.CommonDB objDB      = new DataAccess.CommonDB();
            themessData[]       datthemess = new themessData[1];
            string sql = "select * from themess where Id= " + Id + " ";

            try
            {
                objDB.OpenConnection();
                DataSet ds = objDB.QueryData(sql, "departmentinfo");
                if (ds.Tables.Count > 0)
                {
                    long nRow = ds.Tables[0].Rows.Count;
                    if (nRow > 0)
                    {
                        datthemess = new themessData[nRow];
                        for (int i = 0; i < nRow; i++)
                        {
                            datthemess[i]          = new themessData();
                            datthemess[i].userid   = ds.Tables[0].Rows[i]["userid"].ToString();
                            datthemess[i].messtime = ds.Tables[0].Rows[i]["messtime"].ToString();
                            datthemess[i].messcon  = ds.Tables[0].Rows[i]["messcon"].ToString();
                            datthemess[i].ter      = ds.Tables[0].Rows[i]["ter"].ToString();
                            datthemess[i].replys   = ds.Tables[0].Rows[i]["replys"].ToString();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                iRel = -1;
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            return(datthemess);
        }
Exemple #25
0
        public homeworkData[] Select(string Id)
        {
            int iRel = -1;

            DataAccess.CommonDB objDB       = new DataAccess.CommonDB();
            homeworkData[]      dathomework = new homeworkData[1];
            string sql = "select * from homework where Id= " + Id + " ";

            try
            {
                objDB.OpenConnection();
                DataSet ds = objDB.QueryData(sql, "departmentinfo");
                if (ds.Tables.Count > 0)
                {
                    long nRow = ds.Tables[0].Rows.Count;
                    if (nRow > 0)
                    {
                        dathomework = new homeworkData[nRow];
                        for (int i = 0; i < nRow; i++)
                        {
                            dathomework[i]           = new homeworkData();
                            dathomework[i].hwtit     = ds.Tables[0].Rows[i]["hwtit"].ToString();
                            dathomework[i].hwtime    = ds.Tables[0].Rows[i]["hwtime"].ToString();
                            dathomework[i].hwer      = ds.Tables[0].Rows[i]["hwer"].ToString();
                            dathomework[i].press     = ds.Tables[0].Rows[i]["press"].ToString();
                            dathomework[i].userclass = ds.Tables[0].Rows[i]["userclass"].ToString();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                iRel = -1;
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            return(dathomework);
        }
Exemple #26
0
        public menulevel2Data[] Select(string Id)
        {
            int iRel = -1;

            DataAccess.CommonDB objDB         = new DataAccess.CommonDB();
            menulevel2Data[]    datmenulevel2 = new menulevel2Data[1];
            string sql = "select * from menulevel2 where Id= " + Id + " ";

            try
            {
                objDB.OpenConnection();
                DataSet ds = objDB.QueryData(sql, "departmentinfo");
                if (ds.Tables.Count > 0)
                {
                    long nRow = ds.Tables[0].Rows.Count;
                    if (nRow > 0)
                    {
                        datmenulevel2 = new menulevel2Data[nRow];
                        for (int i = 0; i < nRow; i++)
                        {
                            datmenulevel2[i]          = new menulevel2Data();
                            datmenulevel2[i].level1id = ds.Tables[0].Rows[i]["level1id"].ToString();
                            datmenulevel2[i].menutype = ds.Tables[0].Rows[i]["menutype"].ToString();
                            datmenulevel2[i].menuname = ds.Tables[0].Rows[i]["menuname"].ToString();
                            datmenulevel2[i].menuurl  = ds.Tables[0].Rows[i]["menuurl"].ToString();
                            datmenulevel2[i].nums     = ds.Tables[0].Rows[i]["nums"].ToString();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                iRel = -1;
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            return(datmenulevel2);
        }
Exemple #27
0
        public materialData[] Select(string Id)
        {
            int iRel = -1;

            DataAccess.CommonDB objDB       = new DataAccess.CommonDB();
            materialData[]      datmaterial = new materialData[1];
            string sql = "select * from material where Id= " + Id + " ";

            try
            {
                objDB.OpenConnection();
                DataSet ds = objDB.QueryData(sql, "departmentinfo");
                if (ds.Tables.Count > 0)
                {
                    long nRow = ds.Tables[0].Rows.Count;
                    if (nRow > 0)
                    {
                        datmaterial = new materialData[nRow];
                        for (int i = 0; i < nRow; i++)
                        {
                            datmaterial[i] = new materialData();
                            datmaterial[i].materialtype = ds.Tables[0].Rows[i]["materialtype"].ToString();
                            datmaterial[i].materialtit  = ds.Tables[0].Rows[i]["materialtit"].ToString();
                            datmaterial[i].materialfile = ds.Tables[0].Rows[i]["materialfile"].ToString();
                            datmaterial[i].materialtime = ds.Tables[0].Rows[i]["materialtime"].ToString();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                iRel = -1;
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            return(datmaterial);
        }
Exemple #28
0
        public bbsData SelectData(string casestr)
        {
            int iRel = -1;

            DataAccess.CommonDB objDB  = new DataAccess.CommonDB();
            bbsData             datbbs = new bbsData();
            string sql = "select * from bbs where 1= 1  ";

            sql += casestr;
            try
            {
                objDB.OpenConnection();
                DataSet ds = objDB.QueryData(sql, "departmentinfo");
                if (ds.Tables.Count > 0)
                {
                    long nRow = ds.Tables[0].Rows.Count;
                    if (nRow > 0)
                    {
                        for (int i = 0; i < nRow; i++)
                        {
                            datbbs.userid  = ds.Tables[0].Rows[i]["userid"].ToString();
                            datbbs.thetime = ds.Tables[0].Rows[i]["thetime"].ToString();
                            datbbs.memos   = ds.Tables[0].Rows[i]["memos"].ToString();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                iRel = -1;
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            return(datbbs);
        }
Exemple #29
0
        public bool Update(string userid, string userpwrd)
        {
            int  iRel = -1;
            bool bRel = false;

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            try
            {
                objDB.OpenConnection();
                string strSql = "update users set userpwrd ='" + userpwrd + "' where userid='" + userid + "'";
                objDB.Command.CommandType = System.Data.CommandType.Text;
                objDB.Command.CommandText = strSql;
                iRel = objDB.Command.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                iRel = -1;
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            bRel  = (iRel.Equals(1) ? true : false);
            return(bRel);
        }
Exemple #30
0
        public bool Update(string Id, string scores, string messages)
        {
            int  iRel = -1;
            bool bRel = false;

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            try
            {
                objDB.OpenConnection();
                string strSql = "update correcting set scores='" + scores + "',messages='" + messages + "' where Id=" + Id + "";
                objDB.Command.CommandType = System.Data.CommandType.Text;
                objDB.Command.CommandText = strSql;
                iRel = objDB.Command.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                iRel = -1;
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            bRel  = (iRel.Equals(1) ? true : false);
            return(bRel);
        }