Example #1
0
		public TeacherCheckInfo()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		tchBase = new TeacherBase();
		}
		public TeaBaseInfoPrintSystem()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
			tBase = new TeacherBase();
			teaBaseInfoPrintRules = new TeaBaseInfoPrintRules();
		}
Example #3
0
		public int UpdateTcBaseInfo(TeacherBase tcBase)
		{
			int rowsAffected = 0;

			using(TeacherBaseDataAccess tcBaseDA = new TeacherBaseDataAccess())
			{
				rowsAffected = tcBaseDA.UpdateTcBaseInfo(tcBase);
			}

			return rowsAffected;
		}
Example #4
0
		public int InsertTcBaseInfo(TeacherBase tcBase)
		{
			int rowsAffected = 0;
			
			try
			{				
				DBCommandWrapper dbCommandWrapper = db.GetStoredProcCommandWrapper("InsertTeach_Base_Info");
				dbCommandWrapper.AddInParameter("@T_ID",DbType.String,tcBase.TID);
				dbCommandWrapper.AddInParameter("@T_Number",DbType.String,tcBase.TNumber);
				dbCommandWrapper.AddInParameter("@T_Name",DbType.String,tcBase.TName);
				dbCommandWrapper.AddInParameter("@T_Sex",DbType.String,tcBase.TSex);
				dbCommandWrapper.AddInParameter("@T_Merrige",DbType.String,tcBase.TMerrige);
				dbCommandWrapper.AddInParameter("@T_Addr",DbType.String,tcBase.TAddr);
				dbCommandWrapper.AddInParameter("@T_Career",DbType.String,tcBase.TCareer);
				dbCommandWrapper.AddInParameter("@T_Home_Tel",DbType.String,tcBase.THomeTel);
				dbCommandWrapper.AddInParameter("@T_Phone",DbType.String,tcBase.TPhone);
				dbCommandWrapper.AddInParameter("@T_Work_Tel",DbType.String,tcBase.TWorkTel);
				dbCommandWrapper.AddInParameter("@T_Depart",DbType.String,tcBase.TDepart);
				dbCommandWrapper.AddInParameter("@T_Duty",DbType.String,tcBase.TDuty);
				dbCommandWrapper.AddInParameter("@T_Technical_Post",DbType.String,tcBase.TTechnicalPost);
				dbCommandWrapper.AddInParameter("@T_Level",DbType.String,tcBase.TLevel);
				dbCommandWrapper.AddInParameter("@T_Work_Time",DbType.String,tcBase.TWorkTime);
				dbCommandWrapper.AddInParameter("@T_Enter_Time",DbType.String,tcBase.TEnterTime);
				dbCommandWrapper.AddInParameter("@T_Image",DbType.Binary,tcBase.ImageData);
				dbCommandWrapper.AddOutParameter("@rowsAffected",DbType.Int32,4);

				db.ExecuteNonQuery(dbCommandWrapper);
				
				rowsAffected = Convert.ToInt32(dbCommandWrapper.GetParameterValue("@rowsAffected"));
			}
			catch(Exception ex)
			{
				throw ex;
			}
			
			return rowsAffected;
		}
Example #5
0
		private void simpleButton_ModifyButton_Click(object sender, System.EventArgs e)
		{
			tID = textEdit_tID.EditValue.ToString();
			TeacherBase tcBase = new TeacherBase();
			TeacherBaseSystem tcBaseSystem = new TeacherBaseSystem();
			DialogResult messageResult = MessageBox.Show("是否确认保存修改内容?","消息提示框!",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
			if ( messageResult == DialogResult.Yes )
			{
				try
				{
					bool doDataInsertLoopOnce = true;
					TeacherCheckInfo teacherCheckInfo = new TeacherCheckInfo();
					while(doDataInsertLoopOnce)
					{
						tcBase.TCareer = tRecord.SelectedItem.ToString().Replace(" ","");
						tcBase.TMerrige = tMarrige.SelectedItem.ToString().Replace(" ","");
						tcBase.TAddr = tAddr.Text.Replace(" ","");
						tcBase.TDepart = tDept.SelectedItem.ToString().Replace(" ","");
						tcBase.TLevel = tLevel.SelectedItem.ToString().Replace(" ","");
						tcBase.TDuty = tDuty.SelectedItem.ToString().Replace(" ","");
						tcBase.TTechnicalPost = tTechnicalPost.SelectedItem.ToString().Replace(" ","");
						tcBase.TID = tID;

						if(!teacherCheckInfo.isValidTcName(tName.Text.Replace(" ","")))
						{
							MessageBox.Show("教师姓名请正确填写!");
							break;
						}
						else
							tcBase.TName = tName.Text.Replace(" ","");

						if ( gridView1.RowCount > 0 )
						{
							if ( teacherCheckInfo.hasCard(tID,tNumber.Text))
							{
								MessageBox.Show("该教师已经发过卡,修改工号会存在潜在风险,修改失败!");
								break;
							}
							else
							{
								//获取顺序工号
								if ( tNumber.Text.Equals("") )
									tcBase.TNumber = teacherCheckInfo.getSerialTcNumber();
								else
								{
							
									if ( !teacherCheckInfo.isValidTcNumber(tNumber.Text.Replace(" ","")))
									{
										MessageBox.Show("请确保输入的工号是有效工号!");
										break;
									}
									else
									{
										if ( !teacherCheckInfo.hasSameNumber( tNumber.Text.Replace(" ",""),
											tcBase.TID ) )
										{
											MessageBox.Show("您所选择的教师工号已经存在,请更换!");
											break;
										}
									}
									tcBase.TNumber = tNumber.Text.Replace(" ","");
								}
							}
						}
						else
							MessageBox.Show("教师记录不存在还无法进行修改!");

						if(!teacherCheckInfo.isValidTcHomePhone(tHomePhone.Text.Replace(" ","")))
						{
							MessageBox.Show("教师家庭电话填写不正确!");
							break;
						}
						else
							tcBase.THomeTel = tHomePhone.Text.Replace(" ","");
						
						if(!teacherCheckInfo.isValidTcTime(tEnterTime.DateTime.Date,tJoinDate.DateTime.Date))
						{
							MessageBox.Show("时间填写不当,请重新输入!");
							break;
						}
						else
						{
							tcBase.TEnterTime = Convert.ToDateTime(tEnterTime.Text.Replace(" ",""));
							tcBase.TWorkTime  = Convert.ToDateTime(tJoinDate.Text.Replace(" ",""));}
						if(!teacherCheckInfo.isValidTcSex(tSex.Text.Replace(" ","")))
						{
							MessageBox.Show("教师性别不正确!");
							break;
						}
						else
							tcBase.TSex = tSex.Text.Replace(" ","");

						if(!teacherCheckInfo.isValidTcWorkPhone(tWorkPhone.Text.Replace(" ","")))
						{
							MessageBox.Show("教师办公电话填写不正确,请正确填写!");
							break;
						}
						else
							tcBase.TWorkTel = tWorkPhone.Text.Replace(" ","");

						if(!teacherCheckInfo.isValidTcPhone(tPhone.Text.Replace(" ","")))
						{
							MessageBox.Show("教师手机号码不正确!");
							break;
						}
						else
							tcBase.TPhone = tPhone.Text.Replace(" ","");
						
						if ( pictureEdit_LoadImageData.Image == null )
							imageDataBuffer = null;
						else
						{
							imageMSReader = new MemoryStream();
							pictureEdit_LoadImageData.Image.Save(imageMSReader,ImageFormat.Jpeg);
							imageDataBuffer = imageMSReader.ToArray();
						}
						tcBase.ImageData = imageDataBuffer;

						tcBaseSystem.UpdateTcBaseInfo(tcBase);
			

						if(!gridView1.GetDataRow(gridView1.GetSelectedRows()[0])["T_Number"].ToString().Equals(tcBase.TNumber))
						{
							new UserSystem().DeleteUserAccount(gridView1.GetDataRow(gridView1.GetSelectedRows()[0])
								["T_Number"].ToString());

							new UserSystem().CreateUserAccount(tcBase.TNumber,textEdit_UserPwd.Text);
						}

						int rtnValue = new UserSystem().UpdateUserRole(tcBase.TNumber,comboBoxEdit_Privilege.SelectedItem.ToString());

						if (rtnValue == -1) MessageBox.Show("如果您执行此修改,系统将不存在最高权限,这是不允许的,修改失败!");
						else if (rtnValue == 0)
						{
							new UserSystem().DeleteUserAccount(tcBase.TNumber);
							new UserSystem().CreateUserAccount(tcBase.TNumber,textEdit_UserPwd.Text);
							new UserSystem().AddUserRole(tcBase.TNumber,comboBoxEdit_Privilege.SelectedItem.ToString());
							MessageBox.Show("修改完毕!");
						}
						else MessageBox.Show("修改完毕!");

						doDataInsertLoopOnce = false;

						//刷新绑定信息
						TextDataUnBindings();
						TextDataClear();
//						loadPage(new TeacherBaseSystem().SearchTcBaseInfoByCondition("","","",""));
						loadPage(new TeacherBaseSystem().SearchTcBaseInfoByCondition(comboBoxEdit_Grade.SelectedItem.ToString().Replace(" ",""),
							comboBoxEdit_Class.SelectedItem.ToString().Replace(" ",""),textEdit_Name.Text.Replace(" ",""),textEdit_Number.Text.Replace(" ","")));

					}
				}
				catch(Exception ex)
				{
					MessageBox.Show(ex.Message);
				}
			}
		}
Example #6
0
		private void simpleButton_SaveButton_Click(object sender, System.EventArgs e)
		{		
			tID = textEdit_tID.EditValue.ToString();
			TeacherBase tcBase = new TeacherBase();
			TeacherBaseSystem tcBaseSystem = new TeacherBaseSystem();
			DialogResult messageResult = MessageBox.Show("是否确认保存这些数据?","消息提示框!",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
			if ( messageResult == DialogResult.Yes )
			{
				try
				{
					bool doDataInsertLoopOnce = true;
					TeacherCheckInfo teacherCheckInfo = new TeacherCheckInfo();
					while(doDataInsertLoopOnce)
					{
						tcBase.TCareer = tRecord.SelectedItem.ToString().Replace(" ","");
						tcBase.TMerrige = tMarrige.SelectedItem.ToString().Replace(" ","");						
						tcBase.TDepart = tDept.SelectedItem.ToString().Replace(" ","");
						tcBase.TLevel = tLevel.SelectedItem.ToString().Replace(" ","");
						tcBase.TDuty = tDuty.SelectedItem.ToString().Replace(" ","");
						tcBase.TTechnicalPost = tTechnicalPost.SelectedItem.ToString().Replace(" ","");
						if ( !tID.Equals("") )
							tcBase.TID = tID;
						else
							tcBase.TID = Guid.NewGuid().ToString();

						if(!teacherCheckInfo.isValidTcName(tName.Text.Replace(" ","")))
						{
							MessageBox.Show("教师姓名请正确填写!");
							break;
						}
						else{tcBase.TName = tName.Text.Replace(" ","");}

                        //获取顺序工号
						if ( tNumber.Text.Equals("") )
						{
							tcBase.TNumber = teacherCheckInfo.getSerialTcNumber();

							if ( tcBase.TNumber.Equals("-1") )
							{
								MessageBox.Show("已超出系统所允许的最大教师数量!");
								break;
							}

						}
						else
						{
							if ( !teacherCheckInfo.isValidTcNumber(tNumber.Text.Replace(" ","")))
							{
								MessageBox.Show("请确保输入的工号是有效工号!");
								break;
							}
							else
							{
								if ( !teacherCheckInfo.hasSameNumber( tNumber.Text.Replace(" ",""),
									tcBase.TID ) )
								{
									MessageBox.Show("您所选择的教师工号已经存在,请更换!");
									break;
								}
							}
							tcBase.TNumber = tNumber.Text.Replace(" ","");
						}

						if(!teacherCheckInfo.isValidTcHomePhone(tHomePhone.Text.Replace(" ","")))
						{
							tcBase.THomeTel = "未填写";
							MessageBox.Show("教师家庭电话填写不正确!");
							break;
						}
						else
							tcBase.THomeTel = tHomePhone.Text.Replace(" ","");
						
						if(!teacherCheckInfo.isValidTcTime(Convert.ToDateTime(tEnterTime.Text.Replace(" ","")),Convert.ToDateTime(tJoinDate.Text.Replace(" ",""))))
						{
							MessageBox.Show("时间填写不当,请重新输入!");
							break;
						}
						else
						{
							tcBase.TWorkTime = Convert.ToDateTime(tEnterTime.Text.Replace(" ",""));
							tcBase.TEnterTime = Convert.ToDateTime(tJoinDate.Text.Replace(" ",""));
						}
						if(!teacherCheckInfo.isValidTcSex(tSex.Text.Replace(" ","")))
						{
							MessageBox.Show("教师性别不正确!");
							break;
						}
						else
							tcBase.TSex = tSex.Text.Replace(" ","");
						if(!teacherCheckInfo.isValidTcWorkPhone(tWorkPhone.Text.Replace(" ","")))
						{
							tcBase.TWorkTel = "未填写";
							MessageBox.Show("教师办公电话填写不正确,请正确填写!");
							break;
						}
						else
							tcBase.TWorkTel = tWorkPhone.Text.Replace(" ","");

						if(!teacherCheckInfo.isValidTcPhone(tPhone.Text.Replace(" ","")))
						{
							tcBase.TPhone = "未填写";
							MessageBox.Show("教师手机号码不正确!");
							break;
							
						}
						else
							tcBase.TPhone = tPhone.Text.Replace(" ","");


						tcBase.TAddr = tAddr.Text.Replace(" ","");

						if ( pictureEdit_LoadImageData.Image == null )
							imageDataBuffer = null;
						else
						{
							imageMSReader = new MemoryStream();
							pictureEdit_LoadImageData.Image.Save(imageMSReader,ImageFormat.Jpeg);
							imageDataBuffer = imageMSReader.ToArray();
						}
						tcBase.ImageData = imageDataBuffer;
						
						tcBaseSystem.InsertTcBaseInfo(tcBase);

						new UserSystem().CreateUserAccount(tcBase.TNumber,
							textEdit_UserPwd.Text);

						new UserSystem().AddUserRole(tcBase.TNumber,
							comboBoxEdit_Privilege.SelectedItem.ToString());

						MessageBox.Show("保存完毕!");
						doDataInsertLoopOnce = false;

                        dataNavigator1.Buttons.DoClick(dataNavigator1.Buttons.CancelEdit);
						//dataNavigator1.Buttons.CancelEdit.DoClick();
						//刷新绑定信息
						TextDataUnBindings();
						loadPage(new TeacherBaseSystem().SearchTcBaseInfoByCondition("","","",""));

						simpleButton_SaveButton.Enabled = false;
						simpleButton_ModifyButton.Enabled = true;
					}
				}
				catch(Exception ex)
				{
					MessageBox.Show(ex.Message);
				}
			}
		}
Example #7
0
		public int UpdateTcBaseInfo(TeacherBase tcBase)
		{
			return new TeacherBaseRule().UpdateTcBaseInfo(tcBase);
		}
Example #8
0
		public int InsertTcBaseInfo(TeacherBase tcBase)
		{
			return new TeacherBaseRule().InsertTcBaseInfo(tcBase);
		}
Example #9
0
		public void PrintTeaBaseInfo(TeacherBase tBase,string savePath)
		{
			try
			{
				m_objExcel = new Excel.Application(); 
				m_objBooks = (Excel.Workbooks)m_objExcel.Workbooks;				
				m_objBook = (Excel._Workbook)m_objBooks.Open(excelPath+@"report\TeacherBaseInfo.xls",
							m_objOpt,m_objOpt,m_objOpt,m_objOpt,m_objOpt,m_objOpt,m_objOpt,m_objOpt,m_objOpt,
							m_objOpt,m_objOpt,m_objOpt); 

				m_objSheets = (Excel.Sheets)m_objBook.Worksheets;

				//获取第一个打印页
				m_objSheet = (Excel._Worksheet)m_objSheets.get_Item(1);

				if ( NPrintPicture() )
				{
					m_objPictures = (Excel.Pictures)m_objSheet.Pictures(m_objOpt);
					m_objPictures.Insert(@"c:\temp.jpg",m_objOpt);
					m_objPicture = (Excel.Picture)m_objPictures.Item(1);

					m_objRange = m_objSheet.get_Range("H8","I15");
					m_objPicture.Left = (double)m_objRange.Left;
					m_objPicture.Top = (double)m_objRange.Top;
					m_objPicture.Width = (double)m_objRange.Width;
					m_objPicture.Height = (double)m_objRange.Height;
				}
			
				//园所名
				m_objRange = m_objSheet.get_Range("C6",m_objOpt);
				m_objRange.Value = new GardenInfoDataAccess().GetGardenInfo().Tables[0].Rows[0][1].ToString();

				//打印日期
				m_objRange = m_objSheet.get_Range("H32",m_objOpt);
				m_objRange.Value = DateTime.Now.Date.ToString("yyyy.MM.dd");

				//姓名
				m_objRange = m_objSheet.get_Range("C8",m_objOpt);
				m_objRange.Value = tBase.TName;

				//性别
				m_objRange = m_objSheet.get_Range("E8",m_objOpt);
				m_objRange.Value = tBase.TSex;

				//学历
				m_objRange = m_objSheet.get_Range("G8",m_objOpt);
				m_objRange.Value = tBase.TCareer;

				//家庭电话
				m_objRange = m_objSheet.get_Range("C12",m_objOpt);
				m_objRange.Value = tBase.THomeTel;

				//手机号码
				m_objRange = m_objSheet.get_Range("E12",m_objOpt);
				m_objRange.Value = tBase.TPhone;

				//办公电话
				m_objRange = m_objSheet.get_Range("G12",m_objOpt);
				m_objRange.Value = tBase.TWorkTel;

				//婚否
				m_objRange = m_objSheet.get_Range("C16",m_objOpt);
				m_objRange.Value = tBase.TMerrige;

				//家庭住址
				m_objRange = m_objSheet.get_Range("F16",m_objOpt);
				m_objRange.Value = tBase.TAddr;

				//所属部门
				m_objRange = m_objSheet.get_Range("C20",m_objOpt);
				m_objRange.Value = tBase.TDepart;

				//职务
				m_objRange = m_objSheet.get_Range("F20",m_objOpt);
				m_objRange.Value = tBase.TDuty;

				//职称
				m_objRange = m_objSheet.get_Range("H20",m_objOpt);
				m_objRange.Value = tBase.TTechnicalPost;

				//教师等级
				m_objRange = m_objSheet.get_Range("C24",m_objOpt);
				m_objRange.Value = tBase.TLevel;

				//参加工作时间
				m_objRange = m_objSheet.get_Range("G24",m_objOpt);
				m_objRange.Value = tBase.TWorkTime.ToString("yyyy-MM-dd");
			
				//入园时间
				m_objRange = m_objSheet.get_Range("C28",m_objOpt);
				m_objRange.Value = tBase.TEnterTime.ToString("yyyy-MM-dd");

				m_objBook.SaveAs(savePath, m_objOpt, m_objOpt,
					m_objOpt, m_objOpt, m_objOpt, Excel.XlSaveAsAccessMode.xlNoChange,
					m_objOpt, m_objOpt, m_objOpt, m_objOpt);
				m_objBook.Close(false, m_objOpt, m_objOpt);
				m_objExcel.Quit();

				System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objRange);
				System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objSheet);
				System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objSheets);
				System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objBook);
				System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objBooks);
				System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objExcel);

			}
			catch(Exception e)
			{
				Util.WriteLog(e.Message,Util.EXCEPTION_LOG_TITLE);
			}
			finally
			{
				m_objRange = null;
				m_objSheet = null;
				m_objSheets = null;
				m_objBook = null;
				m_objBooks = null;
				m_objExcel = null;

				GC.Collect();

				KillProcess();
			}
		}