Example #1
0
        public int CompanyUpDate(getGongsi Company)
        {
            int intFalg = 0;

            try
            {
                string str_Update = "update Company  set ";
                str_Update += "CompanyName='" + Company.getCompanyName + "',CompanyDirector='" + Company.getCompanyDirector + "',";
                str_Update += "CompanyPhone='" + Company.getCompanyPhone + "',CompanyAddress='" + Company.getCompanyAddress + "',";
                str_Update += "Falg='" + Company.getEmpFalg + "' where CompanyID ='" + Company.getCompanyID + "'";


                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Update, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Example #2
0
        public int CompanyAdd(getGongsi Company)
        {
            int intFalg = 0;

            try
            {
                string str_Add = "insert into Company values( ";
                str_Add += "'" + Company.getCompanyID + "','" + Company.getCompanyName + "','" + Company.getCompanyDirector + "',";
                str_Add += "'" + Company.getCompanyPhone + "','" + Company.getCompanyAddress + "',";
                str_Add += "'" + Company.getEmpFalg + "')";
                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Add, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                return(intFalg);
            }
        }
Example #3
0
        public int CompanyDelete(getGongsi Company)
        {
            int intFalg = 0;

            try
            {
                string str_Del = "update Company  set ";
                str_Del += "Falg='" + Company.getEmpFalg + "' where CompanyID ='" + Company.getCompanyID + "'";


                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Del, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }