Exemplo n.º 1
0
        public OpertionResult Edit(PartnerActivity partnerActivity)
        {
            try
            {
                #region Parameters
                var parameters = new List <OracleParameter> {
                    new OracleParameter {
                        ParameterName = "retVal", OracleDbType = OracleDbType.Int32, Direction = ParameterDirection.ReturnValue
                    },
                    new OracleParameter {
                        ParameterName = "v_row_id", OracleDbType = OracleDbType.Int32, Value = partnerActivity.Id
                    },
                    new OracleParameter {
                        ParameterName = "v_act_id", OracleDbType = OracleDbType.Varchar2, Value = partnerActivity.Activity.Id
                    },
                    new OracleParameter {
                        ParameterName = "v_fromroleid", OracleDbType = OracleDbType.Int32, Value = partnerActivity.FromRole.Id
                    },
                    new OracleParameter {
                        ParameterName = "v_queryduration", OracleDbType = OracleDbType.Varchar2, Value = partnerActivity.MaxQueryDuration.Id
                    },
                    new OracleParameter {
                        ParameterName = "v_act_scope", OracleDbType = OracleDbType.Varchar2, Value = partnerActivity.Scope.Id
                    },
                    new OracleParameter {
                        ParameterName = "v_maxrec", OracleDbType = OracleDbType.Int32, Value = partnerActivity.MaxQueryRows
                    },
                    new OracleParameter {
                        ParameterName = "v_onlypartchildren", OracleDbType = OracleDbType.Int32, Value = partnerActivity.OnlyPartnerChildren ? 1 : 0
                    }
                };
                #endregion
                db.ExecuteFunction("pk_settings.fn_updatepartneractivity", parameters);
                var result = int.Parse(parameters.Find(x => x.ParameterName == "retVal").Value.ToString());

                if (result > 0)
                {
                    return(new OpertionResult {
                        AffectedCount = result, Success = true, Error = string.Empty
                    });
                }
                else
                {
                    return(new OpertionResult {
                        AffectedCount = result, Success = false, Error = string.Empty
                    });
                }
            }
            catch (Exception ex)
            {
                return(new OpertionResult {
                    AffectedCount = -1, Success = false, Error = ex.Message
                });
            }
        }