Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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));
 }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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));
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 18
0
 public static bool Delete(int sid)
 {
     sql = string.Format("Delete T_Score where sid='{0}'", sid);
     return(DBAcess.ExecSqlCommand(sql));
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 23
0
 public static int Count(Vacation a)
 {
     sql = string.Format("SELECT COUNT(condition) FROM T_Vacation WHERE condition = '未审批'");
     return(DBAcess.ExecSqlCommand1(sql));
 }
Ejemplo n.º 24
0
 public static bool Delete(string id)
 {
     sql = string.Format("Delete T_Student where id='{0}'", id);
     return(DBAcess.ExecSqlCommand(sql));
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 27
0
 public static bool Delete(string id)
 {
     sql = string.Format("Delete T_Vacation where Number='{0}'", id);
     return(DBAcess.ExecSqlCommand(sql));
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 30
0
 public static bool Delete(String id)
 {
     sql = string.Format("delete T_Admin where id='{0}'", id);
     return(DBAcess.ExecSqlCommand(sql));
 }