Ejemplo n.º 1
0
        public DataTable GetCurrencyRecord(MyCurrency Data)
        {
            string _Query = "Select * from NVO_CurrencyMaster where ID=" + Data.ID;

            return(GetViewData(_Query, ""));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Returns the hashcode of this Object
 /// </summary>
 /// <returns>Hash code (int)</returns>
 public override int GetHashCode()
 {
     // Credit: http://stackoverflow.com/a/263416/677735
     unchecked             // Overflow is fine, just wrap
     {
         int hash = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hash = hash * 59 + Id.GetHashCode();
         }
         if (Name != null)
         {
             hash = hash * 59 + Name.GetHashCode();
         }
         if (Description != null)
         {
             hash = hash * 59 + Description.GetHashCode();
         }
         if (MyBoolean != null)
         {
             hash = hash * 59 + MyBoolean.GetHashCode();
         }
         if (MyCreditCard != null)
         {
             hash = hash * 59 + MyCreditCard.GetHashCode();
         }
         if (MyCurrency != null)
         {
             hash = hash * 59 + MyCurrency.GetHashCode();
         }
         if (MyDateTime != null)
         {
             hash = hash * 59 + MyDateTime.GetHashCode();
         }
         if (MyDouble != null)
         {
             hash = hash * 59 + MyDouble.GetHashCode();
         }
         if (MyEmail != null)
         {
             hash = hash * 59 + MyEmail.GetHashCode();
         }
         if (MyFloat != null)
         {
             hash = hash * 59 + MyFloat.GetHashCode();
         }
         if (MyImageUrl != null)
         {
             hash = hash * 59 + MyImageUrl.GetHashCode();
         }
         if (MyInteger != null)
         {
             hash = hash * 59 + MyInteger.GetHashCode();
         }
         if (MyLong != null)
         {
             hash = hash * 59 + MyLong.GetHashCode();
         }
         if (MyPhone != null)
         {
             hash = hash * 59 + MyPhone.GetHashCode();
         }
         if (MyPostalCode != null)
         {
             hash = hash * 59 + MyPostalCode.GetHashCode();
         }
         if (MyString != null)
         {
             hash = hash * 59 + MyString.GetHashCode();
         }
         if (MyTextArea != null)
         {
             hash = hash * 59 + MyTextArea.GetHashCode();
         }
         if (MyTicks != null)
         {
             hash = hash * 59 + MyTicks.GetHashCode();
         }
         if (MyUrl != null)
         {
             hash = hash * 59 + MyUrl.GetHashCode();
         }
         if (Comments != null)
         {
             hash = hash * 59 + Comments.GetHashCode();
         }
         if (AuditEntered != null)
         {
             hash = hash * 59 + AuditEntered.GetHashCode();
         }
         if (AuditEnteredBy != null)
         {
             hash = hash * 59 + AuditEnteredBy.GetHashCode();
         }
         if (AuditUpdated != null)
         {
             hash = hash * 59 + AuditUpdated.GetHashCode();
         }
         if (AuditUpdatedBy != null)
         {
             hash = hash * 59 + AuditUpdatedBy.GetHashCode();
         }
         return(hash);
     }
 }
Ejemplo n.º 3
0
        public List <MyCurrency> InsertCurrencyMaster(MyCurrency Data)
        {
            DbConnection  con = null;
            DbTransaction trans;

            try
            {
                con = _dbFactory.GetConnection();
                con.Open();
                trans = _dbFactory.GetTransaction(con);
                DbCommand Cmd = _dbFactory.GetCommand();
                Cmd.Connection  = con;
                Cmd.Transaction = trans;

                try
                {
                    Cmd.CommandText = " IF((select count(*) from NVO_CurrencyMaster where ID=@ID)<=0) " +
                                      " BEGIN " +
                                      " INSERT INTO  NVO_CurrencyMaster(CurrencyCode,CurrencyName,Status) " +
                                      " values (@CurrencyCode,@CurrencyName,@Status) " +
                                      " END  " +
                                      " ELSE " +
                                      " UPDATE NVO_CurrencyMaster SET CurrencyCode=@CurrencyCode,CurrencyName=@CurrencyName,Status=@Status where ID=@ID";

                    Cmd.Parameters.Add(_dbFactory.GetParameter("@ID", Data.ID));
                    Cmd.Parameters.Add(_dbFactory.GetParameter("@CurrencyCode", Data.CurrencyCode));
                    Cmd.Parameters.Add(_dbFactory.GetParameter("@CurrencyName", Data.CurrencyName));
                    Cmd.Parameters.Add(_dbFactory.GetParameter("@Status", Data.Status));

                    int result = Cmd.ExecuteNonQuery();

                    Cmd.CommandText = "select ident_current('NVO_CurrencyMaster')";
                    if (Data.ID == 0)
                    {
                        Data.ID = Int32.Parse(Cmd.ExecuteScalar().ToString());
                    }
                    else
                    {
                        Data.ID = Data.ID;
                    }

                    trans.Commit();
                    return(ListCurrency);
                }
                catch (Exception ex)
                {
                    string ss = ex.ToString();
                    trans.Rollback();
                    return(ListCurrency);
                }
            }


            catch (Exception ex)
            {
                throw ex;
            }

            finally
            {
                if (con != null && con.State != ConnectionState.Closed)
                {
                    con.Close();
                }
            }
        }