// Edit Employer public void DeleteEmployerRecord(crm_EmployerRepo empRepo) { try { //Get Connection AppSettings app = new AppSettings(); con = app.GetConnection(); DynamicParameters param = new DynamicParameters(); param.Add(name: "p_Employer_Id", value: empRepo.Employer_Id, dbType: DbType.String, direction: ParameterDirection.Input); con.Execute("DEL_CRM_EMPLOYER", param, commandType: CommandType.StoredProcedure); } catch (Exception ex) { throw ex; } finally { if (con.State == ConnectionState.Open) { con.Close(); if (con != null) { con = null; } } } }
// Edit Employer public void UpdateRecord(crm_EmployerRepo empRepo) { try { //Get Connection AppSettings app = new AppSettings(); con = app.GetConnection(); DynamicParameters param = new DynamicParameters(); param.Add(name: "p_Employer_Id", value: empRepo.Employer_Id, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Employer_Name", value: empRepo.Employer_Name, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Tin", value: empRepo.Tin_No, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Ssnit", value: empRepo.Ssnit, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Npra_Number", value: empRepo.Npra_Number, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Business_Address", value: empRepo.Business_Address, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Postal_Address", value: empRepo.Employer_Postal_Address, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Phone_Number", value: empRepo.Phone_Number, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Email_Address", value: empRepo.Employer_Email_Address, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Web_Site", value: empRepo.Web_Site, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Registration_Number", value: empRepo.Registration_Number, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Registration_Date", value: empRepo.Registration_Date, dbType: DbType.Date, direction: ParameterDirection.Input); param.Add(name: "p_Contact_Number", value: empRepo.Contact_Number, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Contact_Email", value: empRepo.Contact_Email, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Contact_Person", value: empRepo.Contact_Person, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Other_Number", value: empRepo.Employer_Other_Number, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Region_Id", value: empRepo.Region_Id, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_District_Id", value: empRepo.District_Id, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Office_Location", value: empRepo.Office_Location, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Sector_Id", value: empRepo.Sector_Id, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Employer_Status", value: empRepo.Employer_Status, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_MAKER_ID", value: empRepo.Maker_Id, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Auth_Status", value: empRepo.Auth_Status, dbType: DbType.String, direction: ParameterDirection.Input); con.Execute("UPD_CRM_EMPLOYER", param, commandType: CommandType.StoredProcedure); } catch (Exception ex) { throw ex; } finally { if (con.State == ConnectionState.Open) { con.Close(); if (con != null) { con = null; } } } }
public bool DisapprovedEditedRecord(crm_EmployerRepo EmployerRepo) { try { //Get connection var app = new AppSettings(); con = app.GetConnection(); var param = new DynamicParameters(); //Input Param param.Add(name: "p_Employer_Id", value: Employer_Id, dbType: DbType.String, direction: ParameterDirection.Input); int result = con.Execute(sql: "DEL_CRM_EMPLOYER_TEMP", param: param, commandType: CommandType.StoredProcedure); if (result < 0) { return(true); } else { return(false); } } catch (Exception ex) { throw ex; } finally { if (con.State == ConnectionState.Open) { con.Close(); if (con != null) { con = null; } } } }
//Add Employer public void SaveRecord(crm_EmployerRepo empRepo) { var app = new AppSettings(); TransactionOptions tsOp = new TransactionOptions(); tsOp.IsolationLevel = System.Transactions.IsolationLevel.Snapshot; TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew, tsOp); tsOp.Timeout = TimeSpan.FromMinutes(20); using (OracleConnection con = new OracleConnection(app.conString())) // { try { //Get Connection //AppSettings app = new AppSettings(); //con = app.GetConnection(); DynamicParameters param = new DynamicParameters(); param.Add(name: "p_Employer_Id", value: empRepo.Employer_Id, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Employer_Name", value: empRepo.Employer_Name, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Tin", value: empRepo.Tin_No, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Ssnit", value: empRepo.Ssnit, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Npra_Number", value: empRepo.Npra_Number, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Business_Address", value: empRepo.Business_Address, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Postal_Address", value: empRepo.Employer_Postal_Address, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Phone_Number", value: empRepo.Phone_Number, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Email_Address", value: empRepo.Employer_Email_Address, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Web_Site", value: empRepo.Web_Site, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Registration_Number", value: empRepo.Registration_Number, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Registration_Date", value: empRepo.Registration_Date, dbType: DbType.Date, direction: ParameterDirection.Input); param.Add(name: "p_Contact_Number", value: empRepo.Contact_Number, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Contact_Email", value: empRepo.Contact_Email, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Contact_Person", value: empRepo.Contact_Person, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Other_Number", value: empRepo.Employer_Other_Number, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Region_Id", value: empRepo.Region_Id, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_District_Id", value: empRepo.District_Id, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Office_Location", value: empRepo.Office_Location, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Sector_Id", value: empRepo.Sector_Id, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Employer_Status", value: empRepo.Employer_Status, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_MAKER_ID", value: empRepo.Maker_Id, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_Auth_Status", value: empRepo.Auth_Status, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "P_NEW_EMPLOYEE_ID", value: String.Empty, dbType: DbType.String, direction: ParameterDirection.Output); con.Execute("ADD_CRM_EMPLOYER", param, commandType: CommandType.StoredProcedure); var newemployerid = param.Get <string>("P_NEW_EMPLOYEE_ID"); DynamicParameters paramb = new DynamicParameters(); paramb.Add(name: "P_ES_ID", value: newemployerid + empRepo.Scheme_Id, dbType: DbType.String, direction: ParameterDirection.Input); paramb.Add(name: "P_SCHEME_ID", value: empRepo.Scheme_Id, dbType: DbType.String, direction: ParameterDirection.Input); paramb.Add(name: "P_EMPLOYER_ID", value: newemployerid, dbType: DbType.String, direction: ParameterDirection.Input); paramb.Add(name: "P_MAKER_ID", value: empRepo.Maker_Id, dbType: DbType.String, direction: ParameterDirection.Input); con.Execute("MIX_REMIT_EMPLOYER_SCHEME", paramb, commandType: CommandType.StoredProcedure); ts.Complete(); } catch (Exception ex) { throw ex; } finally { ts.Dispose(); if (con.State == ConnectionState.Open) { con.Close(); } } } }