In a WCF service I use Linq class. My code is as follows:
AttendenceDataContext projectDataContext=new AttendenceDataContext();
var brAttendence = new BR_Attendance()
{
SupId =1,
AttenDate=from w in projectDataContext.gete,
InTime =,
OutTime =,
ImageName =,
ImageUrl =,
PresentBR =,
AbsentBR =,
Active = true
};
I write the code in a wcf service can i insert getsysdatefrom inside my operation contract method. My wcf service code is as follows:
namespace ServiceHost
{
[ServiceContract(Namespace = "")]
[SilverlightFaultBehavior]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class UploadService
{
[OperationContract]
public bool Upload(ImageFile image)
{
FileStream fileStream = null;
BinaryWriter writer = null;
string filePath;
try
{
filePath = HttpContext.Current.Server.MapPath(".") + "\\Picture\\" + image.ImageName;
if (image.ImageName != string.Empty)
{
fileStream = File.Open(filePath, FileMode.Create);
writer = new BinaryWriter(fileStream);
writer.Write(image.Imagestream);
}
if (fileStream != null)
fileStream.Close();
if (writer != null)
writer.Close();
AttendenceDataContext projectDataContext = new AttendenceDataContext();
var brAttendence = new BR_Attendance()
{
SupId = 1,
AttenDate = from w in projectDataContext.gete,
InTime =,
OutTime =,
ImageName =,
ImageUrl =,
PresentBR =,
AbsentBR =,
Active = true
};
return true;
}
catch (Exception)
{
if (fileStream != null)
fileStream.Close();
if (writer != null)
writer.Close();
return false;
}
finally
{
}
}
}
}
In AttenDate I want to get the microsoft sql server current date. How to get it?