+ Start a Discussion
RiyajRiyaj 

How do i get Date field original Date when executing in Apex Query using Asp.net C#....????

 


Hi,

 

 

Now I m developing Asp. WEbapplication using salesforce..

 

In sales froce I have object name 'Class' and 'Attendance' . In Attendance have a following fileds
Attendance Date, StudentName, ClassName, Roll.. When I want update the Field Roll wheather using Present/Absent, I need a Attendance record. So I passing parameter passing from aspx page like StudentName, ClassName, and Attendance Date. Here I want to date parameter format correctly... So Is my first question when I am passing the parameter from outside to apex code which date format i am following?

 

Another one when creating the Attendance record from asp.net. i need same above fields. So same I need Date Parameter from c# area..normally the date return '05/12/2011 12:00:00 AM' it is not support the Apex class..

 

 

1. how do I update the Attendance record from using c# parameter?
2.how do i insert the new record from Attendacne record from using c# parameter?

 

Update Apex Class Is


global class UpdateAttendanceList{
WebService static void UpdateAttendanceFromClassname(string id,string classname,string studentname,string attendance){
List<Attendance__c> Alist=[Select student_Name__c,attendance_Roll__c from Attendance__c where id = :id AND class_Name__r.Name= :classname AND student_Name__r.Name= :studentname];
if(Alist.size()>0)
{
Attendance__c conts=Alist.get(0);
conts.attendance_Roll__c= attendance;
update conts;
}

}}


Update Aspx Code:


updateAttendanceObj.UpdateAttendanceFromClassname(Id,sClassName, sStudentname, attendanceText);
//Values
updateAttendanceObj.UpdateAttendanceFromClassname(a0590000002LTetAAG,a0390000002vWW9AAM,0039000000CYPcOAAX,Present);


Insert Apex Class Is

global class InsertOneAttendanceDate{
WebService static void InsertOneDateAttendance(string studentname,string classname,date dtattendance){
Attendance__c i=new Attendance__c(student_Name__c= studentname,class_Name__c= classname,attendance_Date__c= dtattendance);
Insert i;
}
}


Insert Aspx Code:

InsertAttendanceObj.InsertOneDateAttendance(UserId, ClassNameID, firstweekday.Date);

//Values

InsertAttendanceObj.InsertOneDateAttendance(0039000000CYPcOAAX,a0390000002vWW9AAM,05/22/2012 12:00:00 AM)