private void btn_New_Click(object sender, EventArgs e) { groupBox_PersonView.Enabled = true; PersonRow = null; tex_PID.ReadOnly = false; tex_Name.Text = ""; tex_PID.Text = ""; com_Sex.SelectedIndex = 0; com_Age.SelectedIndex = 0; com_Blood.SelectedIndex = 0; if (com_WorkType.Items.Count > 0) { com_WorkType.SelectedIndex = 0; } if (com_Department.Items.Count > 0) { com_Department.SelectedIndex = 0; } tex_Mobile.Text = ""; tex_Tele.Text = ""; tex_PersonKey.Text = ""; tex_BirthDay.Text = ""; tex_Email.Text = ""; tex_FamilyAdd.Text = ""; pic_Photo.Image = Resource_Service.GetImage("Person"); }
private void panel_BackImage_Paint(object sender, PaintEventArgs e) { if (IsReDraw) { for (int i = 0; i < seekDrawTable; i++) { PointF point = mapImage.Map.WorldToImage(new SharpMap.Geometries.Point(Convert.ToDouble(HistoryDrawLinesTable.Rows[i]["Geo_X"]), Convert.ToDouble(HistoryDrawLinesTable.Rows[i]["Geo_Y"]))); if (i == seekDrawTable - 1) { //最后一个点,则画小人 e.Graphics.DrawImage(Resource_Service.GetImage("Person_1"), point.X - 8, point.Y - 8); } else { //不是最后一个点,则画点 e.Graphics.DrawRectangle(new Pen(Color.Blue, 8), point.X - 3, point.Y - 3, 6, 6); } //如果有上一个点,则画直线 if (i > 0) { PointF lastpoint = mapImage.Map.WorldToImage(new SharpMap.Geometries.Point(Convert.ToDouble(HistoryDrawLinesTable.Rows[i - 1]["Geo_X"]), Convert.ToDouble(HistoryDrawLinesTable.Rows[i - 1]["Geo_Y"]))); e.Graphics.DrawLine(new Pen(Color.Black, 1), lastpoint, point); } //画序号 e.Graphics.DrawString(Convert.ToString((i + 1)), new Font("黑体", 8), Brushes.White, new PointF(point.X - 6, point.Y - 5)); //画时间 e.Graphics.DrawString(Convert.ToDateTime(HistoryDrawLinesTable.Rows[i]["Time"]).TimeOfDay.ToString(), new Font("黑体", 8, FontStyle.Bold), Brushes.BlueViolet, new PointF(point.X - 29, point.Y + 8)); } } }
private void InitBindUI(int CardID, string PID) { DataRow[] rows_Card = DB_Service.MainDataSet.Tables["CardTable"].Select("CardID = " + CardID); DataRow[] rows_Person = DB_Service.MainDataSet.Tables["PersonTable"].Select("PID = '" + PID + "'"); if (rows_Card.Length > 0 && rows_Person.Length > 0) { if (rows_Person[0]["Photo"] != null && rows_Person[0]["Photo"] != DBNull.Value) { System.IO.MemoryStream mmm = new System.IO.MemoryStream((byte[])rows_Person[0]["Photo"]); pic_Photo.Image = Image.FromStream(mmm); } else { //没有照片则加载默认的空图片 pic_Photo.Image = Resource_Service.GetImage("Person"); } tex_Name.Text = rows_Person[0]["Name"].ToString(); tex_PID.Text = rows_Person[0]["PID"].ToString(); tex_Department.Text = rows_Person[0]["Department"].ToString(); tex_WorkType.Text = rows_Person[0]["WorkType"].ToString(); tex_CardID.Text = rows_Card[0]["CardID"].ToString(); tex_CardType.Text = rows_Card[0]["CardType"].ToString(); label_UnBindPerson.Visible = false; label_UnBindCard.Visible = false; btn_BindCard.Enabled = false; btn_UnBindCard.Enabled = true; } else { MessageBox.Show("人员或者卡片不存在!", "卡片管理", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void InitViewFromPersonRow() { tex_PID.ReadOnly = true; tex_Name.Text = PersonRow["Name"].ToString(); tex_PID.Text = PersonRow["PID"].ToString(); com_Sex.Text = PersonRow["Sex"].ToString(); com_Age.Text = PersonRow["Age"].ToString(); com_Blood.Text = PersonRow["Blood"].ToString(); if (PersonRow["WorkType"].ToString() == "") { com_WorkType.SelectedIndex = -1; } else { com_WorkType.Text = PersonRow["WorkType"].ToString(); } if (PersonRow["Department"].ToString() == "") { com_Department.SelectedIndex = -1; } else { com_Department.Text = PersonRow["Department"].ToString(); } tex_Mobile.Text = PersonRow["Mobile"].ToString(); tex_Tele.Text = PersonRow["Tele"].ToString(); tex_PersonKey.Text = PersonRow["PersonKey"].ToString(); tex_BirthDay.Text = PersonRow["BirthDay"].ToString(); tex_Email.Text = PersonRow["Email"].ToString(); tex_FamilyAdd.Text = PersonRow["FamilyAdd"].ToString(); if (PersonRow["Photo"] != null && PersonRow["Photo"] != DBNull.Value) { MemoryStream mmm = new MemoryStream((byte[])PersonRow["Photo"]); pic_Photo.Image = Image.FromStream(mmm); } else { //没有照片则加载默认的空图片 pic_Photo.Image = Resource_Service.GetImage("Person"); } }
private void InitUnBindUI_PersonClick(string Name, string PID, string Department, string WorkType, object Photo) { if (Photo != null && Photo != DBNull.Value) { System.IO.MemoryStream mmm = new System.IO.MemoryStream((byte[])Photo); pic_Photo.Image = Image.FromStream(mmm); } else { //没有照片则加载默认的空图片 pic_Photo.Image = Resource_Service.GetImage("Person"); } tex_Name.Text = Name; tex_PID.Text = PID; tex_Department.Text = Department; tex_WorkType.Text = WorkType; tex_CardID.Text = ""; tex_CardType.Text = ""; label_UnBindPerson.Visible = false; label_UnBindCard.Visible = true; btn_BindCard.Enabled = true; btn_UnBindCard.Enabled = false; }