/// <summary>
		/// 	Update an existing row in the datasource.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">HearbalKartDB.Entities.States object to update.</param>
		/// <remarks>
		///		After updating the datasource, the HearbalKartDB.Entities.States object will be updated
		/// 	to refelect any changes made by the datasource. (ie: identity or computed columns)
		/// </remarks>
		/// <returns>Returns true if operation is successful.</returns>
        /// <exception cref="System.Exception">The command could not be executed.</exception>
        /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception>
        /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception>
		public override bool Update(TransactionManager transactionManager, HearbalKartDB.Entities.States entity)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);
			DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.States_Update", _useStoredProcedure);
			
            database.AddInParameter(commandWrapper, "@Id", DbType.Int32, entity.Id );
			database.AddInParameter(commandWrapper, "@CountryId", DbType.Int32, (entity.CountryId.HasValue ? (object) entity.CountryId : System.DBNull.Value) );
            database.AddInParameter(commandWrapper, "@Name", DbType.String, entity.Name );
			database.AddInParameter(commandWrapper, "@Pin", DbType.Int64, (entity.Pin.HasValue ? (object) entity.Pin : System.DBNull.Value) );
			database.AddInParameter(commandWrapper, "@IsActive", DbType.Boolean, (entity.IsActive.HasValue ? (object) entity.IsActive : System.DBNull.Value) );
			database.AddInParameter(commandWrapper, "@CreatedDate", DbType.DateTime, (entity.CreatedDate.HasValue ? (object) entity.CreatedDate : System.DBNull.Value) );
			database.AddInParameter(commandWrapper, "@ModifiedDate", DbType.DateTime, (entity.ModifiedDate.HasValue ? (object) entity.ModifiedDate : System.DBNull.Value) );
			database.AddInParameter(commandWrapper, "@DeletedDate", DbType.DateTime, (entity.DeletedDate.HasValue ? (object) entity.DeletedDate : System.DBNull.Value) );
            database.AddInParameter(commandWrapper, "@PinCode", DbType.String, entity.PinCode );
			
			int results = 0;
			
			//Provider Data Requesting Command Event
			OnDataRequesting(new CommandEventArgs(commandWrapper, "Update", entity));

			if (transactionManager != null)
			{
				results = Utility.ExecuteNonQuery(transactionManager, commandWrapper);
			}
			else
			{
				results = Utility.ExecuteNonQuery(database,commandWrapper);
			}
			
			//Stop Tracking Now that it has been updated and persisted.
			if (DataRepository.Provider.EnableEntityTracking)
            {
                EntityManager.StopTracking(entity.EntityTrackingKey);				
            }
			
			
			entity.AcceptChanges();
			
			//Provider Data Requested Command Event
			OnDataRequested(new CommandEventArgs(commandWrapper, "Update", entity));

			return Convert.ToBoolean(results);
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="T:ProdOfferItem"/> class.
        /// </summary>
		public ProdOfferItem(HearbalKartDB.Entities.ProdOffer entity)
			: base()
		{
			_entity = entity;
		}
		/// <summary>
		/// 	Inserts a HearbalKartDB.Entities.States object into the datasource using a transaction.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">HearbalKartDB.Entities.States object to insert.</param>
		/// <remarks>
		///		After inserting into the datasource, the HearbalKartDB.Entities.States object will be updated
		/// 	to refelect any changes made by the datasource. (ie: identity or computed columns)
		/// </remarks>	
		/// <returns>Returns true if operation is successful.</returns>
        /// <exception cref="System.Exception">The command could not be executed.</exception>
        /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception>
        /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception>
		public override bool Insert(TransactionManager transactionManager, HearbalKartDB.Entities.States entity)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);
			DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.States_Insert", _useStoredProcedure);
			
			database.AddOutParameter(commandWrapper, "@Id", DbType.Int32, 4);
			database.AddInParameter(commandWrapper, "@CountryId", DbType.Int32, (entity.CountryId.HasValue ? (object) entity.CountryId  : System.DBNull.Value));
            database.AddInParameter(commandWrapper, "@Name", DbType.String, entity.Name );
			database.AddInParameter(commandWrapper, "@Pin", DbType.Int64, (entity.Pin.HasValue ? (object) entity.Pin  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@IsActive", DbType.Boolean, (entity.IsActive.HasValue ? (object) entity.IsActive  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@CreatedDate", DbType.DateTime, (entity.CreatedDate.HasValue ? (object) entity.CreatedDate  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@ModifiedDate", DbType.DateTime, (entity.ModifiedDate.HasValue ? (object) entity.ModifiedDate  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@DeletedDate", DbType.DateTime, (entity.DeletedDate.HasValue ? (object) entity.DeletedDate  : System.DBNull.Value));
            database.AddInParameter(commandWrapper, "@PinCode", DbType.String, entity.PinCode );
			
			int results = 0;
			
			//Provider Data Requesting Command Event
			OnDataRequesting(new CommandEventArgs(commandWrapper, "Insert", entity));
				
			if (transactionManager != null)
			{
				results = Utility.ExecuteNonQuery(transactionManager, commandWrapper);
			}
			else
			{
				results = Utility.ExecuteNonQuery(database,commandWrapper);
			}
					
			object _id = database.GetParameterValue(commandWrapper, "@Id");
			entity.Id = (System.Int32)_id;
			
			
			entity.AcceptChanges();
	
			//Provider Data Requested Command Event
			OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity));

			return Convert.ToBoolean(results);
		}	
        /// <summary>
        /// Initializes a new instance of the <see cref="T:ProdMedicineForItem"/> class.
        /// </summary>
		public ProdMedicineForItem(HearbalKartDB.Entities.ProdMedicineFor entity)
			: base()
		{
			_entity = entity;
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="T:ProdTableItem"/> class.
        /// </summary>
		public ProdTableItem(HearbalKartDB.Entities.ProdTable entity)
			: base()
		{
			_entity = entity;
		}
Beispiel #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:OrdersItem"/> class.
        /// </summary>
		public OrdersItem(HearbalKartDB.Entities.Orders entity)
			: base()
		{
			_entity = entity;
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="T:ProdCompanyItem"/> class.
        /// </summary>
		public ProdCompanyItem(HearbalKartDB.Entities.ProdCompany entity)
			: base()
		{
			_entity = entity;
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="T:CustomerBillingItem"/> class.
        /// </summary>
		public CustomerBillingItem(HearbalKartDB.Entities.CustomerBilling entity)
			: base()
		{
			_entity = entity;
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="T:UserTypeItem"/> class.
        /// </summary>
		public UserTypeItem(HearbalKartDB.Entities.UserType entity)
			: base()
		{
			_entity = entity;
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="T:DeliveredDaysItem"/> class.
        /// </summary>
		public DeliveredDaysItem(HearbalKartDB.Entities.DeliveredDays entity)
			: base()
		{
			_entity = entity;
		}
Beispiel #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:GenderItem"/> class.
        /// </summary>
		public GenderItem(HearbalKartDB.Entities.Gender entity)
			: base()
		{
			_entity = entity;
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="T:DistributarsItem"/> class.
        /// </summary>
		public DistributarsItem(HearbalKartDB.Entities.Distributars entity)
			: base()
		{
			_entity = entity;
		}
		/// <summary>
		/// 	Inserts a HearbalKartDB.Entities.ProdTable object into the datasource using a transaction.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">HearbalKartDB.Entities.ProdTable object to insert.</param>
		/// <remarks>
		///		After inserting into the datasource, the HearbalKartDB.Entities.ProdTable object will be updated
		/// 	to refelect any changes made by the datasource. (ie: identity or computed columns)
		/// </remarks>	
		/// <returns>Returns true if operation is successful.</returns>
        /// <exception cref="System.Exception">The command could not be executed.</exception>
        /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception>
        /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception>
		public override bool Insert(TransactionManager transactionManager, HearbalKartDB.Entities.ProdTable entity)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);
			DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.ProdTable_Insert", _useStoredProcedure);
			
			database.AddOutParameter(commandWrapper, "@Id", DbType.Int32, 4);
			database.AddInParameter(commandWrapper, "@ItemId", DbType.Int32, (entity.ItemId.HasValue ? (object) entity.ItemId  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@CategoryId", DbType.Int32, (entity.CategoryId.HasValue ? (object) entity.CategoryId  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@CompanyId", DbType.Int32, (entity.CompanyId.HasValue ? (object) entity.CompanyId  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@TypeId", DbType.Int32, (entity.TypeId.HasValue ? (object) entity.TypeId  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@SupplementId", DbType.Int32, (entity.SupplementId.HasValue ? (object) entity.SupplementId  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@MedicineForId", DbType.Int32, (entity.MedicineForId.HasValue ? (object) entity.MedicineForId  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@PurchaseId", DbType.Int32, (entity.PurchaseId.HasValue ? (object) entity.PurchaseId  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@SellId", DbType.Int32, (entity.SellId.HasValue ? (object) entity.SellId  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@OfferId", DbType.Int32, (entity.OfferId.HasValue ? (object) entity.OfferId  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@IsActive", DbType.Boolean, (entity.IsActive.HasValue ? (object) entity.IsActive  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@CreatedDate", DbType.DateTime, (entity.CreatedDate.HasValue ? (object) entity.CreatedDate  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@ModifiedDate", DbType.DateTime, (entity.ModifiedDate.HasValue ? (object) entity.ModifiedDate  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@DeletedDate", DbType.DateTime, (entity.DeletedDate.HasValue ? (object) entity.DeletedDate  : System.DBNull.Value));
            database.AddInParameter(commandWrapper, "@ImageUrl", DbType.String, entity.ImageUrl );
			
			int results = 0;
			
			//Provider Data Requesting Command Event
			OnDataRequesting(new CommandEventArgs(commandWrapper, "Insert", entity));
				
			if (transactionManager != null)
			{
				results = Utility.ExecuteNonQuery(transactionManager, commandWrapper);
			}
			else
			{
				results = Utility.ExecuteNonQuery(database,commandWrapper);
			}
					
			object _id = database.GetParameterValue(commandWrapper, "@Id");
			entity.Id = (System.Int32)_id;
			
			
			entity.AcceptChanges();
	
			//Provider Data Requested Command Event
			OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity));

			return Convert.ToBoolean(results);
		}	
        /// <summary>
        /// Initializes a new instance of the <see cref="T:ProdCategoryItem"/> class.
        /// </summary>
		public ProdCategoryItem(HearbalKartDB.Entities.ProdCategory entity)
			: base()
		{
			_entity = entity;
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="T:ItemPurchaseItem"/> class.
        /// </summary>
		public ItemPurchaseItem(HearbalKartDB.Entities.ItemPurchase entity)
			: base()
		{
			_entity = entity;
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="T:ItemSellItem"/> class.
        /// </summary>
		public ItemSellItem(HearbalKartDB.Entities.ItemSell entity)
			: base()
		{
			_entity = entity;
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="T:CountriesItem"/> class.
        /// </summary>
		public CountriesItem(HearbalKartDB.Entities.Countries entity)
			: base()
		{
			_entity = entity;
		}
Beispiel #18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:StatesItem"/> class.
        /// </summary>
		public StatesItem(HearbalKartDB.Entities.States entity)
			: base()
		{
			_entity = entity;
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="T:CustomersItem"/> class.
        /// </summary>
		public CustomersItem(HearbalKartDB.Entities.Customers entity)
			: base()
		{
			_entity = entity;
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="T:ProdSupplymentTypeItem"/> class.
        /// </summary>
		public ProdSupplymentTypeItem(HearbalKartDB.Entities.ProdSupplymentType entity)
			: base()
		{
			_entity = entity;
		}