protected override void BtnOK_Click(object sender, EventArgs e) { if (this.lvContent.FocusedItem == null) { CMessageBox.ShowWaring("请选择一个小区!", Config.DialogTitle); return; } this._AreaData = (Building)this.lvContent.FocusedItem.Tag; this.DialogResult = DialogResult.OK; }
private void Delete_Click(object sender, EventArgs e) { if (!this.CurrentUserInfo.Flag.Equals(0)) { return; } if (this.lvContent.FocusedItem == null) { CMessageBox.ShowWaring("请选择您要删除的信息!", Config.DialogTitle); return; } OnDelete(this.lvContent.SelectedItems); }
public bool Delete(int ID) { MySqlParameter[] parameters = { new MySqlParameter("@iID", MySqlDbType.Int32) }; parameters[0].Value = ID; try { DbHelperSQL.RunProcedure(string.Format("{0}_DeleteByID", this._TableName), parameters, out int rowsAffected); return(true); } catch (MySqlException ex) { CMessageBox.ShowWaring(string.Format("数据库操作失败,错误如下:\r\n{0}!", ex.Message), Config.DialogTitle); return(false); } }
/// <summary> /// 绑定数据到列表 /// </summary> /// <param name="selNum">数据条数</param> /// <param name="sqlWhereAndOrderBy">条件</param> protected override void BindLVData(int selNum = 0, string sqlWhereAndOrderBy = null) { this.lvContent.BeginUpdate(); this.lvContent.Items.Clear(); try { if (selNum <= 0) { selNum = this.DefaultPageSize; } if (string.IsNullOrEmpty(sqlWhereAndOrderBy) || sqlWhereAndOrderBy.Equals("")) { sqlWhereAndOrderBy = "1=1"; } this.CurrentSqlWhere = sqlWhereAndOrderBy; IList <CardLog> listData = null; IDAL.ICardLog objDAL = DALFactory.DALFactory.CardLog(); listData = objDAL.GetListByWhere(selNum, sqlWhereAndOrderBy); if (!(listData == null || listData.Count <= 0)) { foreach (CardLog model in listData) { //序号,50|刷卡时间,130|卡号,80|卡片类型,70|有效期,100|设备类型,100|设备号,100|小区编码,60|楼栋编码,60|单元编码,60|房间编码,80|卡片系列号,210|持卡者姓名,100|联系电话,100|所在房间,100|所在单元,100|所在楼栋,100|所在小区,120 ListViewItem item = new ListViewItem(new string[] { Convert.ToString(lvContent.Items.Count + 1), Functions.ConvertToNormalTime(model.CreateDate).ToString(Config.LongTimeFormat), model.CardNo.ToString(), model.CardTypeDesc, ((model.CardNo <= 0 || (model.CardType < 0 || model.CardType > 2)) ? "未知" : Functions.ConvertToNormalTime(model.ExpiryDate).ToString(Config.TimeFormat)) , model.DeviceTypeDesc, model.DeviceNo, ((model.RAreaCode >= 0) ? FormatBuildingCode(model.RAreaCode) : ""), ((model.RBuildCode >= 0) ? FormatBuildingCode(model.RBuildCode) : ""), ((model.RUnitCode >= 0) ? FormatBuildingCode(model.RUnitCode) : ""), ((model.RRoomCode >= 0) ? FormatRoomCode(model.RRoomCode) : ""), model.SerialNo, model.Contact, model.Tel, model.RoomName, model.UnitName, model.BuildName, model.AreaName }) { Tag = model, Font = new Font("宋体", 9, FontStyle.Regular) }; this.lvContent.Items.Add(item); } } } catch (Exception err) { CMessageBox.ShowWaring(err.Message, Config.DialogTitle); } this.lvContent.EndUpdate(); }
private void Edit_Click(object sender, EventArgs e) { if (!this.CurrentUserInfo.Flag.Equals(0)) { return; } if (this.lvContent.FocusedItem == null) { CMessageBox.ShowWaring("请选择您要修改的信息!", Config.DialogTitle); return; } if (this.lvContent.SelectedItems.Count > 1) { CMessageBox.ShowWaring("请选择一个您要修改的信息!", Config.DialogTitle); return; } if (this.IfFormLoadOk) { OnEdit(this.lvContent.FocusedItem); } }
protected override void BtnOK_Click(object sender, EventArgs e) { List <Model.NodeData> listSelectedData = new List <Model.NodeData>(); GetSelectedNodes(ref listSelectedData, this.tv.Nodes[0]); if (listSelectedData.Count > 0) { if (MessageBox.Show("删除后,数据将无法恢复,您确定要删除您勾选的那些数据吗?", Config.DialogTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } Model.SelecedTreeNodeData objSelecedTreeNodeData = new Model.SelecedTreeNodeData() { SelectedDataList = listSelectedData }; SetButtonEnabled(false); ThreadPool.QueueUserWorkItem(new WaitCallback(DeleteSelectedData), objSelecedTreeNodeData); } else { CMessageBox.ShowWaring("请勾选您要删除的数据!", Config.DialogTitle); } }