/// <summary> /// 编辑 /// </summary> private void Edit() { UCWorkingTimeAddOrEdit partsEdit = new UCWorkingTimeAddOrEdit(WindowStatus.Edit, tb_workhours_Model.whours_id, uc); deleteMenuByTag(this.Tag.ToString(), uc.Name); base.addUserControl(partsEdit, "工时档案-编辑", "UCWorkingTimeEdit" + tb_workhours_Model.whours_id, this.Tag.ToString(), this.Name); }
/// <summary> /// 编辑事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void UCWorkingTimeManager_EditEvent(object sender, EventArgs e) { string whoursId = string.Empty; List <string> listField = GetSelectedRecord(); if (listField.Count == 0) { MessageBoxEx.Show("请选择要复制的数据!"); return; } if (listField.Count > 1) { MessageBoxEx.Show("一次只可以复制一条数据!"); return; } whoursId = listField[0].ToString(); UCWorkingTimeAddOrEdit UCWorkingTimeEdit = new UCWorkingTimeAddOrEdit(WindowStatus.Edit, whoursId, this); base.addUserControl(UCWorkingTimeEdit, "工时档案-编辑", "UCWorkingTimeEdit" + whoursId + "", this.Tag.ToString(), this.Name); }
/// <summary> /// 编辑事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void UCWorkingTimeManager_EditEvent(object sender, EventArgs e) { string whoursId = string.Empty; List<string> listField = GetSelectedRecord(); if (listField.Count == 0) { MessageBoxEx.Show("请选择要复制的数据!"); return; } if (listField.Count > 1) { MessageBoxEx.Show("一次只可以复制一条数据!"); return; } whoursId = listField[0].ToString(); UCWorkingTimeAddOrEdit UCWorkingTimeEdit = new UCWorkingTimeAddOrEdit(WindowStatus.Edit, whoursId, this); base.addUserControl(UCWorkingTimeEdit, "工时档案-编辑", "UCWorkingTimeEdit" + whoursId + "", this.Tag.ToString(), this.Name); }
///// <summary> ///// 设置选择项后状态 ///// </summary> //void SetSelectedStatus() //{ // btnEdit.Enabled = true; // btnCopy.Enabled = true; // listIDs.Clear(); // listStart.Clear(); // listStop.Clear(); // //已选择状态列表 // List<string> listFiles = new List<string>(); // foreach (DataGridViewRow dgvr in dgvWorkList.Rows) // { // if (Convert.ToBoolean(dgvr.Cells[colCheck.Name].EditedFormattedValue)) // { // listFiles.Add(dgvr.Cells[data_source.Name].Value.ToString());//数据来源 // string wt_id = dgvr.Cells[whours_id.Name].Value.ToString(); // listIDs.Add(wt_id);//数据ID // if (dgvr.Cells[status.Name].Value == null) // { // continue; // } // enumStatus = dgvr.Cells[status.Name].Value.ToString();//状态 // //enumStatus = (DataSources.EnumStatus)Convert.ToInt32(dgvr.Cells[status.Name].Value);//状态 // if (enumStatus == DataSources.EnumStatus.Start.GetDescription()) // { // listStart.Add(wt_id); // } // else if (enumStatus == DataSources.EnumStatus.Stop.GetDescription()) // { // listStop.Add(wt_id); // } // } // } // if (listIDs.Count > 1) // { // btnEdit.Enabled = false; // btnCopy.Enabled = false; // } // #region 设置启用/停用 // if (listStart.Count > 0 && listStop.Count > 0) // { // btnStatus.Enabled = false; // } // else if (listStart.Count == 0 && listStop.Count == 0) // { // btnStatus.Enabled = false; // } // else if (listStart.Count > 0 && listStop.Count == 0) // { // btnStatus.Enabled = true; // btnStatus.Caption = "停用"; // enumStatus = DataSources.EnumStatus.Start.GetDescription(); // } // else if (listStart.Count == 0 && listStop.Count > 0) // { // btnStatus.Enabled = true; // btnStatus.Caption = "启用"; // enumStatus = DataSources.EnumStatus.Stop.GetDescription(); // } // #endregion // //宇通 // string dataSource = ((int)DataSources.EnumDataSources.YUTONG).ToString(); // if (listFiles.Count == 1 && !listFiles.Contains(dataSource)) // { // base.btnEdit.Enabled = true; // //tsmiEdit.Enabled = true; // base.btnCopy.Enabled = true; // //tsmiCopy.Enabled = true; // base.btnView.Enabled = true; // //tmsiView.Enabled = true; // } // else // { // base.btnEdit.Enabled = false; // //tsmiEdit.Enabled = false; // base.btnCopy.Enabled = false; // //tsmiCopy.Enabled = false; // if (listFiles.Count == 1) // { // base.btnView.Enabled = true; // //tmsiView.Enabled = true; // } // else // { // base.btnView.Enabled = false; // //tmsiView.Enabled = false; // } // } // //如果选择包含宇通来源,则不能删除 // if (listFiles.Count == 0 || listFiles.Contains(dataSource)) // { // btnDelete.Enabled = false; // //tsmiDelete.Enabled = false; // } // else // { // btnDelete.Enabled = true; // //tsmiDelete.Enabled = true; // } //} #endregion #region 界面按钮事件 /// <summary> /// 添加事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void UCWorkingTimeManager_AddEvent(object sender, EventArgs e) { UCWorkingTimeAddOrEdit UCWorkingTimeAdd = new UCWorkingTimeAddOrEdit(WindowStatus.Add, null, this); base.addUserControl(UCWorkingTimeAdd, "工时档案-添加", "UCWorkingTimeAdd", this.Tag.ToString(), this.Name); }