예제 #1
0
        public void update_index()
        {
            SqlHealper sh = new SqlHealper();
            DataTable  dt = sh.SelectDataBase("select P_index from tbl_P where P_ID='" + this.ID + "'");

            this.index = Convert.ToInt32(dt.Rows[0]["P_index"].ToString());
            return;
        }
예제 #2
0
 public bool update_by_index()
 {
     try
     {
         SqlHealper sh = new SqlHealper();
         sh.ExecuteCMD("update tbl_P  set P_ID = '" + this.ID + "',P_Name = '" + this.Name + "',P_Sex = '" + this.Sex + "',P_Birthday = '" + this.Birthday.ToShortDateString() + "',P_Jobday = '" + this.Jobday.ToShortDateString() + "',P_Education = '" + this.Education + "',P_Department = '" + this.Department + "',P_Duty = '" + this.Duty + "',P_Jobtype = '" + this.Jobtype + "' where P_index = " + this.index.ToString());
     }
     catch {
         return(false);
     }
     return(true);
 }
예제 #3
0
        public void initial_from_ID(string ID)
        {
            SqlHealper sh = new SqlHealper();
            DataTable  dt = new DataTable();

            dt         = sh.SelectDataBase("select * from tbl_U where U_ID = '" + ID + "'");
            this.index = Convert.ToInt32(dt.Rows[0]["U_index"].ToString());
            this.ID    = dt.Rows[0]["U_ID"].ToString();
            this.Name  = dt.Rows[0]["U_Name"].ToString();
            this.Pwd   = dt.Rows[0]["U_Pwd"].ToString();
            this.Role  = Convert.ToInt32(dt.Rows[0]["U_Role"].ToString());
            this.Limit = Convert.ToInt32(dt.Rows[0]["U_Limit"].ToString());
        }
예제 #4
0
        public bool add()
        {
            try
            {
                SqlHealper sh = new SqlHealper();
                sh.ExecuteCMD(
                    "insert into tbl_U( U_ID, U_Name, U_Pwd, U_Role, U_Limit)" +
                    "values" +
                    "('" + this.ID + "','" + this.Name + "','" + this.Pwd + "'," + this.Role.ToString() + "," + this.Limit.ToString() + ")"
                    );
            }
            catch
            {
                return(false);
            }

            return(true);
        }
예제 #5
0
        public bool add()
        {
            try
            {
                SqlHealper sh = new SqlHealper();
                sh.ExecuteCMD(
                    "insert into tbl_M" +
                    "(M_ID, M_Classify, M_MakePrice, M_SellPrice, M_Unit, M_Memo)" +
                    "values" +
                    "('" + this.ID + "','" + this.Classify + "','" + this.MakePrice + "','" + this.SellPrice + "','" + this.Unit + "','" + this.Memo + "')"
                    );
            }
            catch
            {
                return(false);
            }

            return(true);
        }
예제 #6
0
        public bool add()
        {
            try
            {
                SqlHealper sh = new SqlHealper();
                sh.ExecuteCMD(
                    "INSERT INTO tbl_P(" +
                    "P_ID , P_Name , P_Sex , P_Birthday , P_Jobday , P_Education , P_Department , P_Duty , P_Jobtype " +
                    ")values(" +
                    "'" + this.ID + "','" + this.Name + "','" + this.Sex + "','" + this.Birthday.ToShortDateString() + "','" + this.Jobday.ToShortDateString() + "','" + this.Education + "','" + this.Department + "','" + this.Duty + "','" + this.Jobtype + "'" +
                    ")"
                    );
            }
            catch
            {
                return(false);
            }

            return(true);
        }
예제 #7
0
        static void Main(string[] args)
        {
            string user = "", passwd = "", domain = "", database = "";

            XmlReader.Read(ref domain, ref user, ref passwd, ref database);
            Console.WriteLine("user = "******"passwd = " + passwd);
            Console.WriteLine("domain = " + domain);


            SqlHealper sh = new SqlHealper();

            sh.ExecuteCMD("update tbl_P set P_Jobtype='管理' where P_ID='test1'");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());

            Console.ReadLine();
        }
예제 #8
0
 public bool update_by_index()
 {
     try
     {
         SqlHealper sh = new SqlHealper();
         sh.ExecuteCMD(
             "update tbl_U " +
             "set U_ID = '" + this.ID + "'," +
             "U_Name = '" + this.Name + "'," +
             "U_pwd = '" + this.Pwd + "'," +
             "U_role = '" + this.Role + "'," +
             "U_Limit = '" + this.Limit + "'" +
             " where U_index = " + this.index.ToString()
             );
     }
     catch
     {
         return(false);
     }
     return(true);
 }
예제 #9
0
 public bool update_by_index()
 {
     try
     {
         SqlHealper sh = new SqlHealper();
         sh.ExecuteCMD(
             "update tbl_M " +
             "set M_ID = '" + this.ID + "'," +
             "M_Classify = '" + this.Classify + "'," +
             "M_MakePrice = '" + this.MakePrice + "'," +
             "M_SellPrice = '" + this.SellPrice + "'," +
             "M_Unit = '" + this.Unit + "'," +
             "M_Memo = '" + this.Memo + "' " +
             "where M_index = " + this.index
             );
     }
     catch
     {
         return(false);
     }
     return(true);
 }
예제 #10
0
        public bool judge()
        {
            SqlHealper sh = new SqlHealper();
            DataTable  dt = new DataTable();

            dt = sh.SelectDataBase("select U_pwd from tbl_U where U_ID = '" + this.user + "'");

            if (dt.Rows.Count == 0)//if the query is none result
            {
                return(false);
            }

            string pwd = dt.Rows[0]["U_pwd"].ToString();

            if (pwd == this.passwd)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #11
0
        public static DataTable search(string field, string key)
        {
            SqlHealper sh = new SqlHealper();

            return(sh.SelectDataBase("SELECT P_ID as ID, P_Name as Name, P_Sex as Sex, P_Birthday as Birthday, P_Jobday as Jobday, P_Education as education, P_Department as department, P_Duty as duty, P_Jobtype as jobtype FROM tbl_P where " + field + " like '%" + key + "%'"));
        }
예제 #12
0
        public void delete_by_index()
        {
            SqlHealper sh = new SqlHealper();

            sh.ExecuteCMD("delete tbl_P where P_index = " + this.index.ToString());
        }
예제 #13
0
        public static DataTable search(string field, string key)
        {
            SqlHealper sh = new SqlHealper();

            return(sh.SelectDataBase("SELECT M_ID as ID, M_Classify as Classify, M_MakePrice as makeprice, M_SellPrice as sellprice, M_Unit as unit, M_Memo as memo FROM tbl_M where " + field + " like '%" + key + "%'"));
        }
예제 #14
0
        public static DataTable get_user_table()
        {
            SqlHealper sh = new SqlHealper();

            return(sh.SelectDataBase("select * from tbl_U"));
        }
예제 #15
0
        public static DataTable RefreashTable()
        {
            SqlHealper sh = new SqlHealper();

            return(sh.SelectDataBase("SELECT P_ID as ID, P_Name as Name, P_Sex as Sex, P_Birthday as Birthday, P_Jobday as Jobday, P_Education as education, P_Department as department, P_Duty as duty, P_Jobtype as jobtype FROM tbl_P"));
        }
예제 #16
0
        private void Form1_Load(object sender, EventArgs e)
        {
            SqlHealper sh = new SqlHealper();

            this.dataGridView1.DataSource = sh.SelectDataBase("select * from tbl_P");
        }
예제 #17
0
        public static DataTable refreash_table()
        {
            SqlHealper sh = new SqlHealper();

            return(sh.SelectDataBase("select M_ID as ID, M_Classify as classify, M_MakePrice as makePrice, M_SellPrice as sellprice, M_Unit as unit , M_Memo as memo from tbl_M"));
        }
예제 #18
0
        public static void delete_by_index(string index)
        {
            SqlHealper sh = new SqlHealper();

            sh.ExecuteCMD("delete tbl_U where U_index = " + index.ToString());
        }