Exemple #1
0
        public int Update(Spartane.Core.Classes.Spartan_BR_Attribute_Restrictions_Detail.Spartan_BR_Attribute_Restrictions_Detail entity)
        {
            int rta;

            try
            {
                var paramUpdRestrictionId = _dataProvider.GetParameter();
                paramUpdRestrictionId.ParameterName = "RestrictionId";
                paramUpdRestrictionId.DbType        = DbType.Int32;
                paramUpdRestrictionId.Value         = entity.RestrictionId;
                var paramUpdAction = _dataProvider.GetParameter();
                paramUpdAction.ParameterName = "Action";
                paramUpdAction.DbType        = DbType.Int32;
                paramUpdAction.Value         = entity.Action;
                var paramUpdAttribute_Type = _dataProvider.GetParameter();
                paramUpdAttribute_Type.ParameterName = "Attribute_Type";
                paramUpdAttribute_Type.DbType        = DbType.Int32;
                if (entity.Attribute_Type == null)
                {
                    paramUpdAttribute_Type.Value = DBNull.Value;
                }
                else
                {
                    paramUpdAttribute_Type.Value = entity.Attribute_Type;
                }

                var paramUpdControl_Type = _dataProvider.GetParameter();
                paramUpdControl_Type.ParameterName = "Control_Type";
                paramUpdControl_Type.DbType        = DbType.Int16;
                if (entity.Control_Type == null)
                {
                    paramUpdControl_Type.Value = DBNull.Value;
                }
                else
                {
                    paramUpdControl_Type.Value = entity.Control_Type;
                }



                var empEntity =
                    _dbContext.ExecuteStoredProcedureList <Spartane.Core.Classes.StoredProcedure.sp_UpdSpartan_BR_Attribute_Restrictions_Detail>("sp_UpdSpartan_BR_Attribute_Restrictions_Detail", paramUpdRestrictionId, paramUpdAction, paramUpdAttribute_Type, paramUpdControl_Type).FirstOrDefault();

                rta = Convert.ToInt32(empEntity.RestrictionId);
            }
            catch (ExceptionBase ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new ServiceException(ex.Message, ex);
            }

            return(rta);
        }
Exemple #2
0
        public int Insert(Spartane.Core.Classes.Spartan_BR_Attribute_Restrictions_Detail.Spartan_BR_Attribute_Restrictions_Detail entity)
        {
            int rta;

            try
            {
                var padreAction = _dataProvider.GetParameter();
                padreAction.ParameterName = "Action";
                padreAction.DbType        = DbType.Int32;
                padreAction.Value         = (object)entity.Action ?? DBNull.Value;
                var padreAttribute_Type = _dataProvider.GetParameter();
                padreAttribute_Type.ParameterName = "Attribute_Type";
                padreAttribute_Type.DbType        = DbType.Int32;
                padreAttribute_Type.Value         = (object)entity.Attribute_Type ?? DBNull.Value;

                var padreControl_Type = _dataProvider.GetParameter();
                padreControl_Type.ParameterName = "Control_Type";
                padreControl_Type.DbType        = DbType.Int16;
                padreControl_Type.Value         = (object)entity.Control_Type ?? DBNull.Value;



                var empEntity =
                    _dbContext.ExecuteStoredProcedureList <Spartane.Core.Classes.StoredProcedure.sp_InsSpartan_BR_Attribute_Restrictions_Detail>("sp_InsSpartan_BR_Attribute_Restrictions_Detail", padreAction
                                                                                                                                                 , padreAttribute_Type
                                                                                                                                                 , padreControl_Type
                                                                                                                                                 ).FirstOrDefault();

                rta = Convert.ToInt32(empEntity.RestrictionId);
            }
            catch (ExceptionBase ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new ServiceException(ex.Message, ex);
            }

            return(rta);
        }