本文整理汇总了C#中System.Data.SqlTypes.SqlDateTime类的典型用法代码示例。如果您正苦于以下问题:C# SqlDateTime类的具体用法?C# SqlDateTime怎么用?C# SqlDateTime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlDateTime类属于System.Data.SqlTypes命名空间,在下文中一共展示了SqlDateTime类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: cArticle
public cArticle(SqlString artName, SqlString artField, SqlString artMag, SqlDateTime artDate)
{
strName = artName;
strField = artField;
strMagazine = artMag;
dtmDate = artDate;
}
示例2: TabRescenCourseInfo
/// <summary>
/// full constructor
/// </summary>
///
public TabRescenCourseInfo(String FCourseId_0, String FCourseName_1,
String FCourseNo_2, String FParentId_3, Int32 FSortCode_4,
String FCoursePath_5, String FCoursetypeId_6, Int32 FCourseformatId_7,
String FSupplierId_8, String FSysuserId_9, SqlDateTime FCreateTime_10,
String FTecherName_11, String FLevelId_12, Int32 FChapterNums_13,
Int32 FCourseScores_14, Int32 FCourseHours_15, Double FStudyDuration_16,
Double FCoursePrice_17, String FCourseDesc_18, Int32 FVerifyStatus_19,
Int32 FUseStatus_20, Int32 FIsSell_21)
{
this.FCourseId = FCourseId_0;
this.FCourseName = FCourseName_1;
this.FCourseNo = FCourseNo_2;
this.FParentId = FParentId_3;
this.FSortCode = FSortCode_4;
this.FCoursePath = FCoursePath_5;
this.FCoursetypeId = FCoursetypeId_6;
this.FCourseformatId = FCourseformatId_7;
this.FSupplierId = FSupplierId_8;
this.FSysuserId = FSysuserId_9;
this.FCreateTime = FCreateTime_10;
this.FTecherName = FTecherName_11;
this.FLevelId = FLevelId_12;
this.FChapterNums = FChapterNums_13;
this.FCourseScores = FCourseScores_14;
this.FCourseHours = FCourseHours_15;
this.FStudyDuration = FStudyDuration_16;
this.FCoursePrice = FCoursePrice_17;
this.FCourseDesc = FCourseDesc_18;
this.FVerifyStatus = FVerifyStatus_19;
this.FUseStatus = FUseStatus_20;
this.FIsSell = FIsSell_21;
}
示例3: Box
public static object Box(SqlDateTime a)
{
if (a.IsNull)
return null;
else
return a.Value;
}
示例4: SqlDateTimeTest
public SqlDateTimeTest()
{
CultureInfo.CurrentCulture = new CultureInfo("en-US");
_test1 = new SqlDateTime(2002, 10, 19, 9, 40, 0);
_test2 = new SqlDateTime(2003, 11, 20, 10, 50, 1);
_test3 = new SqlDateTime(2003, 11, 20, 10, 50, 1);
}
示例5: SqlDateTime
public SqlDateTime(int year, int month, int day, int hour, int minute, int second, double millisecond)
{
if (((year >= MinYear) && (year <= MaxYear)) && ((month >= 1) && (month <= 12)))
{
int[] numArray = IsLeapYear(year) ? DaysToMonth366 : DaysToMonth365;
if ((day >= 1) && (day <= (numArray[month] - numArray[month - 1])))
{
int num2 = year - 1;
int dayTicks = ((((((num2 * 0x16d) + (num2 / 4)) - (num2 / 100)) + (num2 / 400)) + numArray[month - 1]) + day) - 1;
dayTicks -= DayBase;
if (((((dayTicks >= MinDay) && (dayTicks <= MaxDay)) && ((hour >= 0) && (hour < 0x18))) && (((minute >= 0) && (minute < 60)) && ((second >= 0) && (second < 60)))) && ((millisecond >= 0.0) && (millisecond < 1000.0)))
{
double num4 = (millisecond * SQLTicksPerMillisecond) + 0.5;
int timeTicks = (((hour * SQLTicksPerHour) + (minute * SQLTicksPerMinute)) + (second * SQLTicksPerSecond)) + ((int) num4);
if (timeTicks > MaxTime)
{
timeTicks = 0;
dayTicks++;
}
this = new SqlDateTime(dayTicks, timeTicks);
return;
}
}
}
throw new SqlTypeException(SQLResource.InvalidDateTimeMessage);
}
示例6: GetGroupChangeInformationBetweenDates
public string GetGroupChangeInformationBetweenDates(SqlDateTime begin, SqlDateTime end)
{
string blank = "";
Collection<RequestForm> forms = GetApprovedRequestsBetweenDates(begin, end);
List<string> groups = _dataRequest.GetAllGroups();
Dictionary<string, int> groupCount = new Dictionary<string, int>();
foreach (string entry in groups)
{
groupCount.Add(entry, 0);
}
foreach (RequestForm entry in forms)
{
if (entry != null)
{
string pastGroup = entry.Current.BazookaInfo.Group;
string futureGroup = entry.Future.BazookaInfo.Group;
if (groupCount.ContainsKey(pastGroup))
groupCount[pastGroup]--;
if (groupCount.ContainsKey(futureGroup))
groupCount[futureGroup]++;
}
}
foreach (string entry in groups)
{
if (groupCount[entry] != 0)
blank += String.Format("Group {0} changed by {1} people\n", entry, groupCount[entry]);
}
return blank;
}
示例7: GetReady
public void GetReady()
{
Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US");
Test1 = new SqlDateTime (2002, 10, 19, 9, 40, 0);
Test2 = new SqlDateTime (2003, 11, 20,10, 50, 1);
Test3 = new SqlDateTime (2003, 11, 20, 10, 50, 1);
}
示例8: AddContainerACL
public static void AddContainerACL(
SqlString accountName, SqlString sharedKey, SqlBoolean useHTTPS,
SqlString containerName,
SqlString containerPublicReadAccess,
SqlString accessPolicyId,
SqlDateTime start, SqlDateTime expiry,
SqlBoolean canRead,
SqlBoolean canWrite,
SqlBoolean canDeleteBlobs,
SqlBoolean canListBlobs,
SqlGuid LeaseId,
SqlInt32 timeoutSeconds,
SqlGuid xmsclientrequestId)
{
Enumerations.ContainerPublicReadAccess cpraNew;
if(!Enum.TryParse<Enumerations.ContainerPublicReadAccess>(containerPublicReadAccess.Value, out cpraNew))
{
StringBuilder sb = new StringBuilder("\"" + containerPublicReadAccess.Value + "\" is an invalid ContainerPublicReadAccess value. Valid values are: ");
foreach (string s in Enum.GetNames(typeof(Enumerations.ContainerPublicReadAccess)))
sb.Append("\"" + s + "\" ");
throw new ArgumentException(sb.ToString());
}
AzureBlobService abs = new AzureBlobService(accountName.Value, sharedKey.Value, useHTTPS.Value);
Container cont = abs.GetContainer(containerName.Value);
Enumerations.ContainerPublicReadAccess cpra;
SharedAccessSignature.SharedAccessSignatureACL sasACL = cont.GetACL(out cpra,
LeaseId.IsNull ? (Guid?)null : LeaseId.Value,
timeoutSeconds.IsNull ? 0 : timeoutSeconds.Value,
xmsclientrequestId.IsNull ? (Guid?)null : xmsclientrequestId.Value);
string strPermissions = "";
if (canRead.IsTrue)
strPermissions += "r";
if (canWrite.IsTrue)
strPermissions += "w";
if (canDeleteBlobs.IsTrue)
strPermissions += "d";
if (canListBlobs.IsTrue)
strPermissions += "l";
SharedAccessSignature.AccessPolicy ap = new SharedAccessSignature.AccessPolicy()
{
Start = start.Value,
Expiry = expiry.Value,
Permission = strPermissions
};
sasACL.SignedIdentifier.Add(new SharedAccessSignature.SignedIdentifier()
{
AccessPolicy = ap,
Id = accessPolicyId.Value
});
cont.UpdateContainerACL(cpraNew, sasACL,
LeaseId.IsNull ? (Guid?)null : LeaseId.Value,
timeoutSeconds.IsNull ? 0 : timeoutSeconds.Value,
xmsclientrequestId.IsNull ? (Guid?)null : xmsclientrequestId.Value);
}
示例9: GetReady
public void GetReady()
{
Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = "en-US";
Test1 = new SqlDateTime (2002, 10, 19, 9, 40, 0);
Test2 = new SqlDateTime (2003, 11, 20,10, 50, 1);
Test3 = new SqlDateTime (2003, 11, 20, 10, 50, 1);
}
示例10: ParamDateTimeTemp
public static SqlDateTime ParamDateTimeTemp(SqlXml Xml, SqlString Name)
{
String ValueType;
String Value = GetValueFromXMLAttribute(Xml, Name, out ValueType);
if (Value == null) return new SqlDateTime();
SqlDateTime Result;
try
{
Result = new SqlDateTime(XmlConvert.ToDateTime(Value, XmlDateTimeSerializationMode.RoundtripKind));
}
catch (Exception Error)
{
throw new System.Exception("Error convert Param = \"" + Name.Value.ToString() + "\" Value = \"" + Value.ToString() + "\" to DateTime: " + Error.Message);
}
if (ValueType != null && ValueType != "")
{
// year, month, day, hour, minute, second
switch (ValueType)
{
case "1": return Result.Value.Date.AddDays(1);
default: return Result;
}
}
return Result;
}
示例11: LocalizeDT
public static SqlDateTime LocalizeDT(SqlDateTime dt)
{
if (dt.IsNull)
return new SqlDateTime();
return new SqlDateTime(dt.Value.ToLocalTime());
}
示例12: spGetNewVestaErrands
public static void spGetNewVestaErrands(SqlDateTime date)
{
DateTime d = date.Value;
String reqStr = String.Format("http://{0}/services/internalSite/errands/sendNewVestaErrandsMails?date={1}",
UserDefinedFunctions.fGetWapServerName(), d.ToString("s"));
SqlContext.Pipe.Send(reqStr);
HttpWebRequest rq = (HttpWebRequest)WebRequest.Create(reqStr);
rq.KeepAlive = false;
XmlDocument xdoc = new XmlDocument();
using(HttpWebResponse rs = (HttpWebResponse)rq.GetResponse())
using(Stream stream = rs.GetResponseStream())
xdoc.Load(stream);
XmlNode root = xdoc["result"];
SqlDataRecord rec = new SqlDataRecord(new SqlMetaData("id", SqlDbType.NVarChar, -1),
new SqlMetaData("text", SqlDbType.NVarChar, -1),
new SqlMetaData("creator", SqlDbType.NVarChar, -1),
new SqlMetaData("email", SqlDbType.NVarChar, -1)
);
SqlContext.Pipe.SendResultsStart(rec);
foreach(XmlNode ch in root.ChildNodes)
{
rec.SetValues(ch["id"].InnerText,
ch["text"].InnerText,
ch["creator"].InnerText,
ch["email"].InnerText
);
SqlContext.Pipe.SendResultsRow(rec);
}
SqlContext.Pipe.SendResultsEnd();
}
示例13: HR_TimeLogs_TimeSpan
public static SqlDouble HR_TimeLogs_TimeSpan(SqlDateTime startAt, SqlDateTime endAt)
{
if (endAt.IsNull || startAt.IsNull)
return new SqlDouble();
TimeSpan duration = endAt.Value.Subtract(startAt.Value);
return new SqlDouble(duration.TotalSeconds);
}
示例14: FN_GER_GetWeekOfYear
public static SqlInt32 FN_GER_GetWeekOfYear(SqlDateTime _date)
{
System.Globalization.GregorianCalendar gc = new System.Globalization.GregorianCalendar();
return _date.IsNull ? SqlInt32.Null : gc.GetWeekOfYear(_date.Value, System.Globalization.CalendarWeekRule.FirstFullWeek, DayOfWeek.Monday);
}
示例15: DayOfWeek
public static SqlInt32 DayOfWeek(SqlDateTime time) {
if (time.IsNull) return SqlInt32.Null;
var numb = (int) time.Value.DayOfWeek;
if(numb==0) {
numb = 7;
}
return numb;
}