예제 #1
0
        public Boolean insertCurrency(currency curr)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                string updateSQL = "insert into Currency (CurrencyID,Name,Symbol,Status,CreateTime,CreateUser)" +
                                   "values (" +
                                   "'" + curr.CurrencyID + "'," +
                                   "'" + curr.name + "'," +
                                   "'" + curr.symbol + "'," +
                                   curr.status + "," +
                                   "GETDATE()" + "," +
                                   "'" + Login.userLoggedIn + "'" + ")";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("insert", "Currency", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
                status = false;
            }
            return(status);
        }
예제 #2
0
        public List <currency> getCurrencies()
        {
            currency        curr;
            List <currency> Currencies = new List <currency>();

            try
            {
                SqlConnection conn  = new SqlConnection(Login.connString);
                string        query = "select CurrencyID, Name,Symbol,status " +
                                      "from Currency order by CurrencyID";
                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    curr            = new currency();
                    curr.CurrencyID = reader.GetString(0);
                    curr.name       = reader.GetString(1);
                    curr.symbol     = reader.GetString(2);
                    curr.status     = reader.GetInt32(3);
                    Currencies.Add(curr);
                }
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(Currencies);
        }
예제 #3
0
        public Boolean updateCurrency(currency curr)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                string updateSQL = "update Currency set name='" + curr.name +
                                   "',Symbol='" + curr.symbol +
                                   "',Status=" + curr.status +
                                   " where CurrencyID='" + curr.CurrencyID + "'";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("update", "Currency", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
                status = false;
            }
            return(status);
        }
예제 #4
0
        public Boolean validateCurrency(currency curr)
        {
            Boolean status = true;

            try
            {
                if (curr.CurrencyID.Trim().Length == 0 || curr.CurrencyID == null)
                {
                    return(false);
                }
                if (curr.name.Trim().Length == 0 || curr.name == null)
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(status);
        }