コード例 #1
0
        public static Student GetbyId(string id)
        {
            a = new Student();
            string sql = string.Format("select * from T_Student where id='{0}'", id);

            dr = DBAcess.GetDataRow(sql);
            try
            {
                a.Id        = dr["ID"].ToString();
                a.Name      = dr["name"].ToString();
                a.Sex       = dr["sex"].ToString();
                a.Political = dr["political"].ToString();
                a.Pincodes  = dr["pincodes"].ToString();
                a.Grade     = dr["grade"].ToString();
                a.class1    = dr["class"].ToString();
                a.Address   = dr["address"].ToString();
                a.Phone     = dr["phone"].ToString();
                a.Main      = Convert.ToBoolean(dr["main"]);
                a.Imgurl    = dr["img"].ToString();
                return(a);
            }
            catch
            {
                //throw ei;
                // return null;
                return(a);
            }
        }
コード例 #2
0
        public static List <Vacation> GetALL(string condition)
        {
            List <Vacation> list = new List <Vacation>();
            string          sql  = string.Format("select * from T_Vacation where condition='{0}'", condition);

            ds = DBAcess.GetDataSet(sql);
            if (ds == null)
            {
                return(null);
            }
            else
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    a             = new Vacation();
                    a.number      = dr["Number"].ToString();
                    a.id          = dr["ID"].ToString();
                    a.name        = dr["name"].ToString();
                    a.type        = dr["type"].ToString();
                    a.reason      = dr["reason"].ToString();
                    a.daystart    = dr["daystart"].ToString();
                    a.dayover     = dr["dayover"].ToString();
                    a.applytime   = dr["applytime"].ToString();
                    a.agreepeople = dr["applytime"].ToString();
                    a.condition   = dr["condition"].ToString();
                    list.Add(a);
                }
                return(list);
            }
        }
コード例 #3
0
        public static List <Student> GetALL()
        {
            List <Student> list = new List <Student>();

            sql = "select * from T_Student";
            ds  = DBAcess.GetDataSet(sql);
            if (ds == null)
            {
                return(null);
            }
            else
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    a          = new Student();
                    a.Id       = dr["id"].ToString();
                    a.Name     = dr["Name"].ToString();
                    a.Classes  = dr["Classes"].ToString();
                    a.Major    = dr["Major"].ToString();
                    a.College  = dr["College"].ToString();
                    a.Grade    = dr["grade"];
                    a.Sex      = dr["Sex"].ToString();
                    a.Address  = dr["Address"].ToString();
                    a.Pincodes = dr["pincodes"].ToString();
                    a.Imgurl   = dr["Imgurl"].ToString();
                    a.Main     = true;
                    list.Add(a);
                }
                return(list);
            }
        }
コード例 #4
0
        public static List <Student> GetALL()
        {
            List <Student> list = new List <Student>();

            sql = "select * from T_Student";
            ds  = DBAcess.GetDataSet(sql);
            if (ds == null)
            {
                return(null);
            }
            else
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    a           = new Student();
                    a.Id        = dr["ID"].ToString();
                    a.Name      = dr["name"].ToString();
                    a.Sex       = dr["sex"].ToString();
                    a.Political = dr["political"].ToString();
                    a.Grade     = dr["grade"].ToString();
                    a.class1    = dr["class"].ToString();
                    a.Address   = dr["address"].ToString();
                    a.Phone     = dr["phone"].ToString();
                    a.Main      = true;
                    list.Add(a);
                }
                return(list);
            }
        }
コード例 #5
0
        public static IList <SystemLog> Show()
        {
            List <SystemLog> list = new List <SystemLog>();
            string           sql  = "select LogID,Operator.DateTime,Activity,Status,IPAdd,DetailInfo from T_SystemLog";
            DataSet          ds   = DBAcess.GetDataSet(sql);

            if (ds == null)
            {
                return(null);
            }
            else
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    SystemLog sl = new SystemLog();
                    sl.LogID      = (dr["LogID"].ToString());
                    sl.Operator   = (dr["Operator"].ToString());
                    sl.DateTimes  = (dr["DateTime"].ToString());
                    sl.Activity   = (dr["Activity"].ToString());
                    sl.Status     = (dr["Status"].ToString());
                    sl.IPAdd      = (dr["IPAdd"].ToString());
                    sl.DetailInfo = (dr["DetailInfo"].ToString());
                    list.Add(sl);
                }
                return(list);
            }
        }
コード例 #6
0
 public static bool Add(Student a)
 {
     //string x=string.Format("insert into T_Stduent(id,name,classes,major,college,grade,sex,address,pincodes,imgurl) values ("+a.Id+","+a.Name+","+a.Classes+","+a.Major+","+a.College+","+a.Grade+","+a.Sex+","+a.Address+","+a.Pincodes+","+a.Imgurl+")");
     sql = string.Format("insert into T_Student(id,name,classes,major,college,grade,sex,address,pincodes,imgurl,dayruxue) values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}')", a.Id, a.Name, a.Classes, a.Major, a.College, a.Grade, a.Sex, a.Address, a.Pincodes, a.Imgurl, a.DayRuxue);
     //sql = x;
     return(DBAcess.ExecSqlCommand(sql));
 }
コード例 #7
0
        public static Student GetbyId(object id)
        {
            a = new Student();
            string sql = string.Format("select * from T_Student where id='{0}'", id);

            dr = DBAcess.GetDataRow(sql);
            try
            {
                a.Id       = dr["id"];
                a.Name     = dr["Name"].ToString();
                a.Classes  = dr["Classes"].ToString();
                a.Major    = dr["Major"].ToString();
                a.College  = dr["College"].ToString();
                a.Grade    = dr["grade"];
                a.Sex      = dr["Sex"].ToString();
                a.Address  = dr["Address"].ToString();
                a.Pincodes = dr["pincodes"].ToString();
                a.Imgurl   = dr["Imgurl"].ToString();
                a.DayRuxue = dr["Dayruxue"].ToString();
                //a.Imgurl = dr["picture"].ToString();
                a.Main = true;
                return(a);
            }
            catch
            {
                //throw ei;
                // return null;
                return(a);
            }
        }
コード例 #8
0
        public static IList <Score> getAll()
        {
            List <Score> list = new List <Score>();
            string       sql  = "select sid,stuid,T_Score.cid,cname,score from T_Score,T_Course where T_Score.cid=T_Course.cid";

            ds = DBAcess.GetDataSet(sql);
            if (ds == null)
            {
                return(null);
            }
            else
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    sc        = new Score();
                    sc.Sid    = int.Parse(dr["sid"].ToString());
                    sc.Stuid  = dr["stuid"].ToString();
                    sc.Cid    = int.Parse(dr["cid"].ToString());
                    sc.Cname  = dr["cname"].ToString();
                    sc.Scores = int.Parse(dr["score"].ToString());
                    list.Add(sc);
                }
                return(list);
            }
        }
コード例 #9
0
        public static void AddToAdmin(Student a)
        {
            string x = a.Pincodes.Substring(a.Pincodes.Length - 6);

            sql = string.Format("insert into T_Admin(ID,Password,Privilege) values ('{0}','{1}','{2}')", a.Id, x, 0);
            DBAcess.ExecSqlCommand(sql);
        }
コード例 #10
0
        public static Vacation GetbyId(string id)
        {
            a = new Vacation();
            string sql = string.Format("select * from T_Vacation where Number='{0}'", id);

            dr = DBAcess.GetDataRow(sql);
            try
            {
                a.number      = dr["Number"].ToString();
                a.id          = dr["ID"].ToString();
                a.name        = dr["name"].ToString();
                a.type        = dr["type"].ToString();
                a.reason      = dr["reason"].ToString();
                a.daystart    = dr["daystart"].ToString();
                a.dayover     = dr["dayover"].ToString();
                a.applytime   = dr["applytime"].ToString();
                a.agreepeople = dr["agreepeople"].ToString();
                a.condition   = dr["condition"].ToString();
                return(a);
            }
            catch
            {
                return(a);
            }
        }
コード例 #11
0
 public static bool checkAdmin(Admin a)
 {
     sql = string.Format("select * from T_Admin where ID='{0}' and Password='******' and Privilege='{2}'", a.Id, a.Password, a.Privilege);
     ds  = DBAcess.GetDataSet(sql);
     if (ds != null)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #12
0
        public static Admin getRow(string id)
        {
            sc = new Admin();
            string sql = string.Format("select * from T_Admin where id='{0}'", id);

            dr = DBAcess.GetDataRow(sql);
            try
            {
                sc.Id        = dr["id"].ToString();
                sc.Password  = dr["password"].ToString();
                sc.Privilege = int.Parse(dr["privilege"].ToString());
                return(sc);
            }
            catch
            {
                return(null);
            }
        }
コード例 #13
0
        public static Score getRow(int sid)
        {
            sc = new Score();
            string sql = string.Format("select T_Score.cid,cname,score from T_Score,T_Course where sid='{0}'", sid);

            dr = DBAcess.GetDataRow(sql);
            try
            {
                sc.Cid    = int.Parse(dr["cid"].ToString());
                sc.Cname  = dr["cname"].ToString();
                sc.Scores = int.Parse(dr["score"].ToString());
                return(sc);
            }
            catch
            {
                return(null);
            }
        }
コード例 #14
0
        public static Dictionary <int, String> getCourse()
        {
            int    cid;
            String cname;
            Dictionary <int, String> dic = new Dictionary <int, String>();
            string sql = string.Format("select * from T_Course");

            ds = DBAcess.GetDataSet(sql);
            if (ds == null)
            {
                return(null);
            }
            else
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    cid   = int.Parse(dr["cid"].ToString());
                    cname = dr["cname"].ToString();
                    dic.Add(cid, cname);
                }
                return(dic);
            }
        }
コード例 #15
0
        public static IList <Admin> adminList()
        {
            List <Admin> list = new List <Admin>();

            sql = "select * from T_Admin";
            ds  = DBAcess.GetDataSet(sql);
            if (ds == null)
            {
                return(null);
            }
            else
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    sc           = new Admin();
                    sc.Id        = dr["Id"].ToString();
                    sc.Password  = dr["Password"].ToString();
                    sc.Privilege = int.Parse(dr["Privilege"].ToString());
                    list.Add(sc);
                }
                return(list);
            }
        }
コード例 #16
0
 public static bool UpdateAgree(Vacation a)
 {
     sql = string.Format("update T_Vacation set agreepeople='{0}' where Number='{1}'", a.agreepeople, a.number);
     return(DBAcess.ExecSqlCommand(sql));
 }
コード例 #17
0
 public static bool Add(Student a)
 {
     sql = string.Format("insert into T_Student(ID,name,sex,political,pincodes,grade,class,address,phone,main,img) values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}')", a.Id, a.Name, a.Sex, a.Political, a.Pincodes, a.Grade, a.class1, a.Address, a.Phone, a.Main, a.Imgurl);
     return(DBAcess.ExecSqlCommand(sql));
 }
コード例 #18
0
 public static bool Delete(int sid)
 {
     sql = string.Format("Delete T_Score where sid='{0}'", sid);
     return(DBAcess.ExecSqlCommand(sql));
 }
コード例 #19
0
 public static bool Update(Score a)
 {
     sql = string.Format("update T_Score set score='{0}' where sid='{1}' ", a.Scores, a.Sid);
     return(DBAcess.ExecSqlCommand(sql));
 }
コード例 #20
0
 public static bool Add(Score a)
 {
     sql = string.Format("insert into T_Score (cid,stuid,score) values ('{0}','{1}','{2}')", a.Cid, a.Stuid, a.Scores);
     return(DBAcess.ExecSqlCommand(sql));
 }
コード例 #21
0
 public static bool Update(Student a)
 {
     sql = string.Format("update T_Student set name='{0}',political='{1}',grade='{2}',class='{3}',address='{4}',phone='{5}',sex='{6}',pincodes='{7}',img='{8}' where ID='{9}'", a.Name, a.Political, a.Grade, a.class1, a.Address, a.Phone, a.Sex, a.Pincodes, a.Imgurl, a.Id);
     return(DBAcess.ExecSqlCommand(sql));
 }
コード例 #22
0
 public static bool Add(Admin a)
 {
     sql = string.Format("insert into T_Admin (ID,Password,Privilege) values ('{0}','{1}','{2}')", a.Id, a.Password, a.Privilege);
     return(DBAcess.ExecSqlCommand(sql));
 }
コード例 #23
0
 public static int Count(Vacation a)
 {
     sql = string.Format("SELECT COUNT(condition) FROM T_Vacation WHERE condition = '未审批'");
     return(DBAcess.ExecSqlCommand1(sql));
 }
コード例 #24
0
 public static bool Delete(string id)
 {
     sql = string.Format("Delete T_Student where id='{0}'", id);
     return(DBAcess.ExecSqlCommand(sql));
 }
コード例 #25
0
 public static bool Add(Vacation a)
 {
     sql = string.Format("insert into T_Vacation(ID,name,type,reason,daystart,dayover,applytime,condition,Number) values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')", a.id, a.name, a.type, a.reason, a.daystart, a.dayover, a.applytime, a.condition, a.number);
     return(DBAcess.ExecSqlCommand(sql));
 }
コード例 #26
0
 public static bool Update(Admin a)
 {
     sql = string.Format("update T_Admin set Password='******',Privilege='{1}' where ID='{2}' ", a.Password, a.Privilege, a.Id);
     return(DBAcess.ExecSqlCommand(sql));
 }
コード例 #27
0
 public static bool Delete(string id)
 {
     sql = string.Format("Delete T_Vacation where Number='{0}'", id);
     return(DBAcess.ExecSqlCommand(sql));
 }
コード例 #28
0
 public static bool AddSL(SystemLog sl)
 {
     sql = string.Format("insert into T_SystemLog (Operator,Activity,Status,IPAdd,DetailInfo) values ('{0}','{1}','{2}','{3}','{4}') ", sl.Operator, sl.Activity, sl.Status, sl.IPAdd, sl.DetailInfo);
     return(DBAcess.ExecSqlCommand(sql));
 }
コード例 #29
0
 public static bool Update(Student a)
 {
     sql = string.Format("update T_Student set name='{0}',classes='{1}',major='{2}',college='{3}',grade='{4}',sex='{5}',address='{6}',pincodes='{7}',imgurl='{8}' where id='{9}'", a.Name, a.Classes, a.Major, a.College, a.Grade, a.Sex, a.Address, a.Pincodes, a.Imgurl, a.Id);
     return(DBAcess.ExecSqlCommand(sql));
 }
コード例 #30
0
 public static bool Delete(String id)
 {
     sql = string.Format("delete T_Admin where id='{0}'", id);
     return(DBAcess.ExecSqlCommand(sql));
 }