public void GetAllSignPermits(string sfProjectID, int jobID, int userEmployeeID, enterprise.QueryResult result) { try { //create service client to call API endpoint using (enterprise.SoapClient queryClient = new enterprise.SoapClient("Soap", apiAddr)) { if (result == null || (result != null && result.size == 0)) { return; } //cast query results IEnumerable <enterprise.Sign_Permit__c> signPermitList = result.records.Cast <enterprise.Sign_Permit__c>(); foreach (var sp in signPermitList) { /* check if the sign permit exists */ int sign_permitID = CommonMethods.GetMISID(TableName.PermitForSignPermit, sp.Id, salesForceProjectID); if (sign_permitID == 0) { CreatePermit cpa = new CreatePermit(userEmployeeID, jobID, 10, 0); cpa.Create(); int id = cpa.NewlyInsertedID; if (id > 0) { CommonMethods.InsertToMISSalesForceMapping(TableName.PermitForSignPermit, sp.Id, id.ToString(), salesForceProjectID); } sign_permitID = id; } if (sign_permitID != 0) { HandleLandlord(sp.Id, sp.LandLord__r.BillingStreet, sp.LandLord__r.BillingCity, sp.LandLord__r.BillingState, sp.LandLord__r.BillingPostalCode, sp.LandLord_Contact__r.Name, sp.LandLord_Phone_Number__c, sp.LandLord__r.Name); UpdateSignPermit(sp.Id, sign_permitID, sp.Number_of_Signs__c, sp.Project_Value_Estimated__c, sp.Issue_Date__c, sp.Due_Date__c, sp.Remarks__c); } } LogMethods.Log.Debug("GetAllSignPermits:Debug:" + "Done"); } } catch (Exception e) { LogMethods.Log.Error("GetAllSignPermits:Error:" + e.Message); } }
public void GetAllStakeOutPermits(string sfProjectID, int jobID, int userEmployeeID, enterprise.QueryResult result) { try { //create service client to call API endpoint using (enterprise.SoapClient queryClient = new enterprise.SoapClient("Soap", apiAddr)) { if (result == null || (result != null && result.size == 0)) { return; } //cast query results IEnumerable <enterprise.StakeOut_Permit__c> stakeoutPermitList = result.records.Cast <enterprise.StakeOut_Permit__c>(); foreach (var sp in stakeoutPermitList) { int stakeout_permitID = CommonMethods.GetMISID(TableName.PermitForStakeout, sp.Id, salesForceProjectID); if (stakeout_permitID == 0) { CreatePermit cpa = new CreatePermit(userEmployeeID, jobID, 20, 0); cpa.Create(); int id = cpa.NewlyInsertedID; if (id > 0) { CommonMethods.InsertToMISSalesForceMapping(TableName.PermitForStakeout, sp.Id, id.ToString(), salesForceProjectID); } stakeout_permitID = id; } if (stakeout_permitID != 0) { UpdateStakeOutPermit(stakeout_permitID, sp.Stick_Position_Radius__c, sp.Dept_Of_Holes__c, sp.Issue_Date__c, sp.Due_Date__c, sp.Remarks__c); } } LogMethods.Log.Debug("GetAllStakeOutPermits:Debug:" + "Done"); } } catch (Exception e) { LogMethods.Log.Error("GetAllStakeOutPermits:Error:" + e.Message); } }
public void GetAllHoistingPermits(string sfProjectID, int jobID, int userEmployeeID, enterprise.QueryResult result) { try { //create service client to call API endpoint using (enterprise.SoapClient queryClient = new enterprise.SoapClient("Soap", apiAddr)) { if (result == null || (result != null && result.size == 0)) { return; } //cast query results IEnumerable <enterprise.Hoisting_Permit__c> hoistingPermitList = result.records.Cast <enterprise.Hoisting_Permit__c>(); foreach (var sp in hoistingPermitList) { int hoisting_permitID = CommonMethods.GetMISID(TableName.PermitForHoisting, sp.Id, salesForceProjectID); if (hoisting_permitID == 0) { CreatePermit cpa = new CreatePermit(userEmployeeID, jobID, 30, 0); cpa.Create(); int id = cpa.NewlyInsertedID; if (id > 0) { CommonMethods.InsertToMISSalesForceMapping(TableName.PermitForHoisting, sp.Id, id.ToString(), salesForceProjectID); } hoisting_permitID = id; } if (hoisting_permitID != 0) { UpdateHoistingPermit(hoisting_permitID, sp.Issue_Date__c, sp.Occupation_Start_Time__c, sp.Occupation_End_Time__c, sp.Type_Of_Truck__c, sp.Truck_Weight__c, sp.Foreman_Name__r.Name, sp.Foreman_Phone__c, sp.Remarks__c); } } LogMethods.Log.Debug("GetAllHoistingPermits:Debug:" + "Done"); } } catch (Exception e) { LogMethods.Log.Error("GetAllHoistingPermits:Error:" + e.Message); } }