private void Button_Start(object sender, RoutedEventArgs e) { if (isGood(StartTime.Text)) { StartTime.BorderBrush = Brushes.Black; if (isGood(EndTime.Text)) { EndTime.BorderBrush = Brushes.Black; switch (MainButton.Content) { case "Start": ShowTime.Visibility = Visibility.Visible; Date = new CDate(StartTime.Text, EndTime.Text); Process = new Task(Calculate); Process.Start(); MainButton.Content = "Stop"; break; case "Stop": Process = null; Date = null; MainButton.Content = "Start"; break; } } else { EndTime.BorderBrush = Brushes.Red; } } else { StartTime.BorderBrush = Brushes.Red; } }
/// <summary> /// 文本格式,后期考虑支持Html格式 /// </summary> public override string ToString() { string result = ""; result += "操作人:(用户名:" + UName + ",管理员名:" + AName + ",IP:" + IP + ")\r\n"; result += "时间:(" + CDate.ToString() + "),操作:(" + Action + "),来源:(" + Source + ")\r\n"; result += "详情:(" + Message + ")\r\n"; result += "/*-----------------------------------------------------------------------------------*/"; return(result); }
protected void Validate(CDate cDate) { this.ValidateBase((CPrimitive)cDate); if (cDate.MonthValidity != null) { this.Validate(cDate.MonthValidity); Invariant(cDate.MonthValidity.value != 1002 || (cDate.DayValidity.value == 1002 || cDate.DayValidity.value == 1003), "cDate.MonthValidity is optional, means DayValidity must be either optional or disallowed."); Invariant(cDate.MonthValidity.value != 1003 || cDate.DayValidity.value == 1003, "cDate.MonthValidity is disallowed, implies cDate.DayValidity must be disallowed."); } }
internal static OpenEhr.AM.Archetype.ConstraintModel.Primitive.CPrimitive CPrimitive(string typeName) { DesignByContract.Check.Require(!string.IsNullOrEmpty(typeName), string.Format(CommonStrings.XMustNotBeNullOrEmpty, "typeName")); OpenEhr.AM.Archetype.ConstraintModel.Primitive.CPrimitive cPrimitive = null; switch (typeName) { case "C_BOOLEAN": cPrimitive = new CBoolean(); break; case "C_DATE": cPrimitive = new CDate(); break; case "C_DATE_TIME": cPrimitive = new CDateTime(); break; case "C_DURATION": cPrimitive = new CDuration(); break; case "C_TIME": cPrimitive = new CTime(); break; case "C_INTEGER": cPrimitive = new CInteger(); break; case "C_REAL": cPrimitive = new CReal(); break; case "C_STRING": cPrimitive = new CString(); break; default: throw new NotSupportedException("type not supported: " + typeName); } DesignByContract.Check.Ensure(cPrimitive != null, "cObject must not be null."); return(cPrimitive); }
//Tinh Ngay den han public DateTime NgayDH(DateTime NgayGD) { int KyHan; DataTable data1 = m_SoTietKiemData.LayTheoNgayDH(NgayGD); DataRow row = data1.Rows[0]; KyHan = Convert.ToInt32(row["KyHan"]) * 30; DateTime dt = new DateTime(); dt = Convert.ToDateTime(row["NgayDenHan"]); cd = new CDate(dt); cd.IncDay(KyHan); return(cd.ToDateTime); }
private static CDate Map(this C_DATE model) { var primitive = new CDate { AssumedValue = new Date { Value = model.assumed_value }, Pattern = model.pattern }; if (model.range != null) { primitive.Range = model.range.Map(); } return(primitive); }
private void retrn_Click(object sender, EventArgs e) { try { MySqlConnection mcon = new MySqlConnection("datasource=localhost;port=3306;username=root;password=;database=Lms"); MySqlDataAdapter msd = new MySqlDataAdapter("select count(*) from borrow_history where Book_Id='" + book_id.Text + "'", mcon); mcon.Open(); // MySqlDataAdapter msd = new MySqlDataAdapter("delete from book_details where Book_Id='"+textBox1.Text+"'", mcon); DataTable dt = new DataTable(); MySqlCommand cmd = mcon.CreateCommand(); cmd.CommandType = CommandType.Text; msd.Fill(dt); // if (mcon.State == ConnectionState.Open) if (dt.Rows[0][0].ToString() == "1") { cmd.CommandText = "delete from borrow_history where Book_Id='" + book_id.Text + "'"; cmd.ExecuteNonQuery(); MessageBox.Show("Book Return Done...."); } else { MessageBox.Show("Book_Id does not found for Return!!!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } book_id.Clear(); user_name.Clear(); Borrow_date.Clear(); return_date.Clear(); CDate.Clear(); fine.Clear(); }
public CXDB Exec() { if (_DB == null) { return(null); } if (_DB.Photos == null) { return(null); } if (_DB.Photos.Count == 0) { return(null); } DateTime today = CWorker.FixDate(DateTime.Now); //xDB.Totals = _DB.TotalViews(); //xDB.Totals = TotalViews(_DB); //xDB.Totals = TotalDelta(xDB); xDB.Totals = new List <CTotalViews>(); CDate dateRecord = new CDate(); dateRecord.WeekDays = 6; dateRecord.PriorDays = 1; dateRecord.MonthDays = 30; string todayStr = CWorker.DT2StrReadable(CWorker.FixDate(today)); dateRecord.Today = todayStr; dateRecord.Prior = todayStr + " : " + CWorker.DT2StrReadable(CWorker.FixDate((CWorker.DTSub(today, dateRecord.PriorDays)))); dateRecord.First = todayStr; dateRecord.Week = CWorker.DT2StrReadable(CWorker.FixDate((CWorker.DTSub(today, dateRecord.WeekDays)))) + " : " + todayStr; dateRecord.Month = CWorker.DT2StrReadable(CWorker.FixDate((CWorker.DTSub(today, dateRecord.MonthDays)))) + " : " + todayStr; xDB.Date = dateRecord; xDB.Views = new CViews(); xDB.Pictures = new CViews(); int ViewsTotal = 0; int ViewsToday = 0; int ViewsWeek = 0; int ViewsMonth = 0; int picturesTotal = 0; xDB.Pictures.Today = 0; int picturesWeek = 0; int picturesMonth = 0; List <DateTime> range = FindRange(); xDB.Pictures.Today = 0; xDB.Pictures.Total = 0; xDB.Pictures.Week = 0; xDB.Pictures.Month = 0; xDB.Views.Total = 0; xDB.Views.Today = 0; xDB.Views.Week = 0; xDB.Views.Month = 0; xDB.MaxCount = 0; int maxCount = -1; foreach (CPhoto photo in _DB.Photos) { if (photo.ID == "4633792226") { string x = "y"; } List <CStats> fullStat = FillArray(photo.Stats, range);// List <CStats> deltaList = DeltaArray(fullStat); if (fullStat.Count < 2) { continue; } if (fullStat.Count > xDB.MaxCount) { xDB.MaxCount = fullStat.Count; } int thisWeek = 0; int thisToday = 0; int thisMonth = 0; //CStats urRecord = fullStat[0]; CStats current = FindIf(fullStat, today);// ViewsTotal += current.Views; if (current.Views != 0) { picturesTotal++; } //thisToday = CWorker.Delta2(today, deltaList, dateRecord.PriorDays); CStats temp = FindIf(deltaList, today); if (temp == null) { continue; } thisToday = temp.Views; ViewsToday += thisToday; if (thisToday != 0) { xDB.Pictures.Today++; } thisWeek = CWorker.Delta2(today, deltaList, dateRecord.WeekDays); ViewsWeek += thisWeek; if (thisWeek != 0) { picturesWeek++; } thisMonth = CWorker.Delta2(today, deltaList, dateRecord.MonthDays); ViewsMonth += thisMonth; if (thisMonth != 0) { picturesMonth++; } UpdateViews(xDB, deltaList); UpdateTotals(xDB, fullStat); CData data = new CData(); data.MetaData = new CMetaData(photo); data.Total = current.Views; data.Week = thisWeek; data.Today = thisToday; data.Month = thisMonth; xDB.Data.Add(data); } xDB.Pictures.Total = picturesTotal; xDB.Pictures.Week = picturesWeek; xDB.Pictures.Month = picturesMonth; xDB.Views.Total = ViewsTotal; xDB.Views.Today = ViewsToday; xDB.Views.Week = ViewsWeek; xDB.Views.Month = ViewsMonth; xDB.MaxCount = maxCount; return(xDB); }
private void chinaDateControl1_GetDateInfomation(CDate.myArgs e1) { //�ù���ȷ��12��24������ƹ�ʱ��ʾ����ʾ��Ϣ if(e1.Date.Month==12 && e1.Date.Day==24) { e1.Infomation ="ף���ʥ���ڿ���"; } else if(e1.ChinaMonth.Equals("����") && e1.ChinaDay.EndsWith("��һ"))//��ũ��ָ��8�³�һ����ʾ��Ϣ { e1.Infomation ="�����Ǵ�����ү���գ�"; } }
private void chinaDateControl1_PaintDate(CDate.myArgs e1) { //��ũ��ָ�����³�һ�Ǹ��ж�����Ϣ������ if(e1.ChinaMonth.Equals("����") && e1.ChinaDay.EndsWith("��һ")) { e1.IsSpecial = true; } }
public void IsValidValueThrowsException() { var instance = new CDate(); instance.IsValidValue(null); }
public override string ToString() { return(string.Format("Id : {0} \nName : {1} \nCreatedDate : {2} \nSalary : {3} \nRole : {4} \nDepartment : {5} \n -------------------------" , Id.ToString(), FullName, CDate.ToShortDateString(), Money.ToString(), Roles, Department)); }
public Environment() { Output = new Output(); EmptyArgs = new SArgs(this); True = new LBoolean(this, true); False = new LBoolean(this, false); Undefined = new LUndefined(this); Null = new LNull(this); GlobalObject = new BGlobal(this); GlobalEnvironment = new SLexicalEnvironment(this, new SObjectEnvironmentRecord(this, GlobalObject, false), null); MathObject = new BMath(this); JsonObject = new BJson(this); ObjectConstructor = new CObject(this); FunctionConstructor = new CFunction(this); ArrayConstructor = new CArray(this); StringConstructor = new CString(this); BooleanConstructor = new CBoolean(this); NumberConstructor = new CNumber(this); DateConstructor = new CDate(this); RegExpConstructor = new CRegExp(this); ErrorConstructor = new CError(this); EvalErrorConstructor = new CEvalError(this); RangeErrorConstructor = new CRangeError(this); ReferenceErrorConstructor = new CReferenceError(this); SyntaxErrorConstructor = new CSyntaxError(this); TypeErrorConstructor = new CTypeError(this); UriErrorConstructor = new CUriError(this); ObjectPrototype = new PObject(this); FunctionPrototype = new PFunction(this); ArrayPrototype = new PArray(this); StringPrototype = new PString(this); BooleanPrototype = new PBoolean(this); NumberPrototype = new PNumber(this); DatePrototype = new PDate(this); RegExpPrototype = new PRegExp(this); ErrorPrototype = new PError(this); EvalErrorPrototype = new PEvalError(this); RangeErrorPrototype = new PRangeError(this); ReferenceErrorPrototype = new PReferenceError(this); SyntaxErrorPrototype = new PSyntaxError(this); TypeErrorPrototype = new PTypeError(this); UriErrorPrototype = new PUriError(this); GlobalObject.Initialize(); MathObject.Initialize(); JsonObject.Initialize(); ObjectConstructor.Initialize(); FunctionConstructor.Initialize(); ArrayConstructor.Initialize(); StringConstructor.Initialize(); BooleanConstructor.Initialize(); NumberConstructor.Initialize(); DateConstructor.Initialize(); RegExpConstructor.Initialize(); ErrorConstructor.Initialize(); EvalErrorConstructor.Initialize(); RangeErrorConstructor.Initialize(); ReferenceErrorConstructor.Initialize(); SyntaxErrorConstructor.Initialize(); TypeErrorConstructor.Initialize(); UriErrorConstructor.Initialize(); ObjectPrototype.Initialize(); FunctionPrototype.Initialize(); ArrayPrototype.Initialize(); StringPrototype.Initialize(); BooleanPrototype.Initialize(); NumberPrototype.Initialize(); DatePrototype.Initialize(); RegExpPrototype.Initialize(); ErrorPrototype.Initialize(); EvalErrorPrototype.Initialize(); RangeErrorPrototype.Initialize(); ReferenceErrorPrototype.Initialize(); SyntaxErrorPrototype.Initialize(); TypeErrorPrototype.Initialize(); UriErrorPrototype.Initialize(); }
private void dateControl_PaintDate(CDate.myArgs e1) { //foreach (Label l in flowLayoutPanel_in.Controls) //{ // try // { // int day = int.Parse(l.Text); // if (e1.Date.Day == day) e1.IsSpecial = true; // } // catch { } //} //foreach (Label l in flowLayoutPanel_out.Controls) //{ // try // { // int day = int.Parse(l.Text); // if (e1.Date.Day == day) e1.IsSpecial = true; // } // catch { } //} }