Exemple #1
0
		private void PerformeReportAnalysis()
		{
			//			ZedGraphDemo demo = new ComboDemo();
			//			groupControl1.Controls.Clear();
			//			groupControl1.Controls.Add(demo.ZedGraphControl);
			//
			//			demo.ZedGraphControl.Width = groupControl1.Width;
			//			demo.ZedGraphControl.Height	= groupControl1.Height;
			//
			//			demo.ZedGraphControl.Anchor	= AnchorStyles.Left | AnchorStyles.Top  
			//				| AnchorStyles.Right | AnchorStyles.Bottom;
			//
			//			demo.ZedGraphControl.AxisChange();

			if(dateEdit1.Text.Trim().Length == 0)
			{
				MessageBox.Show("起始时间必须选择!!","系统信息!",
					MessageBoxButtons.OK,MessageBoxIcon.Information);
				return;
			}
			else if(dateEdit2.Text.Trim().Length == 0)
			{
				MessageBox.Show("结束时间必须选择!!","系统信息!",
					MessageBoxButtons.OK,MessageBoxIcon.Information);
				return;
			}
			else if(dateEdit1.DateTime.Date>dateEdit2.DateTime.Date)
			{
				MessageBox.Show("选择结束时间必须大于开始时间!!","系统信息!",
					MessageBoxButtons.OK,MessageBoxIcon.Information);
				return;
			}
			
			zedGraphControl_TeaDuty = new ZedGraphControl();
			groupControl_Graph.Controls.Clear();
			groupControl_Graph.Controls.Add(zedGraphControl_TeaDuty);
			zedGraphControl_TeaDuty.Dock = DockStyle.Fill;
				
			double[] getStat = new double[6];
			if(textEdit_Graphic_TeaID.Text.Equals("")  && textEdit_Graphic_TeaName.Text.Equals(""))
			{
				if(comboBoxEdit_Graphic_TeaDept.SelectedItem.ToString().Equals("全部"))
				{
					getStat = new DutySystem().CalcTeaDutyInfoForGraphic(dateEdit1.DateTime.Date,dateEdit2.DateTime.Date,"","","","");

				}
				else if(comboBoxEdit_Graphic_TeaDuty.SelectedItem.ToString().Equals("全部"))
				{
					getStat = new DutySystem().CalcTeaDutyInfoForGraphic(dateEdit1.DateTime.Date,dateEdit2.DateTime.Date,
						comboBoxEdit_Graphic_TeaDept.SelectedItem.ToString(),"","","");
				}
				else
				{
					getStat = new DutySystem().CalcTeaDutyInfoForGraphic(dateEdit1.DateTime.Date,dateEdit2.DateTime.Date,comboBoxEdit_Graphic_TeaDept.SelectedItem.ToString(),
						comboBoxEdit_Graphic_TeaDuty.SelectedItem.ToString(),"","");
				}						
			}
			else
			{
				if ( textEdit_Graphic_TeaID.Text.Equals("") )
				{
					getStat = new DutySystem().CalcTeaDutyInfoForGraphic(dateEdit1.DateTime.Date,dateEdit2.DateTime.Date,"","",textEdit_Graphic_TeaName.Text,"");
				}
				else
				{
					getStat = new DutySystem().CalcTeaDutyInfoForGraphic(dateEdit1.DateTime.Date,dateEdit2.DateTime.Date,"","","",textEdit_Graphic_TeaID.Text);
				}
			}


			double lateRate = getStat[0]*100;
			double earlyRate = getStat[1]*100;
			double absenceRate = getStat[2]*100;
			double outRate = getStat[3]*100;

			GraphPane graphPane = zedGraphControl_TeaDuty.GraphPane;

			graphPane.Title = "教师出勤统计图表";
			graphPane.XAxis.Title = "统计项目\n统计日期"+dateEdit1.DateTime.ToString("yyyy-MM-dd")
				+"至"+dateEdit2.DateTime.ToString("yyyy-MM-dd");
			graphPane.YAxis.Title = "百分比\n";

			double[] x = { 200, 400, 600, 800 };
			double[] y = { lateRate, earlyRate, absenceRate, outRate };
			BarItem bar = graphPane.AddBar( "出勤统计", x, y, Color.SteelBlue );
			// Fill the bars with a RosyBrown-White-RosyBrown gradient
			bar.Bar.Fill = new Fill( Color.RosyBrown, Color.White, Color.RosyBrown );

			// Make each cluster 100 user scale units wide.  This is needed because the X Axis
			// type is Linear rather than Text or Ordinal
			graphPane.ClusterScaleWidth = 100;
			// Bars are stacked
			graphPane.BarType = BarType.Stack;

			// Enable the X and Y axis grids
			graphPane.XAxis.IsShowGrid = true;
			graphPane.YAxis.IsShowGrid = true;

			// Manually set the scale maximums according to user preference
			graphPane.XAxis.Max = 1000;
			graphPane.YAxis.Max = 120;

			// Add a text item to decorate the graph
			TextItem textLate = new TextItem("迟到率"+lateRate.ToString("f2")+"%",
				200F, (float)(lateRate+5) );
			// Align the text such that the Bottom-Center is at (175, 80) in user scale coordinates
			textLate.Location.AlignH = AlignH.Center;
			textLate.Location.AlignV = AlignV.Bottom;
			textLate.FontSpec.Fill = new Fill( Color.White, Color.PowderBlue, 45F );
			textLate.FontSpec.StringAlignment = StringAlignment.Near;
			graphPane.GraphItemList.Add( textLate );

			// Add a text item to decorate the graph
			TextItem textEarly = new TextItem("早退率"+earlyRate.ToString("f2")+"%",
				400F, (float)(earlyRate+5) );
			// Align the text such that the Bottom-Center is at (175, 80) in user scale coordinates
			textEarly.Location.AlignH = AlignH.Center;
			textEarly.Location.AlignV = AlignV.Bottom;
			textEarly.FontSpec.Fill = new Fill( Color.White, Color.PowderBlue, 45F );
			textEarly.FontSpec.StringAlignment = StringAlignment.Near;
			graphPane.GraphItemList.Add( textEarly );

			// Add a text item to decorate the graph
			TextItem textAbsence = new TextItem("缺席率"+absenceRate.ToString("f2")+"%",
				600F, (float)(absenceRate+5) );
			// Align the text such that the Bottom-Center is at (175, 80) in user scale coordinates
			textAbsence.Location.AlignH = AlignH.Center;
			textAbsence.Location.AlignV = AlignV.Bottom;
			textAbsence.FontSpec.Fill = new Fill( Color.White, Color.PowderBlue, 45F );
			textAbsence.FontSpec.StringAlignment = StringAlignment.Near;
			graphPane.GraphItemList.Add( textAbsence );

			// Add a text item to decorate the graph
			TextItem textOut = new TextItem("出勤率"+outRate.ToString("f2")+"%",
				800F, (float)(outRate+5) );
			// Align the text such that the Bottom-Center is at (175, 80) in user scale coordinates
			textOut.Location.AlignH = AlignH.Center;
			textOut.Location.AlignV = AlignV.Bottom;
			textOut.FontSpec.Fill = new Fill( Color.White, Color.PowderBlue, 45F );
			textOut.FontSpec.StringAlignment = StringAlignment.Near;
			graphPane.GraphItemList.Add( textOut );

			// Add a BoxItem to show a colored band behind the graph data
			BoxItem box = new BoxItem( new RectangleF( 0, 132, 1000, 10 ),
				Color.Empty, Color.FromArgb( 225, 245, 225) );
			box.Location.CoordinateFrame = CoordType.AxisXYScale;
			// Align the left-top of the box to (0, 110)
			box.Location.AlignH = AlignH.Left;
			box.Location.AlignV = AlignV.Top;
			// place the box behind the axis items, so the grid is drawn on top of it
			box.ZOrder = ZOrder.E_BehindAxis;
			graphPane.GraphItemList.Add( box );

			// Fill the pane background with a gradient
			graphPane.PaneFill = new Fill( Color.WhiteSmoke, Color.Lavender, 0F );
			// Fill the axis background with a gradient
			graphPane.AxisFill = new Fill( Color.FromArgb( 255, 255, 245),
				Color.FromArgb( 255, 255, 190), 90F );

			zedGraphControl_TeaDuty.IsShowContextMenu = false;
			zedGraphControl_TeaDuty.IsEnableZoom = false;
			zedGraphControl_TeaDuty.AxisChange();
		}	
Exemple #2
0
		private void simpleButton_LoadCurDuty_Click(object sender, System.EventArgs e)
		{
			string message = "是否要装载本周班次?";
			string caption = "消息提示框!";
			DialogResult messageResult = MessageBox.Show(message,caption,MessageBoxButtons.YesNo,MessageBoxIcon.Question);
			if ( messageResult == DialogResult.Yes )
			{
				int getErrorMsg = new DutySystem().UpdateDutyInfo(dateEdit_DutyHistory.DateTime.Date.AddDays(7),true);
				if ( getErrorMsg == -1 )
					MessageBox.Show("当前班次即是本周班次,不用载入!");
			}

			simpleButton_LoadHisDuty.ForeColor = Color.Black;
			simpleButton_LoadCurDuty.ForeColor = Color.OrangeRed;

			simpleButton_LoadCurDuty.Enabled = false;

			simpleButton_TeaSearForDuty.PerformClick();
		}
Exemple #3
0
		private void simpleButton_LoadHisDuty_Click(object sender, System.EventArgs e)
		{
			if ( !isSaveNextDuty )
			{
				string message = "是否要装载历史班次记录?";
				string caption = "消息提示框!";
				DialogResult messageResult = MessageBox.Show(message,caption,MessageBoxButtons.YesNo,MessageBoxIcon.Question);
				if ( messageResult == DialogResult.Yes )
				{
					int getErrorMsg = new DutySystem().UpdateDutyInfo(dateEdit_DutyHistory.DateTime.Date.AddDays(7),false);
					if ( getErrorMsg == -1)
						MessageBox.Show("该时间段内的班次不存在,请重新选择!");
				
					simpleButton_LoadHisDuty.ForeColor = Color.OrangeRed;
					simpleButton_LoadCurDuty.ForeColor = Color.Black;
				}

				simpleButton_LoadCurDuty.Enabled = true;
				simpleButton_TeaSearForDuty.PerformClick();
			}
			else
			{
				int getErrorMsg = new DutySystem().UpdateDutyInfo(dateEdit_DutyHistory.DateTime.Date.AddYears(10),false);
			}
		}
Exemple #4
0
		private void CalcTeaDutyInfo()
		{
			string[] getStat = new string[6];
			if(textEdit_TeaDutyDetailsSearByID.Text.Equals("")  && textEdit_TeaDutyDetailsSearByName.Text.Equals(""))
			{
				if(comboBoxEdit_TeaDutyDetailsSearByGrade.SelectedItem.ToString().Equals("全部"))
				{
					getStat = new DutySystem().CalcTeaDutyInfo(dateEdit_TeaDutyDetailsSearByStartTime.DateTime.Date,
						dateEdit_TeaDutyDetailsSearByEndTime.DateTime.Date,"","","","");

				}
				else if(comboBoxEdit_TeaDutyDetailsSearByClass.SelectedItem.ToString().Equals("全部"))
				{
					getStat = new DutySystem().CalcTeaDutyInfo(dateEdit_TeaDutyDetailsSearByStartTime.DateTime.Date,
						dateEdit_TeaDutyDetailsSearByEndTime.DateTime.Date,comboBoxEdit_TeaDutyDetailsSearByGrade.SelectedItem.ToString(),
						"","","");
				}
				else
				{
					getStat = new DutySystem().CalcTeaDutyInfo(dateEdit_TeaDutyDetailsSearByStartTime.DateTime.Date,
						dateEdit_TeaDutyDetailsSearByEndTime.DateTime.Date,comboBoxEdit_TeaDutyDetailsSearByGrade.SelectedItem.ToString(),
						comboBoxEdit_TeaDutyDetailsSearByClass.SelectedItem.ToString(),"","");
				}
						
			}
			else
			{
				if ( textEdit_TeaDutyDetailsSearByID.Text.Equals("") )
				{
					getStat = new DutySystem().CalcTeaDutyInfo(dateEdit_TeaDutyDetailsSearByStartTime.DateTime.Date,
						dateEdit_TeaDutyDetailsSearByEndTime.DateTime.Date,"","",textEdit_TeaDutyDetailsSearByName.Text,"");
				}
				else
				{
					getStat = new DutySystem().CalcTeaDutyInfo(dateEdit_TeaDutyDetailsSearByStartTime.DateTime.Date,
						dateEdit_TeaDutyDetailsSearByEndTime.DateTime.Date,"","","",textEdit_TeaDutyDetailsSearByID.Text);
				}
			}

			textEdit_TeaOnTime.Text = getStat[0];
			textEdit_TeaOffTime.Text = getStat[1];
			textEdit_TeaAbsence.Text = getStat[2];
			textEdit_TeaAttend.Text = getStat[3];
			textEdit_TeaShouldAttend.Text = getStat[4];
			textEdit_TeaOut.Text = getStat[5];
		}
Exemple #5
0
		private void simpleButton_SaveDutyAsign_Click(object sender, System.EventArgs e)
		{
			for(int i = 0;i < gridView1.RowCount;i ++)
			{
				string tID = gridView1.GetDataRow(i)["T_ID"].ToString();
				string mondayDuty = GetDutyNumbers(gridView1.GetDataRow(i)["teaonduty_monday"].ToString());
				string tuesdayDuty = GetDutyNumbers(gridView1.GetDataRow(i)["teaonduty_tuesday"].ToString());
				string wednesdayDuty = GetDutyNumbers(gridView1.GetDataRow(i)["teaonduty_wednesday"].ToString());
				string thursdayDuty = GetDutyNumbers(gridView1.GetDataRow(i)["teaonduty_thursday"].ToString());
				string fridayDuty = GetDutyNumbers(gridView1.GetDataRow(i)["teaonduty_friday"].ToString());
				string saturdayDuty = GetDutyNumbers(gridView1.GetDataRow(i)["teaonduty_saturday"].ToString());
				string sundayDuty = GetDutyNumbers(gridView1.GetDataRow(i)["teaonduty_sunday"].ToString());

				int rowsEffected = 0;

				rowsEffected = new DutySystem().UpdateTeaDutyDetail(tID,sundayDuty,mondayDuty,
					tuesdayDuty,wednesdayDuty,thursdayDuty,fridayDuty,saturdayDuty);
			}

			if ( !isSaveNextDuty )
				MessageBox.Show("保存完毕!","系统信息!",
					MessageBoxButtons.OK,MessageBoxIcon.Information);

		}
Exemple #6
0
		private void dataNavigator_DutyDetails_ButtonClick(object sender, DevExpress.XtraEditors.NavigatorButtonClickEventArgs e)
		{
			appendClick = false;
			dataNavigator_DutyDetails.Buttons.Append.Enabled = true;

			switch(e.Button.ButtonType)
			{
				case NavigatorButtonType.Append:
					dataNavigator_DutyDetails.Buttons.Append.Enabled = false;
					appendClick = true;
					e.Handled = false;
					break;

				case NavigatorButtonType.Remove:
					if(DialogResult.Yes==(MessageBox.Show("确定要删除这条信息?","系统信息!",
						MessageBoxButtons.YesNo,MessageBoxIcon.Information)))
					{
						e.Handled = false;	
					}
					break;
				case NavigatorButtonType.EndEdit:
					e.Handled = true;
					

					if(!validateDataInfo())
					{
						dataNavigator_DutyDetails.Buttons.Append.Enabled = true;
						return;
					}

					dataNavigator_DutyDetails.BindingContext[DutyInfo.Tables[0]].EndCurrentEdit();

					if(DutyInfo.HasChanges())
					{
						int position = dataNavigator_DutyDetails.Position;
						int rowsEffected = new DutySystem().UpdateDutyInfoList(DutyInfo);

						if(rowsEffected>0)
						{
							DutyInfo = new DutySystem().GetDutyInfoList();
							if(dataNavigator_DutyDetails.BindingContext[DutyInfo.Tables[0]].Bindings.Count==0)
							{
								UnBindDutyData();
								BindDutyData();

								dataNavigator_DutyDetails.DataSource = DutyInfo.Tables[0];
								dataNavigator_DutyDetails.Position = position;
							}
							
							MessageBox.Show("保存成功.","系统信息!",MessageBoxButtons.OK,
								MessageBoxIcon.Information);
						}
					}

					
					dataNavigator_DutyDetails.Buttons.Append.Enabled = true;
					break;

				case NavigatorButtonType.CancelEdit:
					e.Handled = true;
					UnBindDutyData();
					DutyInfo = new DutySystem().GetDutyInfoList();
					dataNavigator_DutyDetails.DataSource = DutyInfo.Tables[0];
					BindDutyData();
					break;
			}
		}