public static bool ChangeUserJobApplicantStatus(int JobApplicantID, PIKCV.COM.EnumDB.JobApplicationStates JobApplicantStates) { PIKCV.DAO.TransactionMgr Tran = PIKCV.DAO.TransactionMgr.ThreadTransactionMgr(); try { PIKCV.DAL.JobApplicants objStatus = new PIKCV.DAL.JobApplicants(); PIKCV.DAL.JobApplicationStatusChanges objStatusChanges = new PIKCV.DAL.JobApplicationStatusChanges(); Tran.BeginTransaction(); objStatus.LoadByPrimaryKey(JobApplicantID); objStatus.ApplicationStatusID = (int)JobApplicantStates; objStatus.Save(); objStatusChanges.AddNew(); objStatusChanges.JobApplicantID = JobApplicantID; objStatusChanges.ApplicationDate = DateTime.Now; objStatusChanges.ApplicationStatusID = (int)JobApplicantStates; objStatusChanges.ApplicationTitle = PIKCV.COM.Util.ReturnEmptyString(""); objStatusChanges.Save(); Tran.CommitTransaction(); return(true); } catch (Exception) { Tran.RollbackTransaction(); PIKCV.DAO.TransactionMgr.ThreadTransactionMgrReset(); return(false); } }
public static bool JobToApply(int UserID, int JobID) { PIKCV.DAO.TransactionMgr Tran = PIKCV.DAO.TransactionMgr.ThreadTransactionMgr(); PIKCV.DAL.JobApplicants obj; PIKCV.DAL.JobApplicationStatusChanges objLog = new PIKCV.DAL.JobApplicationStatusChanges(); try { obj = new PIKCV.DAL.JobApplicants(); objLog = new PIKCV.DAL.JobApplicationStatusChanges(); Tran.BeginTransaction(); obj.Where.UserID.Value = UserID; obj.Where.JobID.Value = JobID; obj.Query.Load(); if (obj.RowCount < 1) { obj.AddNew(); } obj.ApplicationDate = DateTime.Now; obj.UserID = UserID; obj.ApplicationStatusID = (int)PIKCV.COM.EnumDB.JobApplicationStates.NotExaminet; obj.JobID = JobID; obj.Save(); int m_Identity = obj.JobApplicantID; objLog.AddNew(); objLog.ApplicationDate = DateTime.Now; objLog.ApplicationStatusID = (int)PIKCV.COM.EnumDB.JobApplicationStates.NotExaminet; objLog.ApplicationTitle = " "; objLog.JobApplicantID = m_Identity; objLog.Save(); Tran.CommitTransaction(); return(true); } catch (Exception) { Tran.RollbackTransaction(); PIKCV.DAO.TransactionMgr.ThreadTransactionMgrReset(); return(false); } }