This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Diagnostics; | |
using System.Data; | |
using System.Collections; | |
using Microsoft.VisualBasic; | |
using System.Collections.Generic; | |
using System; | |
using System.Net; | |
using System.IO; | |
using System.Text.RegularExpressions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This class contains unit tests for validating the behavior of Apex classes | |
* and triggers. | |
* | |
* Unit tests are class methods that verify whether a particular piece | |
* of code is working properly. Unit test methods take no arguments, | |
* commit no data to the database, and are flagged with the testMethod | |
* keyword in the method definition. | |
* | |
* All test methods in an organization are executed whenever Apex code is deployed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global class CL_BATCH_update_Purchases implements Database.Batchable<sObject> { | |
public CL_BATCH_update_Purchases(){} | |
global Database.QueryLocator start(Database.BatchableContext BC){ | |
String query='Select Id from SFDC_Purchase_Order__c'; | |
return Database.getQueryLocator(query); | |
} | |
global void execute(Database.BatchableContext BC,List<SFDC_Purchase_Order__c> scope){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global class CL_Schedulable_update_Purchases implements Schedulable { | |
global void execute(SchedulableContext SC){ | |
CL_BATCH_update_Purchases batch_ordenes=new CL_BATCH_update_Purchases(); | |
Database.executeBatch(batch_ordenes); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date firstDayOfMonth = System.today().toStartOfMonth(); | |
Date lastDayOfMonth = firstDayOfMonth.addDays(Date.daysInMonth(firstDayOfMonth.year(), firstDayOfMonth.month()) - 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Class checkRecursive | |
{ | |
private static boolean run = true; | |
public static boolean runOnce(){ | |
if(run){ | |
run=false; | |
return true; | |
} | |
else | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function deleteAccent(str){ | |
for (var i=0;i<str.length;i++){ | |
//Change "á é í ó ú" | |
if (str.charAt(i)=="á") str = str.replace(/á/,"a"); | |
if (str.charAt(i)=="é") str = str.replace(/é/,"e"); | |
if (str.charAt(i)=="í") str = str.replace(/í/,"i"); | |
if (str.charAt(i)=="ó") str = str.replace(/ó/,"o"); | |
if (str.charAt(i)=="ú") str = str.replace(/ú/,"u"); | |
} | |
return str; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:outputText value="{0, number, ###,###,###,##0.00}"> | |
<apex:param value="{!Opportunity.Amount}"/> | |
</apex:outputText> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CASE(MOD( StartDate__c - DATE(1985,6,24),7), | |
0 , CASE( MOD( EndDate__c - StartDate__c ,7),1,2,2,3,3,4,4,5,5,5,6,5,1), | |
1 , CASE( MOD( EndDate__c - StartDate__c ,7),1,2,2,3,3,4,4,4,5,4,6,5,1), | |
2 , CASE( MOD( EndDate__c - StartDate__c ,7),1,2,2,3,3,3,4,3,5,4,6,5,1), | |
3 , CASE( MOD( EndDate__c - StartDate__c ,7),1,2,2,2,3,2,4,3,5,4,6,5,1), | |
4 , CASE( MOD( EndDate__c - StartDate__c ,7),1,1,2,1,3,2,4,3,5,4,6,5,1), | |
5 , CASE( MOD( EndDate__c - StartDate__c ,7),1,0,2,1,3,2,4,3,5,4,6,5,0), | |
6 , CASE( MOD( EndDate__c - StartDate__c ,7),1,1,2,2,3,3,4,4,5,5,6,5,0), | |
999) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HashCodeGenerator{ | |
public static integer getHashCode(object obj){ | |
Map<string, integer> vals = new Map<string, integer>{'0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9, 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13, 'E' => 14, 'F' => 15}; | |
string objJS = JSON.serialize(obj); | |
Blob b = Blob.valueOf(objJS); | |
Blob bHash = Crypto.generateMac('hmacSHA1', b, blob.valueOf('a key that does not matter')); | |
string objHex = EncodingUtil.convertToHex(bHash); |
OlderNewer