/// <summary> /// 数据保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { if (this.ValidataBillState()) { string strInfo = ""; bool isValidate = this.ValidatePageControlValue(out strInfo); if (isValidate) { BCheckBillBB checkBillBB = new BCheckBillBB(); BCheckBillBC checkBillBC = new BCheckBillBC(); try { BCheckBillData model = new BCheckBillData(); List<BCheckDetailData> listDetail = this.SetDetailApplyBillModel(); if (this.State == "1") { this.SetModel(ref model); model.checkBillNo = ""; model.isrtDt = DateTime.Now.ToString(); model.isrtEmpId = this.currentUser.empId; } else if (this.State == "2") { model = checkBillBB.GetModel(this.IdValue); this.SetModel(ref model); model.updtDt = DateTime.Now.ToString(); model.updtEmpId = this.currentUser.empId; } //保存检测单数据 checkBillBC.SavelData(model, listDetail, isReNew); Response.Write("<script laguage=\"javascript\">alert('保存成功,请及时提交检测单!');</script>");// "alert", "alert('订单保存成功,请及时提交订单!!');", true); Response.Redirect("BCheckBillList.aspx?&itemno=" + this.itemNo + "&pTypeNo=main", false); Response.Flush(); //this.IdValue = model.id; //this.State = "2"; //this.ShowInfo(this.IdValue); //this.DtResult = null; //this.BindDetailTable("old"); return; } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { checkBillBB.Dispose(); checkBillBC.Dispose(); //Response.Redirect("BCheckBillList.aspx?&itemno=" + this.itemNo + "&pTypeNo=main", false); } } else { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + strInfo + "');", true); } } }
/// <summary> /// 提交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { bool retChecked = false; BCheckBillBB checkBillBB = new BCheckBillBB(); BCheckBillBC checkBillBC = new BCheckBillBC(); try { //获取选中的数据Id foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { retChecked = true; int id = int.Parse(chkId.ValidationGroup); BCheckBillData model = checkBillBB.GetModel(id); if (model.instantState == "01")//判断检测单是否已经提交,已经提交不允许提交 { //状态置为提交 model.commitDt = DateTime.Now.ToString(); model.commitEmpId = this.currentUser.empId; model.instantState = "02"; checkBillBC.CommitData(model); this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"提交成功!\");", true); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"检测单已经提交!\");", true); return; } } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { checkBillBB.Dispose(); checkBillBC.Dispose(); } if (retChecked) { this.BindGrid(); } }