/// <summary> /// Runs the Interface-OUT stored-procedure /// </summary> public void RunInterfaceOut() { DBParameterList dbParam; using (DataTaskManager dtManager = new DataTaskManager()) { dbParam = new DBParameterList(); dtManager.ExecuteNonQuery(CON_USP_INTERFACEOUT, dbParam); } }
/// <summary> /// This method is implemented to insert/update user and its details like associated /// locations and roles. /// </summary> /// <param name="xmlDoc">XML file containing values of db parameters.</param> /// <param name="spName">Name of stored procedure to invoke.</param> /// <param name="errorMessage">Error message (if any) returned from stored procedure.</param> /// <returns>true/false</returns> public bool UserSave(string xmlDoc, string spName, ref string errorMessage) { bool isSuccess = false; try { using (DataTaskManager dtManager = new DataTaskManager()) { //Declare and initialize the parameter list object DBParameterList dbParam = new DBParameterList(); //Add the relevant 2 parameters dbParam.Add(new DBParameter(Common.PARAM_DATA, xmlDoc, DbType.String)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); try { //Begin the transaction and executing procedure to save the record(s) dtManager.BeginTransaction(); // executing procedure to save the record dtManager.ExecuteNonQuery(spName, dbParam); //Update database message errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); //If an error returned from the database if (errorMessage.Length > 0) { dtManager.RollbackTransaction(); isSuccess = false; } else { dtManager.CommitTransaction(); isSuccess = true; } } catch (Exception ex) { dtManager.RollbackTransaction(); throw ex; } } } catch (Exception ex) { throw ex; } return(isSuccess); }