public virtual SalesPrompt UpdateSalesPrompt(SalesPrompt entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            SalesPrompt other = GetSalesPrompt(entity.SalesPromptId);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update SalesPrompt set  [SalesPromptGUID]=@SalesPromptGUID
							, [Name]=@Name
							, [ExtensionData]=@ExtensionData
							, [Deleted]=@Deleted
							, [CreatedOn]=@CreatedOn 
							 where SalesPromptID=@SalesPromptID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@SalesPromptID", entity.SalesPromptId)
                , new SqlParameter("@SalesPromptGUID", entity.SalesPromptGuid)
                , new SqlParameter("@Name", entity.Name)
                , new SqlParameter("@ExtensionData", entity.ExtensionData ?? (object)DBNull.Value)
                , new SqlParameter("@Deleted", entity.Deleted)
                , new SqlParameter("@CreatedOn", entity.CreatedOn)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetSalesPrompt(entity.SalesPromptId));
        }
        public virtual SalesPrompt SalesPromptFromDataRow(DataRow dr)
        {
            if (dr == null)
            {
                return(null);
            }
            SalesPrompt entity = new SalesPrompt();

            entity.SalesPromptId   = (System.Int32)dr["SalesPromptID"];
            entity.SalesPromptGuid = (System.Guid)dr["SalesPromptGUID"];
            entity.Name            = dr["Name"].ToString();
            entity.ExtensionData   = dr["ExtensionData"].ToString();
            entity.Deleted         = (System.Byte)dr["Deleted"];
            entity.CreatedOn       = (System.DateTime)dr["CreatedOn"];
            return(entity);
        }
        public virtual SalesPrompt InsertSalesPrompt(SalesPrompt entity)
        {
            SalesPrompt other = new SalesPrompt();

            other = entity;
            if (entity.IsTransient())
            {
                string         sql            = @"Insert into SalesPrompt ( [SalesPromptGUID]
				,[Name]
				,[ExtensionData]
				,[Deleted]
				,[CreatedOn] )
				Values
				( @SalesPromptGUID
				, @Name
				, @ExtensionData
				, @Deleted
				, @CreatedOn );
				Select scope_identity()"                ;
                SqlParameter[] parameterArray = new SqlParameter[] {
                    new SqlParameter("@SalesPromptID", entity.SalesPromptId)
                    , new SqlParameter("@SalesPromptGUID", entity.SalesPromptGuid)
                    , new SqlParameter("@Name", entity.Name)
                    , new SqlParameter("@ExtensionData", entity.ExtensionData ?? (object)DBNull.Value)
                    , new SqlParameter("@Deleted", entity.Deleted)
                    , new SqlParameter("@CreatedOn", entity.CreatedOn)
                };
                var identity = SqlHelper.ExecuteScalar(this.ConnectionString, CommandType.Text, sql, parameterArray);
                if (identity == DBNull.Value)
                {
                    throw new DataException("Identity column was null as a result of the insert operation.");
                }
                return(GetSalesPrompt(Convert.ToInt32(identity)));
            }
            return(entity);
        }
Ejemplo n.º 4
0
 public SalesPrompt InsertSalesPrompt(SalesPrompt entity)
 {
     return(_iSalesPromptRepository.InsertSalesPrompt(entity));
 }
Ejemplo n.º 5
0
 public SalesPrompt UpdateSalesPrompt(SalesPrompt entity)
 {
     return(_iSalesPromptRepository.UpdateSalesPrompt(entity));
 }
 public virtual SalesPrompt DeleteSalesPrompt(SalesPrompt entity)
 {
     this.DeleteSalesPrompt(entity.SalesPromptId);
     return(entity);
 }