/// <summary> /// 插入生产班组信息 /// </summary> /// <param name="entity"></param> public void InsertYieldGroup(ProduceTeam entity) { using (HumanResourceDataContext oContext = new HumanResourceDataContext(this.strConn)) { //entity.inputDate = DateTime.Now; oContext.ProduceTeam.InsertOnSubmit(entity); oContext.SubmitChanges(); } }
/// <summary> /// 新增生产班组 /// </summary> /// <param name="entity"></param> /// <returns></returns> public string AddYieldGroup(ProduceTeam entity) { if (oData.IsExistYieldGroup(entity.name, entity.did.Value)) { return("该生产班组已经存在!"); } oData.InsertYieldGroup(entity); return(""); }
private void btnOKYield_Click(object sender, EventArgs e) { if (this.txtYieldName.Text.Trim() == "") { CommUI.AlertError("生产班组名称不能为空!"); return; } if (this.cboDepartment.Text.Trim() == "") { CommUI.AlertError("部门不能为空!"); return; } if (this.cboEPInfo.Text.Trim() == "") { CommUI.AlertError("设备不能为空!"); return; } ProduceTeam oEntity = new ProduceTeam(); oEntity.name = this.txtYieldName.Text.Trim(); oEntity.did = long.Parse(this.cboDepartment.SelectedValue.ToString()); oEntity.count = long.Parse(this.txtPersonalCount.Text); oEntity.inputDate = DateTime.Now; oEntity.inputMan = this.UserName; oEntity.remark = this.txtYieldMemo.Text; oEntity.eiId = long.Parse(this.cboEPInfo.SelectedValue.ToString()); string strResult = new EmployeeLogic().AddYieldGroup(oEntity); if (string.IsNullOrEmpty(strResult) == false) { CommUI.AlertError(strResult); return; } this.txtYieldName.Text = ""; this.txtYieldMemo.Text = ""; this.txtPersonalCount.Text = "10"; this.BindYieldGroup(); }