Esempio n. 1
0
        public Boolean insertTaxCode(taxcode tc)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                string updateSQL = "insert into TaxCode (TaxCode,Description,Status,CreateTime,CreateUser)" +
                                   "values (" +
                                   "'" + tc.TaxCode + "'," +
                                   "'" + tc.Description + "'," +
                                   tc.status + "," +
                                   "GETDATE()" + "," +
                                   "'" + Login.userLoggedIn + "'" + ")";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("insert", "TaxCode", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }
Esempio n. 2
0
        public List <taxcode> getTaxCode()
        {
            taxcode        tc;
            List <taxcode> TaxCodes = new List <taxcode>();

            try
            {
                SqlConnection conn  = new SqlConnection(Login.connString);
                string        query = "select TaxCode, Description,status " +
                                      "from Taxcode  order by Taxcode";
                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    tc             = new taxcode();
                    tc.TaxCode     = reader.GetString(0);
                    tc.Description = reader.GetString(1);
                    tc.status      = reader.GetInt32(2);
                    TaxCodes.Add(tc);
                }
                conn.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Error querying Tax Code");
            }
            return(TaxCodes);
        }
Esempio n. 3
0
        public Boolean updateTaxCode(taxcode tc)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                string updateSQL = "update TaxCode set Description='" + tc.Description +
                                   "', Status=" + tc.status +
                                   " where TaxCode='" + tc.TaxCode + "'";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("update", "TaxCode", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }
Esempio n. 4
0
        public Boolean validateTaxCode(taxcode tc)
        {
            Boolean status = true;

            try
            {
                if (tc.TaxCode.Trim().Length == 0 || tc.TaxCode == null)
                {
                    return(false);
                }
                if (tc.Description.Trim().Length == 0 || tc.Description == null)
                {
                    return(false);
                }
            }
            catch (Exception)
            {
            }
            return(status);
        }