/// <summary> /// 删除(&D)员工信息按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnResign_Click(object sender, EventArgs e) { if (fExtendedEditMode) { if (editOrderlayoutView.Columns.Count < 0) { XtraMessageBox.Show("请选择要修改(&U)的员工信息!"); return; } paramID = editOrderlayoutView.GetFocusedRowCellValue(gcID).ToString(); } else { paramID = gvEmployeeMain.GetFocusedRowCellValue(gcID).ToString(); } try { DialogResult tempDialogResult = XtraMessageBox.Show("编号为" + paramID + "的数据", "确定开除?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DialogResult.Yes == tempDialogResult) { EnOperatorStatus = myBUCMS_Employee.Delete(paramID); if (ClassAssist.CommonOperator.HandleOperatorEnum("员工信息开除", EnOperatorStatus)) { BUT_SysLog.InsertSysLog(VariedEnum.LogType.数据操作, frmAssist.frmLogin.SysUser.UserID, "成功开除了员工信息"); BindGvEmployee(); } } } catch (Exception ex) { throw ex; } }
/// <summary> /// 保存库存表数据 /// </summary> private void SaveStock() { myDataTable = myBUCMS_Stock.GetOrder(false, string.Empty, string.Empty, false); try { for (int j = 0; j < this.gvAddInGoods.RowCount; j++) { for (int i = 0; i < myDataTable.Rows.Count; i++) { if (this.gvAddInGoods.GetDataRow(j)["GetName"].ToString() == myDataTable.Rows[i]["Name"].ToString()) { myModelCMS_Stock.Name = this.gvAddInGoods.GetDataRow(j)["GetName"].ToString(); myModelCMS_Stock.Specifications = this.gvAddInGoods.GetDataRow(j)["GetSpecifications"].ToString(); myModelCMS_Stock.Price = Convert.ToDecimal(this.gvAddInGoods.GetDataRow(j)["GetPrice"].ToString()); myModelCMS_Stock.Total = Convert.ToDecimal(this.gvAddInGoods.GetDataRow(j)["GetTotal"].ToString()); myModelCMS_Stock.Number = Convert.ToInt32(myDataTable.Rows[i]["Number"]) + Convert.ToInt32(this.gvAddInGoods.GetDataRow(j)["GetNumber"]); myModelCMS_Stock.Supplier = this.cmbSupplier.Text.Trim(); myModelCMS_Stock.InfoNote = this.txtInfoNote.Text.Trim(); EnOperatorStatus = myBUCMS_Stock.Update(myModelCMS_Stock); } } } } catch (Exception ex) { XtraMessageBox.Show(ex.ToString()); } }
/// <summary> /// Saves the payments detail. /// </summary> /// 整理人:桂书丛 /// 整理时间:2013-02-04 private void SavePaymentsDetail() { myDataTable = myBUCMS_PaymentsDetail.GetOrder(false, string.Empty, string.Empty, false); for (int i = 0; i < this.gvAddInGoods.RowCount; i++) { myModelCMS_PaymentsDetail.HandlesPeopleID = Convert.ToInt32(this.txtEmpName.EditValue); myModelCMS_PaymentsDetail.Amount = Convert.ToDecimal(this.gvAddInGoods.GetDataRow(i)["GetTotal"].ToString()); myModelCMS_PaymentsDetail.InfoNote = this.txtInfoNote.Text.Trim(); EnOperatorStatus = myBUCMS_PaymentsDetail.Insert(myModelCMS_PaymentsDetail); } }
/// <summary> /// 保存入库表数据 /// </summary> /// 整理人:桂书丛 /// 整理时间:2013-02-01 private void SaveInGoods() { myDataTable = myBUCMS_InGoods.GetOrder(false, "SerialNumber", StockID, false); if (myDataTable.Rows.Count == 0) { try { if (this.txtEmpName.Text.Trim() == "") { XtraMessageBox.Show("请输入接收人信息!"); return; } SaveStock(); SavePaymentsDetail(); for (int i = 0; i < this.gvAddInGoods.RowCount; i++) { myModelCMS_InGoods.SerialNumber = this.labSerialNumber.Text.Trim(); myModelCMS_InGoods.Name = this.gvAddInGoods.GetDataRow(i)["GetName"].ToString(); myModelCMS_InGoods.Specifications = this.gvAddInGoods.GetDataRow(i)["GetSpecifications"].ToString(); myModelCMS_InGoods.Number = Convert.ToInt32(this.gvAddInGoods.GetDataRow(i)["GetNumber"].ToString()); myModelCMS_InGoods.Price = Convert.ToDecimal(this.gvAddInGoods.GetDataRow(i)["GetPrice"].ToString()); myModelCMS_InGoods.Total = Convert.ToDecimal(this.gvAddInGoods.GetDataRow(i)["GetTotal"].ToString()); myModelCMS_InGoods.Supplier = this.cmbSupplier.Text.Trim(); myModelCMS_InGoods.InDate = Convert.ToDateTime(this.txtInDate.Text.Trim()); myModelCMS_InGoods.HandlesPeopleID = Convert.ToInt32(this.txtEmpName.EditValue.ToString()); myModelCMS_InGoods.InfoNote = this.txtInfoNote.Text.Trim(); EnOperatorStatus = myBUCMS_InGoods.Insert(myModelCMS_InGoods); } if (ClassAssist.CommonOperator.HandleOperatorEnum("商品信息添加", EnOperatorStatus)) { BUT_SysLog.InsertSysLog(VariedEnum.LogType.数据操作, frmAssist.frmLogin.SysUser.UserID, "成功添加了一批货单编号为" + myModelCMS_InGoods.SerialNumber + "商品信息"); this.Close(); //GetRandomBillID(); //ClearText(); } } catch (Exception ex) { XtraMessageBox.Show(ex.ToString()); } } else { XtraMessageBox.Show("该流水号已存在,在单击确定之后系统将自动生成新的流水号!"); GetRandomBillID(); } }
/// <summary> /// 将获得的员工信息添加到数据库中 /// </summary> private void SaveEmployee(ModelCMS_Employee myModelCMS_Employee) { myDataTable = myBUCMS_Employee.GetOrder(false, string.Empty, string.Empty, false); try { foreach (DataRow myDataRow in myDataTable.Rows) { if (myDataRow["IDCardNum"].ToString() == myModelCMS_Employee.IDCardNum) { XtraMessageBox.Show("员工姓名已存在,请从新输入!"); this.txtName.Text = ""; this.txtName.Focus(); this.txtName.SelectAll(); return; } if (myDataRow["IDCardNum"].ToString() == myModelCMS_Employee.IDCardNum) { XtraMessageBox.Show("该员工的身份证号已存在,请从新输入!"); this.txtIDCardNum.Text = ""; this.txtIDCardNum.Focus(); this.txtIDCardNum.SelectAll(); return; } if (myDataRow["TelPhone"].ToString() == myModelCMS_Employee.TelPhone) { XtraMessageBox.Show("输入的电话号码已存在,请从新输入!"); this.txtTelPhone.Text = ""; this.txtTelPhone.Focus(); this.txtTelPhone.SelectAll(); return; } } EnOperatorStatus = myBUCMS_Employee.Insert(myModelCMS_Employee); if (ClassAssist.CommonOperator.HandleOperatorEnum("员工信息添加", EnOperatorStatus)) { ClearText(); frmAddEmployee_Load(null, null); BUT_SysLog.InsertSysLog(VariedEnum.LogType.数据操作, frmAssist.frmLogin.SysUser.UserID, "成功添加了员工信息"); //this.DialogResult = DialogResult.OK; } } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } }
/// <summary> /// 处理操作枚举:paramOperator:操作类型,paramOperatorStatus:操作状态公用枚举实例 /// </summary> /// <param name="paramOperator">操作类型</param> /// <param name="paramOperatorStatus">操作状态公用枚举</param> /// <returns></returns> public static bool HandleOperatorEnum(string paramOperator, VariedEnum.OperatorStatus paramOperatorStatus) { switch (paramOperatorStatus) { case VariedEnum.OperatorStatus.Successed: XtraMessageBox.Show(paramOperator + "成功", "恭喜"); return(true); case VariedEnum.OperatorStatus.Failed: XtraMessageBox.Show(paramOperator + "失败", "抱歉", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); default: XtraMessageBox.Show(paramOperator + "失败,请查明后再试", "抱歉", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } }
private void btnUpdate_Click(object sender, EventArgs e) { try { myModelCMS_DishServer = BindModel(); DialogResult tempDialogResult = XtraMessageBox.Show("编号为" + paramEmployeeID + "员工业绩数据的数据", "确定修改(&U)?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DialogResult.Yes == tempDialogResult) { EnOperatorStatus = myBUCMS_DishServer.Update(myModelCMS_DishServer); if (ClassAssist.CommonOperator.HandleOperatorEnum("员工提成信息修改(&U)成功", EnOperatorStatus)) { BUT_SysLog.InsertSysLog(VariedEnum.LogType.数据操作, frmAssist.frmLogin.SysUser.UserID, "成功修改(&U)了员工提成信息"); BindLvPerformance(); } } } catch (Exception ex) { throw ex; } }
/// <summary> /// 修改员工信息 /// </summary> private void UpdateEmployee(ModelCMS_Employee myModelCMS_Employee) { myDataTable = myBUCMS_Employee.GetOrder(false, string.Empty, string.Empty, false); try { #region //foreach (DataRow myDataRow in myDataTable.Rows) //{ // if (myDataRow["IDCardNum"].ToString() == myModelCMS_Employee.IDCardNum) // { // XtraMessageBox.Show("该员工的身份证号已存在,请从新输入!"); // this.txtIDCardNum.Text = ""; // this.txtIDCardNum.Focus(); // this.txtIDCardNum.SelectAll(); // return; // } // if (myDataRow["TelPhone"].ToString() == myModelCMS_Employee.TelPhone) // { // XtraMessageBox.Show("输入的电话号码已存在,请从新输入!"); // this.txtTelPhone.Text = ""; // this.txtTelPhone.Focus(); // this.txtTelPhone.SelectAll(); // return; // } //} #endregion EnOperatorStatus = myBUCMS_Employee.Update(myModelCMS_Employee); if (ClassAssist.CommonOperator.HandleOperatorEnum("员工信息修改", EnOperatorStatus)) { BUT_SysLog.InsertSysLog(VariedEnum.LogType.数据操作, frmAssist.frmLogin.SysUser.UserID, "成功修改了员工信息"); this.DialogResult = DialogResult.OK; } } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } }