protected void btnadd_Click(object sender, EventArgs e) { SysLogBll.Create("检证书修改", "检证书修改", adminUser.AdminName); NCPEP.Bll.T_Jzs bll = new NCPEP.Bll.T_Jzs(); NCPEP.Model.T_Jzs model = new NCPEP.Model.T_Jzs(); DataTable dt = bll.GetList(" binid='" + Request.QueryString["p"] + "'").Tables[0]; if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { bll.Delete(int.Parse(dr["id"].ToString())); } } try { model.beizhu = this.txtbeizhu.Value; } catch { } try { model.binid = Request.QueryString["p"].ToString(); } catch { } model.cjje = this.txtcjje.Value; model.htbh = this.txthtbh.Value; model.zcdate = this.txtStartDatejzs.Value; model.zcdatez = this.txtEndDatejzs.Value; model.beiyong = this.txtbeizhu.Value.Trim(); //int id = (int)dal.Create(GetModels(context)); int id = bll.Add(model); if (id > 0) { MessageBox.Show(this, "更新成功!"); } else { MessageBox.Show(this, "更新失败!"); } }
private string Create(HttpContext context) { try { SysLogBll.Create("检证书修改", "检证书修改", adminUser.AdminName); NCPEP.Bll.T_Jzs bll = new NCPEP.Bll.T_Jzs(); NCPEP.Model.T_Jzs model = new NCPEP.Model.T_Jzs(); try { model.beizhu = context.Request.Form["beizhu"].ToString(); } catch { } try { model.binid = context.Request.Form["Id"].ToString(); } catch { } model.cjje = context.Request.Form["cjje"].ToString(); model.htbh = context.Request.Form["htbh"].ToString(); model.zcdate = context.Request.Form["jzsStartDate"].ToString(); model.zcdatez = context.Request.Form["jzsEndDate"].ToString(); //int id = (int)dal.Create(GetModels(context)); int id = bll.Add(model); if (id > 0) { return("添加成功!"); } else { return("添加失败请重新操作! "); } } catch (Exception ex) { SystemErrorPlug.ErrorRecord("时间:[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]类名:[" + this.GetType().Name + "],行号:[" + Component.GetLineNum().ToString() + "行],错误信息:[" + ex.Message + "]"); return("添加失败请重新操作,错误代码:500 "); } }