Пример #1
0
        public Boolean updateTaxItem(taxitem ti)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                string updateSQL = "update TaxItem set description='" + ti.Description +
                                   "', AccountCodeIN='" + ti.AccountCodeIN +
                                   "', AccountCodeOUT='" + ti.AccountCodeOUT +
                                   "',Status=" + ti.status +
                                   " where TaxItemID='" + ti.TaxItemID + "'";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("update", "TaxItem", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }
Пример #2
0
        public Boolean validateTaxItem(taxitem ti)
        {
            Boolean status = true;

            try
            {
                if (ti.TaxItemID.Trim().Length == 0 || ti.TaxItemID.Trim() == null)
                {
                    return(false);
                }
                if (ti.Description.Trim().Trim().Length == 0 || ti.Description == null)
                {
                    return(false);
                }
                if (ti.AccountCodeIN.Trim().Length == 0 || ti.AccountCodeIN == null)
                {
                    MessageBox.Show("Please Select the Account code IN");
                    return(false);
                }
                if (ti.AccountCodeOUT.Trim().Length == 0 || ti.AccountCodeOUT == null)
                {
                    MessageBox.Show("Please Select the Account code OUT");
                    return(false);
                }
            }
            catch (Exception)
            {
            }
            return(status);
        }
Пример #3
0
        public List <taxitem> getTaxItems()
        {
            taxitem        ti;
            List <taxitem> TaxItems = new List <taxitem>();

            try
            {
                SqlConnection conn  = new SqlConnection(Login.connString);
                string        query = "select a.TaxItemID, a.Description,a.AccountCodeIN,a.AccountCodeOUT,a.status " +
                                      "from TaxItem a order by a.TaxItemID";
                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    ti                = new taxitem();
                    ti.TaxItemID      = reader.GetString(0);
                    ti.Description    = reader.GetString(1);
                    ti.AccountCodeIN  = reader.GetString(2);
                    ti.AccountCodeOUT = reader.IsDBNull(3) ? "" : reader.GetString(3);
                    ti.status         = reader.GetInt32(4);
                    TaxItems.Add(ti);
                }
                conn.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Error querying Tax Item");
            }
            return(TaxItems);
        }
Пример #4
0
        public Boolean insertTaxItem(taxitem ti)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                string updateSQL = "insert into TaxItem (TaxItemID,Description,AccountCodeIN,AccountCodeOUT,Status,CreateTime,CreateUser)" +
                                   "values (" +
                                   "'" + ti.TaxItemID + "'," +
                                   "'" + ti.Description + "'," +
                                   "'" + ti.AccountCodeIN + "'," +
                                   "'" + ti.AccountCodeOUT + "'," +
                                   ti.status + "," +
                                   "GETDATE()" + "," +
                                   "'" + Login.userLoggedIn + "'" + ")";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("insert", "TaxItem", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }