Пример #1
1
        public int maxid()
        {
            DAL.DataBase db = new DAL.DataBase();
            string sql = "select max(id) from file";

            DataTable dt = db.GetDataset(sql).Tables[0];
            db.closeconn();

            return (int)dt.Rows[0][0];
        }
Пример #2
0
        public string getpath(string title,string type,string uper)
        {
            DAL.DataBase db=new DAL.DataBase();
            string sql;
            DataTable dt;

            if (uper == "未知")
            {
                if (type == "未知")
                {
                    sql = "select path from file where title='" + title + "'";

                }
                else
                {
                    sql = "select path from file where title='" + title + "' and type='" + type + "'";
                }
            }
            else
            {
                if (type == "未知")
                {
                    sql = "select path from file where title='" + title + "' and uper='" + uper + "'";
                }
                else
                    sql = "select path from file where title='" + title + "' and type='" + type + "' and uper='" + uper + "'";
            }

            dt = db.GetDataset(sql).Tables[0];
            if (dt.Rows[0][0] != null)
                return (string)dt.Rows[0][0];
            else
                return "";
        }
Пример #3
0
        public DataSet basic()
        {
            DAL.DataBase db = new DAL.DataBase();

            string sql = "select title,type,name,time from file,customer where userid=customer.id";
            DataSet ds = db.GetDataset(sql);
            db.closeconn();
            return ds;
        }
Пример #4
0
        public DataTable getbasicfromtype(string type)
        {
            DAL.DataBase db = new DAL.DataBase();

            String sql = "select title,type,name,time from file,customer where userid=customer.id and type='" + type + "'";

            DataSet ds = db.GetDataset(sql);
            DataTable dt = ds.Tables[0];
            db.closeconn();
            return dt;
        }
Пример #5
0
        public DataSet getbasicformuper(string uper)
        {
            DAL.DataBase db = new DAL.DataBase();

            String sql = "select title,type,name,time from file,customer where userid=customer.id and name='" + uper + "'";

            DataSet ds = db.GetDataset(sql);
            DataTable dt = ds.Tables[0];

            db.closeconn();
            return ds;
        }
Пример #6
0
        public DataTable Get_Student_Info(string Id)
        {
            DAL.DataBase   dl    = new DAL.DataBase();
            SqlParameter[] param = new SqlParameter[1];
            param[0]       = new SqlParameter("@Id", SqlDbType.NVarChar, 50);
            param[0].Value = Id;
            dl.open();
            DataTable dt = new DataTable();

            dt = dl.SelectData("Get_Student_Info", param);
            return(dt);
        }
Пример #7
0
        public DataTable Search_Student(string ID)
        {
            DAL.DataBase DAl = new DAL.DataBase();
            DAl.open();
            DataTable dt = new DataTable();

            SqlParameter[] param = new SqlParameter[1];
            param[0]       = new SqlParameter("@ID", SqlDbType.NVarChar, 50);
            param[0].Value = ID;
            dt             = DAl.SelectData("Search_Student", param);
            DAl.close();
            return(dt);
        }
Пример #8
0
        public DataSet getbasicontime(DateTime tt)
        {
            DAL.DataBase db = new DAL.DataBase();

            DateTime t = tt.Date;
            DateTime t2 = t.AddDays(1);

            string sqltime = "select title,type,name,time from file,customer where userid=customer.id and time>='" + t + "' and time<='" + t2 + "'";

            DataSet ds = db.GetDataset(sqltime);
            db.closeconn();
            return ds;
        }
        public DataTable Login(string Id, string Password)
        {
            DAL.DataBase   dl    = new DAL.DataBase();
            SqlParameter[] param = new SqlParameter[2];
            param[0]       = new SqlParameter("@Id", SqlDbType.NChar, 10);
            param[0].Value = Id;

            param[1]       = new SqlParameter("@Password", SqlDbType.NChar, 10);
            param[1].Value = Password;

            dl.open();
            DataTable dt = new DataTable();

            dt = dl.SelectData("SP_LOGIN", param);
            return(dt);
        }
Пример #10
0
        public DataTable delete_cyber(string Id, bool cyber)
        {
            DAL.DataBase DAl = new DAL.DataBase();
            DAl.open();
            DataTable dt = new DataTable();

            SqlParameter[] param = new SqlParameter[2];
            param[0]       = new SqlParameter("@Id", SqlDbType.NVarChar, 50);
            param[0].Value = Id;

            param[1]       = new SqlParameter("@cyber", SqlDbType.Bit);
            param[0].Value = cyber;
            dt             = DAl.SelectData("delete_cyber", param);
            DAl.close();
            return(dt);
        }
Пример #11
0
        public FrmViewSchedule(string user, string pass)
        {
            InitializeComponent();
            DB = new DAL.DataBase();
            DB.open();


            this.Password = pass;
            this.User     = user;
            LctID         = getLectID();
            if (LctID == null)
            {
                MessageBox.Show("ID not found in the system!");
            }
            else if (LctID != null)
            {
                loadDataToGrid();
            }
        }
Пример #12
0
        public Form2()
        {
            InitializeComponent();

            DAL.DataBase db = new DAL.DataBase();
            String sql0 = "select distinct type from file";
            DataSet ds0 = db.GetDataset(sql0);

            ds0.Tables[0].Columns[0].ColumnName = "Type";

            //bindingSource2.DataMember = ds0.Tables[0].ToString();

            comboBox1.ValueMember = "Type";
            comboBox1.DataSource = ds0.Tables[0];

            String type = comboBox1.SelectedValue.ToString();

            db.closeconn();
        }
Пример #13
0
 public void insertfile(int id,string title,string type,DateTime dt,int userid,string path)
 {
     DAL.DataBase db = new DAL.DataBase();
     string sql = "insert into file(id,title,type,time,userid,path) values("+id+",'"+title+"','"+type+"','"+dt+"',"+userid+",'"+path+"')";
     db.execute(sql);
     db.closeconn();
 }
Пример #14
0
        public DataTable showtitle()
        {
            DAL.DataBase db = new DAL.DataBase();
            string sql = "select distinct title from file";

            DataTable dt = db.GetDataset(sql).Tables[0];
            db.closeconn();

            return dt;
        }
Пример #15
0
        public DataTable showtype()
        {
            DAL.DataBase db = new DAL.DataBase();
            String sql0 = "select distinct type from file";
            DataSet ds0 = db.GetDataset(sql0);

            DataTable dt = ds0.Tables[0];

            db.closeconn();
            return dt;
        }
Пример #16
0
 public DataTable showuper()
 {
     DAL.DataBase db = new DAL.DataBase();
     string sql = "select distinct name from customer,file where userid=customer.id";
     DataSet ds = db.GetDataset(sql);
     DataTable dt = ds.Tables[0];
     db.closeconn();
     return dt;
 }
Пример #17
0
        public DataTable titlerestrictedbytype(string type)
        {
            DAL.DataBase db = new DAL.DataBase();
            string sql = "select distinct title from file where type='" + type + "'";

            DataTable dt = db.GetDataset(sql).Tables[0];
            db.closeconn();

            return dt;
        }
Пример #18
0
        public DataTable uperrestrictedbytype(string type)
        {
            DAL.DataBase db = new DAL.DataBase();
            string sql = "select distinct name from file,customer where userid=customer.id and type='"+type+"'";

            DataTable dt = db.GetDataset(sql).Tables[0];
            db.closeconn();

            return dt;
        }