/// <summary> /// 立即同步 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { int count = 0; //获取选中的行数 for (int i = 0; i < dataGridView3.RowCount; i++) { if ((bool)dataGridView3.Rows[i].Cells[0].EditedFormattedValue) { count++; } } if (count <= 0) { MessageBox.Show("请选择人员!", "提示"); return; } if (MessageBox.Show(this, "您确定要同步么?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information).ToString() == "Yes") { ArrayList al = new ArrayList(); Bll.user user_bll = new Gunark.BLL.user(); for (int i = 0; i < dataGridView3.RowCount; i++) { al.Add(user_list[i]); if ((bool)dataGridView3.Rows[i].Cells[0].EditedFormattedValue) { Model.user user = new Model.user(); user.UNITINFO_CODE = user_list[i].unitInfo.unitInfoCode; Utils.ClassValueCopier.Copy(user, user_list[i]); if (!user_bll.Exists(dataGridView3.Rows[i].Cells[1].Value.ToString())) user_bll.Add(user); al.RemoveAt(al.Count - 1); } } user_list = (WebService.user[])al.ToArray(typeof(WebService.user)); dataGridView3.DataSource = user_list; } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Gunark.Model.user model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Gunark.Model.user model) { return(dal.Add(model)); }
/// <summary> /// 显示枪弹 /// </summary> private void Display() { /*---------------------------------------------------------------- *按照班组显示枪弹(显示验指纹的执勤民警那一组的枪弹) * 1)找到user对象 * 2)通过user对象找到组对象 * 3)查找枪、弹、组表,找出本组枪弹 * 4)显示枪、弹信息 * **----------------------------------------------------------------*/ string userid = PubFlag.policeNum; Model.user user = user_bll.GetModel(userid); List <Model.gbg> gbg_list = gbg_bll.GetModelList("GROUP_ID = '" + user.GROUP_ID + "'"); //枪的信息 this.listView1.View = View.LargeIcon; this.listView1.LargeImageList = this.imageList1; this.listView1.BeginUpdate(); for (int i = 0; i < gbg_list.Count; i++) { try { ListViewItem lvi = new ListViewItem(); string pos_num = gbg_list[i].GUN_LOCATION.ToString(); lvi.ImageIndex = 1; // 枪号找对应枪型 if (!"3".Equals(gun_position_info_bll.GetModelByGunPosNum(pos_num).GUN_POSITION_STATUS)) { continue; } lvi.Text = gbg_list[i].GUN_LOCATION + "\n" + gun_position_info_bll.GetModelByGunPosNum(pos_num).GUN_TYPE; this.listView1.Items.Add(lvi); } catch { continue; } } this.listView1.EndUpdate(); //弹的信息 this.listView2.View = View.LargeIcon; this.listView2.LargeImageList = this.imageList1; this.listView2.BeginUpdate(); for (int i = 0; i < gbg_list.Count; i++) { try { ListViewItem lvi = new ListViewItem(); lvi.ImageIndex = 3; // 弹仓号 if (gbg_list[i].BULLET_LOCATION != 0) { lvi.Text = gbg_list[i].BULLET_LOCATION.ToString() + "\n" + getBulletType(magazine_info_bll.GetModelByMagazineNum(gbg_list[i].BULLET_LOCATION.ToString()).BULLET_MODEL); } else { lvi.Text = (i + 1) + "\n" + getBulletType(magazine_info_bll.GetModelByMagazineNum((i + 1).ToString()).BULLET_MODEL); } this.listView2.Items.Add(lvi); } catch { continue; } } this.listView2.EndUpdate(); }