public int tb_CompanyMenthodUpDate(_Company Company)
        {
            int intFalg = 0;

            try
            {
                string str_Add = "update tb_Company  set ";
                str_Add += "CompanyName='" + Company.strCompanyName + "',CompanyDirector='" + Company.strCompanyDirector + "',";
                str_Add += "CompanyPhone='" + Company.strCompanyPhone + "',CompanyFax='" + Company.strCompanyFax + "',CompanyAddress='" + Company.strCompanyAddress + "',";
                str_Add += "CompanyRemark='" + Company.strCompanyRemark + "',ReDateTime='" + Company.daReDateTime + "',Falg='" + Company.intEmpFalg + "' where CompanyID ='" + Company.intCompanyID + "'";


                _getSqlConnection getConnection = new _getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Add, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
示例#2
0
        public object Select(int num)
        {
            object         result = null;
            CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

            try
            {
                try
                {
                    CSQLParameterList plist = new CSQLParameterList();
                    plist.Add("@num", DbType.Int32, num, ParameterDirection.Input);
                    CSQLDataAdepterList adlist = new CSQLDataAdepterList();
                    CSQLStatementValue  csv    = new CSQLStatementValue(this._statement, plist, NoomLibrary.StatementType.Select);
                    adlist.Add(csv);
                    cstate.Open();
                    result = cstate.Execute(adlist);
                    DataTable dt = (DataTable)result;

                    foreach (DataRow item in dt.Rows)
                    {
                        int      id = int.Parse(item["ID"].ToString());
                        _Company _c = new _Company();
                        _c.Companycode = item["companycode"].ToString();
                        _c.CompanyName = item["companyname"].ToString();
                        this.Add(id, _c);
                    }

                    cstate.Commit();
                }
                catch (SqlException)
                {
                    cstate.Rollback();
                    throw;
                }
                finally
                {
                    cstate.Close();
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(result);
        }
        public int tb_CompanyMenthodAdd(_Company Company)
        {
            int intFalg = 0;

            try
            {
                string str_Add = "insert into tb_Company values( ";
                str_Add += "'" + Company.intCompanyID + "','" + Company.strCompanyName + "','" + Company.strCompanyDirector + "',";
                str_Add += "'" + Company.strCompanyPhone + "','" + Company.strCompanyFax + "','" + Company.strCompanyAddress + "',";
                str_Add += "'" + Company.strCompanyRemark + "','" + Company.daReDateTime + "','" + Company.intEmpFalg + "')";
                _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);
            }
        }
        public int tb_CompanyMenthodDelete(_Company Company)
        {
            int intFalg = 0;

            try
            {
                string str_Add = "update tb_Company  set ";
                str_Add += "Falg='" + Company.intEmpFalg + "' where CompanyID ='" + Company.intCompanyID + "'";


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