Exemplo n.º 1
0
        public object UpdateHcOffersInfo(object param)
        {
            Database db     = DatabaseFactory.CreateDatabase();
            object   retObj = null;

            using (DbConnection connection = db.CreateConnection())
            {
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();
                try
                {
                    HcOffersEntity hcOffersEntity = (HcOffersEntity)param;
                    HcOffersDAL    hcOffersDAL    = new HcOffersDAL();
                    retObj = (object)hcOffersDAL.UpdateHcOffersInfo(hcOffersEntity, db, transaction);
                    transaction.Commit();
                }
                catch
                {
                    transaction.Rollback();
                    throw;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(retObj);
        }
Exemplo n.º 2
0
        public HcOffersEntity GetSingleHcOffersRecordById(object param)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            string    sql       = "SELECT Id, OfferTitle, OfferOn, OfferProduct, isActive, CreatedBy, CreatedDate, UpdateBy, UpdateDate FROM HC_Offers WHERE Id=@Id";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Id", DbType.String, param);
            HcOffersEntity hcOffersEntity = null;

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    hcOffersEntity = new HcOffersEntity();
                    if (dataReader["Id"] != DBNull.Value)
                    {
                        hcOffersEntity.Id = dataReader["Id"].ToString();
                    }
                    if (dataReader["OfferTitle"] != DBNull.Value)
                    {
                        hcOffersEntity.Offertitle = dataReader["OfferTitle"].ToString();
                    }
                    if (dataReader["OfferOn"] != DBNull.Value)
                    {
                        hcOffersEntity.Offeron = dataReader["OfferOn"].ToString();
                    }
                    if (dataReader["OfferProduct"] != DBNull.Value)
                    {
                        hcOffersEntity.Offerproduct = dataReader["OfferProduct"].ToString();
                    }
                    if (dataReader["isActive"] != DBNull.Value)
                    {
                        hcOffersEntity.Isactive = dataReader["isActive"].ToString();
                    }
                    if (dataReader["CreatedBy"] != DBNull.Value)
                    {
                        hcOffersEntity.Createdby = dataReader["CreatedBy"].ToString();
                    }
                    if (dataReader["CreatedDate"] != DBNull.Value)
                    {
                        hcOffersEntity.Createddate = dataReader["CreatedDate"].ToString();
                    }
                    if (dataReader["UpdateBy"] != DBNull.Value)
                    {
                        hcOffersEntity.Updateby = dataReader["UpdateBy"].ToString();
                    }
                    if (dataReader["UpdateDate"] != DBNull.Value)
                    {
                        hcOffersEntity.Updatedate = dataReader["UpdateDate"].ToString();
                    }
                }
            }
            return(hcOffersEntity);
        }
Exemplo n.º 3
0
        public bool UpdateHcOffersInfo(HcOffersEntity hcOffersEntity, Database db, DbTransaction transaction)
        {
            string    sql       = "UPDATE HC_Offers SET OfferTitle= @Offertitle, OfferOn= @Offeron, OfferProduct= @Offerproduct, isActive= @Isactive, CreatedBy= @Createdby, CreatedDate= @Createddate, UpdateBy= @Updateby, UpdateDate= @Updatedate WHERE Id=@Id";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Id", DbType.String, hcOffersEntity.Id);
            db.AddInParameter(dbCommand, "Offertitle", DbType.String, hcOffersEntity.Offertitle);
            db.AddInParameter(dbCommand, "Offeron", DbType.String, hcOffersEntity.Offeron);
            db.AddInParameter(dbCommand, "Offerproduct", DbType.String, hcOffersEntity.Offerproduct);
            db.AddInParameter(dbCommand, "Isactive", DbType.String, hcOffersEntity.Isactive);
            db.AddInParameter(dbCommand, "Createdby", DbType.String, hcOffersEntity.Createdby);
            db.AddInParameter(dbCommand, "Createddate", DbType.String, hcOffersEntity.Createddate);
            db.AddInParameter(dbCommand, "Updateby", DbType.String, hcOffersEntity.Updateby);
            db.AddInParameter(dbCommand, "Updatedate", DbType.String, hcOffersEntity.Updatedate);

            db.ExecuteNonQuery(dbCommand, transaction);
            return(true);
        }
Exemplo n.º 4
0
        public bool SaveHcOffersInfo(HcOffersEntity hcOffersEntity, Database db, DbTransaction transaction)
        {
            string    sql       = "INSERT INTO HC_Offers ( Id, OfferTitle, OfferOn, OfferProduct, isActive, CreatedBy, CreatedDate, UpdateBy, UpdateDate) VALUES (  @Id,  @Offertitle,  @Offeron,  @Offerproduct,  @Isactive,  @Createdby,  @Createddate,  @Updateby,  @Updatedate )";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Id", DbType.String, hcOffersEntity.Id);
            db.AddInParameter(dbCommand, "Offertitle", DbType.String, hcOffersEntity.Offertitle);
            db.AddInParameter(dbCommand, "Offeron", DbType.String, hcOffersEntity.Offeron);
            db.AddInParameter(dbCommand, "Offerproduct", DbType.String, hcOffersEntity.Offerproduct);
            db.AddInParameter(dbCommand, "Isactive", DbType.String, hcOffersEntity.Isactive);
            db.AddInParameter(dbCommand, "Createdby", DbType.String, hcOffersEntity.Createdby);
            db.AddInParameter(dbCommand, "Createddate", DbType.String, hcOffersEntity.Createddate);
            db.AddInParameter(dbCommand, "Updateby", DbType.String, hcOffersEntity.Updateby);
            db.AddInParameter(dbCommand, "Updatedate", DbType.String, hcOffersEntity.Updatedate);

            db.ExecuteNonQuery(dbCommand, transaction);
            return(true);
        }