示例#1
0
        public int Update(Spartane.Core.Classes.Spartan_BR_Operator_Type.Spartan_BR_Operator_Type entity)
        {
            int rta;

            try
            {
                var paramUpdOperatorTypeId = _dataProvider.GetParameter();
                paramUpdOperatorTypeId.ParameterName = "OperatorTypeId";
                paramUpdOperatorTypeId.DbType        = DbType.Int32;
                paramUpdOperatorTypeId.Value         = entity.OperatorTypeId;
                var paramUpdDescription = _dataProvider.GetParameter();
                paramUpdDescription.ParameterName = "Description";
                paramUpdDescription.DbType        = DbType.String;
                paramUpdDescription.Value         = entity.Description;
                var paramUpdPresentation_Control_Type = _dataProvider.GetParameter();
                paramUpdPresentation_Control_Type.ParameterName = "Presentation_Control_Type";
                paramUpdPresentation_Control_Type.DbType        = DbType.Int32;
                if (entity.Presentation_Control_Type == null)
                {
                    paramUpdPresentation_Control_Type.Value = DBNull.Value;
                }
                else
                {
                    paramUpdPresentation_Control_Type.Value = entity.Presentation_Control_Type;
                }

                var paramUpdQuery_for_Fill_Condition = _dataProvider.GetParameter();
                paramUpdQuery_for_Fill_Condition.ParameterName = "Query_for_Fill_Condition";
                paramUpdQuery_for_Fill_Condition.DbType        = DbType.String;
                paramUpdQuery_for_Fill_Condition.Value         = entity.Query_for_Fill_Condition;
                var paramUpdCode_for_Fill_Condition = _dataProvider.GetParameter();
                paramUpdCode_for_Fill_Condition.ParameterName = "Code_for_Fill_Condition";
                paramUpdCode_for_Fill_Condition.DbType        = DbType.String;
                paramUpdCode_for_Fill_Condition.Value         = entity.Code_for_Fill_Condition;
                var paramUpdImplementation_Code = _dataProvider.GetParameter();
                paramUpdImplementation_Code.ParameterName = "Implementation_Code";
                paramUpdImplementation_Code.DbType        = DbType.String;
                paramUpdImplementation_Code.Value         = entity.Implementation_Code;


                var empEntity =
                    _dbContext.ExecuteStoredProcedureList <Spartane.Core.Classes.StoredProcedure.sp_UpdSpartan_BR_Operator_Type>("sp_UpdSpartan_BR_Operator_Type", paramUpdOperatorTypeId, paramUpdDescription, paramUpdPresentation_Control_Type, paramUpdQuery_for_Fill_Condition, paramUpdCode_for_Fill_Condition, paramUpdImplementation_Code).FirstOrDefault();

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

            return(rta);
        }
示例#2
0
        public int Insert(Spartane.Core.Classes.Spartan_BR_Operator_Type.Spartan_BR_Operator_Type entity)
        {
            int rta;

            try
            {
                var padreDescription = _dataProvider.GetParameter();
                padreDescription.ParameterName = "Description";
                padreDescription.DbType        = DbType.String;
                padreDescription.Value         = (object)entity.Description ?? DBNull.Value;
                var padrePresentation_Control_Type = _dataProvider.GetParameter();
                padrePresentation_Control_Type.ParameterName = "Presentation_Control_Type";
                padrePresentation_Control_Type.DbType        = DbType.Int32;
                padrePresentation_Control_Type.Value         = (object)entity.Presentation_Control_Type ?? DBNull.Value;

                var padreQuery_for_Fill_Condition = _dataProvider.GetParameter();
                padreQuery_for_Fill_Condition.ParameterName = "Query_for_Fill_Condition";
                padreQuery_for_Fill_Condition.DbType        = DbType.String;
                padreQuery_for_Fill_Condition.Value         = (object)entity.Query_for_Fill_Condition ?? DBNull.Value;
                var padreCode_for_Fill_Condition = _dataProvider.GetParameter();
                padreCode_for_Fill_Condition.ParameterName = "Code_for_Fill_Condition";
                padreCode_for_Fill_Condition.DbType        = DbType.String;
                padreCode_for_Fill_Condition.Value         = (object)entity.Code_for_Fill_Condition ?? DBNull.Value;
                var padreImplementation_Code = _dataProvider.GetParameter();
                padreImplementation_Code.ParameterName = "Implementation_Code";
                padreImplementation_Code.DbType        = DbType.String;
                padreImplementation_Code.Value         = (object)entity.Implementation_Code ?? DBNull.Value;


                var empEntity =
                    _dbContext.ExecuteStoredProcedureList <Spartane.Core.Classes.StoredProcedure.sp_InsSpartan_BR_Operator_Type>("sp_InsSpartan_BR_Operator_Type", padreDescription
                                                                                                                                 , padrePresentation_Control_Type
                                                                                                                                 , padreQuery_for_Fill_Condition
                                                                                                                                 , padreCode_for_Fill_Condition
                                                                                                                                 , padreImplementation_Code
                                                                                                                                 ).FirstOrDefault();

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

            return(rta);
        }