public EntityProcesses GetRunningProcess(string EntityID, string EntityTypeID, string EntityVersionID) { try { DataSet ds = new DataSet(); DataAccessLayer.DatabaseInteraction objDataWrapper = new DataAccessLayer.DatabaseInteraction(CommandType.StoredProcedure); objDataWrapper.AddParameter("@EntityID", EntityID); objDataWrapper.AddParameter("@EntityVersionID", EntityVersionID); objDataWrapper.AddParameter("@EntityTypeID", EntityTypeID); string[] tbls = { "ProcessTable" }; ds = objDataWrapper.GetDataset("Proc_GetRunningProcess", tbls); if (ds.Tables[0].Rows.Count > 0) { return(new EntityProcesses { ProcessRowId = Int32.Parse(ds.Tables[0].Rows[0]["ProcessRowid"].ToString()), ProcessID = Int32.Parse(ds.Tables[0].Rows[0]["ProcessID"].ToString()), EntityID = ds.Tables[0].Rows[0]["EntityID"].ToString(), EntityTypeID = ds.Tables[0].Rows[0]["EntityTypeID"].ToString(), EntityVersionID = ds.Tables[0].Rows[0]["EntityVersionID"].ToString(), EntityNewVersionID = ds.Tables[0].Rows[0]["EntityNewVersionID"].ToString(), EntityPreviousStatus = ds.Tables[0].Rows[0]["EntityPreviousStatus"].ToString(), EntityCurrentStatus = ds.Tables[0].Rows[0]["EntityCurrentStatus"].ToString(), ProcessStatus = ds.Tables[0].Rows[0]["ProcessStatus"].ToString(), ProcessEffectiveDate = DateTime.Parse(ds.Tables[0].Rows[0]["ProcessEffectiveDate"].ToString()), SentTO = ds.Tables[0].Rows[0]["SentTo"].ToString(), Remarks = ds.Tables[0].Rows[0]["Remarks"].ToString(), Reason = ds.Tables[0].Rows[0]["Reason"].ToString(), FollowupIds = ds.Tables[0].Rows[0]["FollowUpId"].ToString(), }); } else { return(null); } } catch (Exception objExp) { throw (objExp); } }
public string SetEntityStatus(string EntityId, string EntityTypeID, string EntityStatus) { //try //{ // DataSet ds = new DataSet(); // DataAccessLayer.DatabaseInteraction objWrapper = new DataAccessLayer.DatabaseInteraction(CommandType.StoredProcedure); // //DataAccessLayer.DatabaseInteraction objDataWrapper = new DataAccessLayer.DatabaseInteraction(CommandType.Text); // // objDataWrapper.AddParameter("@EntityID", EntityID); // string[] tbls = { "EntityStatus" }; // ds = objDataWrapper.GetDataset("select IsActive from TM_ApprovalActivities where ActivityID='" + EntityID + "'", tbls); // if (ds.Tables[0].Rows.Count > 0) // { // return ds.Tables[0].Rows[0]["IsActive"].ToString(); // } // else // { // return null; // } //} //catch (Exception objExp) //{ // throw (objExp); //} string EntityStatusDesc = "", NewStatus = ""; string strStoredProc = "Proc_SetEntityStatus"; try { DataSet ds = new DataSet(); DataAccessLayer.DatabaseInteraction objWrapper = new DataAccessLayer.DatabaseInteraction(CommandType.StoredProcedure); objWrapper.ClearParameteres(); objWrapper.AddParameter("@EntityId", EntityId); objWrapper.AddParameter("@EntityTypeId", EntityTypeID); objWrapper.AddParameter("@EntityVerID", "1"); SqlParameter Param = (SqlParameter)objWrapper.AddParameter("@EntityStatusDesc", null, SqlDbType.VarChar, ParameterDirection.Output, 30); SqlParameter prmNewEntityStatus = (SqlParameter)objWrapper.AddParameter("@NewEntityStatus", null, SqlDbType.VarChar, ParameterDirection.Output, 30); objWrapper.AddParameter("@ProcessId", null); objWrapper.AddParameter("@EntityStatus", EntityStatus); string[] tbls = { "EntityTable" }; ds = objWrapper.GetDataset(strStoredProc, tbls); EntityStatusDesc = Param.Value.ToString(); NewStatus = prmNewEntityStatus.Value.ToString(); objWrapper.ClearParameteres(); return(null); } catch (Exception ex) { throw (ex); } return(null); }
public List <ProcessMaster> GetEntityEligibleProcess(string EntityID, string EntityVersionID, EntityType EntityTypeID, string EntityStatus, string CallerModule, int UserId) { string strStoredProc = "Proc_GetEntityEligibleProcess"; DataSet returnDS = null; DataAccessLayer.DatabaseInteraction objDataWrapper = new DataAccessLayer.DatabaseInteraction(CommandType.StoredProcedure); try { objDataWrapper.ClearParameteres(); objDataWrapper.AddParameter("@EntityID", EntityID); objDataWrapper.AddParameter("@EntityVersionID", EntityVersionID); objDataWrapper.AddParameter("@EntityTypeID", GetEnumString(EntityTypeID)); objDataWrapper.AddParameter("@EntityStatus", EntityStatus); objDataWrapper.AddParameter("@CallerModule", CallerModule); objDataWrapper.AddParameter("@LoginUserId", UserId); string [] arrTables = { "EntityProcesses" }; returnDS = objDataWrapper.GetDataset(strStoredProc, arrTables); objDataWrapper.ClearParameteres(); List <ProcessMaster> lstProcessM = (from p in returnDS.Tables[0].AsEnumerable() select new ProcessMaster() { ProcessId = int.Parse(p["ProcessId"].ToString()), ProcessCode = p["ProcessCode"].ToString(), ProcessDesc = p["ProcessDesc"].ToString(), ProcessShortName = p["ProcessShortName"].ToString(), EntityTypeID = p["EntityTypeID"].ToString(), ApplicableModule = p["ApplicableFolder"].ToString(), IsActive = p["IsActive"].ToString(), EntityStatus = p["EntityStatus"].ToString(), ApplicableToStatus = p["ApplicableToStatus"].ToString(), ApprovalLevel = int.Parse(p["ApprovalLevel"].ToString()) } ).ToList(); objDataWrapper = null; return(lstProcessM); } catch (Exception ex) { throw (ex); } }
/// <summary> /// Saves the information passed in model object to database. /// </summary> /// <param name="objProcessInfo">Model class object.</param> /// <returns>No of records effected.</returns> public DataTable AddProcessInformation(EntityProcesses objProcesses) { string strStoredProc = "Proc_InsertTM_EntityProcesses"; DateTime RecordDate = DateTime.Now; DataTable returnResult; //DataAccessLayer.DatabaseInteraction objWrapper = new DataAccessLayer.DatabaseInteraction(CommandType.StoredProcedure); try { objWrapper.ClearParameteres(); objWrapper.AddParameter("@EntityID", objProcesses.EntityID); objWrapper.AddParameter("@EntityTypeID", objProcesses.EntityTypeID); objWrapper.AddParameter("@EntityVersionID", objProcesses.EntityVersionID); objWrapper.AddParameter("@EntityNewVersionID", objProcesses.EntityNewVersionID); objWrapper.AddParameter("@EntityPreviousStatus", objProcesses.EntityPreviousStatus); objWrapper.AddParameter("@EntityCurrentStatus", objProcesses.EntityCurrentStatus); objWrapper.AddParameter("@ProcessID", objProcesses.ProcessID); objWrapper.AddParameter("@ProcessType", ""); objWrapper.AddParameter("@ProcessStatus", objProcesses.ProcessStatus); objWrapper.AddParameter("@ProcessEffectiveDate", objProcesses.ProcessEffectiveDate); objWrapper.AddParameter("@SentTo", objProcesses.SentTO); objWrapper.AddParameter("@Remarks", objProcesses.Remarks); objWrapper.AddParameter("@Reason", objProcesses.Reason); objWrapper.AddParameter("@FollowUpId", objProcesses.FollowupIds); objWrapper.AddParameter("@CreatedBy", objProcesses.CreatedBy); string[] tbls = { "ProcessTable" }; returnResult = objWrapper.GetDataset(strStoredProc, tbls).Tables[0]; if (returnResult.Rows[0]["ProcessRowId"] != null) { objProcesses.ProcessRowId = int.Parse(returnResult.Rows[0]["ProcessRowId"].ToString()); } objWrapper.ClearParameteres(); return(returnResult); } catch (Exception ex) { throw (ex); } }