public virtual bool DeleteModelByModel(User.UserModel user, TBase_Model model, ref string strError) { try { int bResult = 0; int iOut = 0; OracleParameter[] param = new OracleParameter[] { new OracleParameter("@bResult", bResult), new OracleParameter("@ErrorMsg", OracleDbType.NVarchar2, 100), new OracleParameter("@ID", OracleDBHelper.ToDBValue(model.ID)), new OracleParameter("@Deleter", OracleDBHelper.ToDBValue(user.UserNo)) }; param[0].Direction = System.Data.ParameterDirection.Output; param[1].Direction = System.Data.ParameterDirection.Output; int i = OracleDBHelper.RunProcedure(this.GetDeleteProcedureName(), param, out iOut); strError = param[1].Value.ToString(); if (i == -1)//(int)param[0].Value == -1 { return(false); } else { return(true); } } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 修改状态 /// </summary> /// <param name="user"></param> /// <param name="model"></param> /// <param name="NewStatus"></param> /// <param name="strError"></param> /// <returns></returns> public bool UpdateModelStatus(User.UserModel user, ref TBase_Model model, int NewStatus, ref string strError, bool NeedReturnModel) { try { int iRows = 0; int iOut = 0; OracleParameter[] param = new OracleParameter[] { new OracleParameter("@Rows", iRows), new OracleParameter("@ErrorMsg", OracleDbType.NVarchar2, 100), new OracleParameter("@ID", OracleDBHelper.ToDBValue(GetUpdateModelStatusID(user, model, NewStatus))), new OracleParameter("@NewStatus", OracleDBHelper.ToDBValue(NewStatus)), new OracleParameter("@Auditor", OracleDBHelper.ToDBValue(user.UserNo)), new OracleParameter("@AuditorTime", OracleDBHelper.ToDBValue(DateTime.Now)), new OracleParameter("@TerminateReasonID", OracleDBHelper.ToDBValue(model.TerminateReasonID)), new OracleParameter("@TerminateReason", OracleDBHelper.ToDBValue(model.TerminateReason)), new OracleParameter("@RowVersion", OracleDBHelper.ToDBValue(DateTime.Now)) }; param[0].Direction = System.Data.ParameterDirection.Output; param[1].Direction = System.Data.ParameterDirection.Output; int i = OracleDBHelper.RunProcedure(this.GetUpdateStatusProcedureName(), param, out iOut); strError = param[1].Value.ToString(); if ((int)param[0].Value == -1) { return(false); } else { if (NeedReturnModel) { model = GetModelByID(model.ID); if (model == null) { throw new Exception("GetModelByID(modelID)出错,没有找到相符的记录,可能是视图有错误!"); } } return(true); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public static int CheckRepeatValue(string TableName, string ColumnName, object Value, int ID, string IDColumnName = "ID") { try { if (Value == null) { return(0); } //if (string.IsNullOrEmpty(value.ToString())) return 0; int iOut = 0; string strError; int RepeatNum = 0; OracleParameter[] param = new OracleParameter[] { new OracleParameter("@ErrorMsg", OracleDbType.NVarchar2, 100), new OracleParameter("@RepeatNum", System.Data.SqlDbType.Int), new OracleParameter("@TableName", OracleDBHelper.ToDBValue(TableName)), new OracleParameter("@ColumnName", OracleDBHelper.ToDBValue(ColumnName)), new OracleParameter("@Value", OracleDBHelper.ToDBValue(Value)), new OracleParameter("@IDColumnName", OracleDBHelper.ToDBValue(IDColumnName)), new OracleParameter("@ID", OracleDBHelper.ToDBValue(ID)), }; param[0].Direction = System.Data.ParameterDirection.Output; param[1].Direction = System.Data.ParameterDirection.Output; int i = OracleDBHelper.RunProcedure("P_Check_RepeatValue", param, out iOut); strError = param[0].Value.ToString(); RepeatNum = Convert.ToInt32(param[1].Value); return(RepeatNum); } catch (Exception ex) { throw new Exception(ex.Message); } }