private NCPEP.Model.T_XmBeian GetModels(HttpContext context) { //Bid model = new Bid(); NCPEP.Model.T_XmBeian model = new NCPEP.Model.T_XmBeian(); try { model.id = int.Parse(context.Request.Form["Id"].ToString()); } catch { } NCPEP.Bll.T_XmBeian bll = new NCPEP.Bll.T_XmBeian(); model = bll.GetModel(int.Parse(context.Request.Form["Id"].ToString())); model.beizhu = context.Request.Form["beizhu"]; model.changjiaozongjia = context.Request.Form["zongjia"]; model.chengjiaodanjia = context.Request.Form["danjia"]; model.churangfang = context.Request.Form["crf"]; model.churangfangxingzhi = context.Request.Form["crfxz"]; model.cqleixing = context.Request.Form["Properties"]; model.cqname = context.Request.Form["BidName"]; model.cqquanshu = context.Request.Form["Ownership"]; model.danwei = context.Request.Form["gmdw"]; model.guimo = context.Request.Form["guimo"]; try { model.hetongjsrq = Convert.ToDateTime(DateTime.Parse(context.Request.Form["EndDate"].ToString()).ToString("yyyy年MM月dd日")); } catch { } try { model.hetongksrq = Convert.ToDateTime(DateTime.Parse(context.Request.Form["StartDate"].ToString()).ToString("yyyy年MM月dd日")); } catch { } model.jiaoyifangshi = context.Request.Form["StandardMode"]; model.shourangfang = context.Request.Form["srf"]; model.shourangfangxingzhi = context.Request.Form["srfxz"]; model.zhifufangshi = context.Request.Form["zffs"]; model.orgcode = context.Request.Form["OrgCode"]; return(model); }
private string Create(HttpContext context) { try { SysLogBll.Create("项目备案添加", "项目备案添加", adminUser.AdminName); NCPEP.Bll.T_XmBeian bll = new NCPEP.Bll.T_XmBeian(); NCPEP.Model.T_XmBeian model = new NCPEP.Model.T_XmBeian(); model.beiyong = "1";//审核状态 model.beiyongb = ""; model.beizhu = context.Request.Form["beizhu"]; model.changjiaozongjia = context.Request.Form["zongjia"]; model.chengjiaodanjia = context.Request.Form["danjia"]; model.churangfang = context.Request.Form["crf"]; model.churangfangxingzhi = context.Request.Form["crfxz"]; model.cqleixing = context.Request.Form["Properties"]; model.cqname = context.Request.Form["BidName"]; model.cqquanshu = context.Request.Form["Ownership"]; model.danwei = context.Request.Form["gmdw"]; model.guimo = context.Request.Form["guimo"]; try { model.hetongjsrq = Convert.ToDateTime(DateTime.Parse(context.Request.Form["EndDate"].ToString()).ToString("yyyy年MM月dd日")); } catch { } try { model.hetongksrq = Convert.ToDateTime(DateTime.Parse(context.Request.Form["StartDate"].ToString()).ToString("yyyy年MM月dd日")); } catch { } model.jiaoyifangshi = context.Request.Form["StandardMode"]; model.shourangfang = context.Request.Form["srf"]; model.shourangfangxingzhi = context.Request.Form["srfxz"]; model.zhifufangshi = context.Request.Form["zffs"]; model.orgcode = context.Request.Form["OrgCode"]; //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 "); } }
private string Shenhe(HttpContext context) { NCPEP.Bll.T_XmBeian bll = new NCPEP.Bll.T_XmBeian(); NCPEP.Model.T_XmBeian model = new NCPEP.Model.T_XmBeian(); string id = context.Request.QueryString["BidId"]; model = bll.GetModel(int.Parse(id)); model.beiyong = "2"; if (bll.Update(model)) { return("审核上报成功"); } else { return("审核上报失败"); } }
private NCPEP.Model.T_XmBeian GetById(HttpContext context) { try { SysLogBll.Create("项目备案", "项目备案信息修改", adminUser.AdminName); int id = 0; try { id = int.Parse(context.Request.QueryString["Id"]); } catch { } NCPEP.Model.T_XmBeian model = new NCPEP.Model.T_XmBeian(); NCPEP.Bll.T_XmBeian bll = new NCPEP.Bll.T_XmBeian(); model = bll.GetModel(id); return(model); } catch (Exception ex) { SystemErrorPlug.ErrorRecord("时间:[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]类名:[" + this.GetType().Name + "],行号:[" + Component.GetLineNum().ToString() + "行],错误信息:[" + ex.Message + "]"); return(null); } }
private string Update(HttpContext context) { try { SysLogBll.Create("项目备案", "更新项目备案信息", adminUser.AdminName); NCPEP.Model.T_XmBeian dModels = GetModels(context); NCPEP.Bll.T_XmBeian bll = new NCPEP.Bll.T_XmBeian(); if (bll.Update(dModels)) { 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 "); } }
/// <summary> /// 得到一个对象实体 /// </summary> public NCPEP.Model.T_XmBeian GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,cqname,orgcode,cqleixing,guimo,danwei,cqquanshu,churangfang,churangfangxingzhi,shourangfang,shourangfangxingzhi,jiaoyifangshi,hetongksrq,hetongjsrq,chengjiaodanjia,changjiaozongjia,zhifufangshi,beizhu,beiyong,beiyongb from T_XmBeian "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; NCPEP.Model.T_XmBeian model = new NCPEP.Model.T_XmBeian(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(NCPEP.Model.T_XmBeian model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(NCPEP.Model.T_XmBeian model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(NCPEP.Model.T_XmBeian model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update T_XmBeian set "); strSql.Append("cqname=@cqname,"); strSql.Append("orgcode=@orgcode,"); strSql.Append("cqleixing=@cqleixing,"); strSql.Append("guimo=@guimo,"); strSql.Append("danwei=@danwei,"); strSql.Append("cqquanshu=@cqquanshu,"); strSql.Append("churangfang=@churangfang,"); strSql.Append("churangfangxingzhi=@churangfangxingzhi,"); strSql.Append("shourangfang=@shourangfang,"); strSql.Append("shourangfangxingzhi=@shourangfangxingzhi,"); strSql.Append("jiaoyifangshi=@jiaoyifangshi,"); strSql.Append("hetongksrq=@hetongksrq,"); strSql.Append("hetongjsrq=@hetongjsrq,"); strSql.Append("chengjiaodanjia=@chengjiaodanjia,"); strSql.Append("changjiaozongjia=@changjiaozongjia,"); strSql.Append("zhifufangshi=@zhifufangshi,"); strSql.Append("beizhu=@beizhu,"); strSql.Append("beiyong=@beiyong,"); strSql.Append("beiyongb=@beiyongb"); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@cqname", SqlDbType.VarChar, 150), new SqlParameter("@orgcode", SqlDbType.VarChar, 50), new SqlParameter("@cqleixing", SqlDbType.VarChar, 50), new SqlParameter("@guimo", SqlDbType.VarChar, 50), new SqlParameter("@danwei", SqlDbType.VarChar, 50), new SqlParameter("@cqquanshu", SqlDbType.VarChar, 50), new SqlParameter("@churangfang", SqlDbType.VarChar, 50), new SqlParameter("@churangfangxingzhi", SqlDbType.VarChar, 50), new SqlParameter("@shourangfang", SqlDbType.VarChar, 50), new SqlParameter("@shourangfangxingzhi", SqlDbType.VarChar, 50), new SqlParameter("@jiaoyifangshi", SqlDbType.VarChar, 50), new SqlParameter("@hetongksrq", SqlDbType.DateTime), new SqlParameter("@hetongjsrq", SqlDbType.DateTime), new SqlParameter("@chengjiaodanjia", SqlDbType.VarChar, 50), new SqlParameter("@changjiaozongjia", SqlDbType.NVarChar, 50), new SqlParameter("@zhifufangshi", SqlDbType.VarChar, 50), new SqlParameter("@beizhu", SqlDbType.VarChar, 50), new SqlParameter("@beiyong", SqlDbType.VarChar, 50), new SqlParameter("@beiyongb", SqlDbType.NVarChar, 50), new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = model.cqname; parameters[1].Value = model.orgcode; parameters[2].Value = model.cqleixing; parameters[3].Value = model.guimo; parameters[4].Value = model.danwei; parameters[5].Value = model.cqquanshu; parameters[6].Value = model.churangfang; parameters[7].Value = model.churangfangxingzhi; parameters[8].Value = model.shourangfang; parameters[9].Value = model.shourangfangxingzhi; parameters[10].Value = model.jiaoyifangshi; parameters[11].Value = model.hetongksrq; parameters[12].Value = model.hetongjsrq; parameters[13].Value = model.chengjiaodanjia; parameters[14].Value = model.changjiaozongjia; parameters[15].Value = model.zhifufangshi; parameters[16].Value = model.beizhu; parameters[17].Value = model.beiyong; parameters[18].Value = model.beiyongb; parameters[19].Value = model.id; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public NCPEP.Model.T_XmBeian DataRowToModel(DataRow row) { NCPEP.Model.T_XmBeian model = new NCPEP.Model.T_XmBeian(); if (row != null) { if (row["id"] != null && row["id"].ToString() != "") { model.id = int.Parse(row["id"].ToString()); } if (row["cqname"] != null) { model.cqname = row["cqname"].ToString(); } if (row["orgcode"] != null) { model.orgcode = row["orgcode"].ToString(); } if (row["cqleixing"] != null) { model.cqleixing = row["cqleixing"].ToString(); } if (row["guimo"] != null) { model.guimo = row["guimo"].ToString(); } if (row["danwei"] != null) { model.danwei = row["danwei"].ToString(); } if (row["cqquanshu"] != null) { model.cqquanshu = row["cqquanshu"].ToString(); } if (row["churangfang"] != null) { model.churangfang = row["churangfang"].ToString(); } if (row["churangfangxingzhi"] != null) { model.churangfangxingzhi = row["churangfangxingzhi"].ToString(); } if (row["shourangfang"] != null) { model.shourangfang = row["shourangfang"].ToString(); } if (row["shourangfangxingzhi"] != null) { model.shourangfangxingzhi = row["shourangfangxingzhi"].ToString(); } if (row["jiaoyifangshi"] != null) { model.jiaoyifangshi = row["jiaoyifangshi"].ToString(); } if (row["hetongksrq"] != null && row["hetongksrq"].ToString() != "") { model.hetongksrq = DateTime.Parse(row["hetongksrq"].ToString()); } if (row["hetongjsrq"] != null && row["hetongjsrq"].ToString() != "") { model.hetongjsrq = DateTime.Parse(row["hetongjsrq"].ToString()); } if (row["chengjiaodanjia"] != null) { model.chengjiaodanjia = row["chengjiaodanjia"].ToString(); } if (row["changjiaozongjia"] != null) { model.changjiaozongjia = row["changjiaozongjia"].ToString(); } if (row["zhifufangshi"] != null) { model.zhifufangshi = row["zhifufangshi"].ToString(); } if (row["beizhu"] != null) { model.beizhu = row["beizhu"].ToString(); } if (row["beiyong"] != null) { model.beiyong = row["beiyong"].ToString(); } if (row["beiyongb"] != null) { model.beiyongb = row["beiyongb"].ToString(); } } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(NCPEP.Model.T_XmBeian model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into T_XmBeian("); strSql.Append("cqname,orgcode,cqleixing,guimo,danwei,cqquanshu,churangfang,churangfangxingzhi,shourangfang,shourangfangxingzhi,jiaoyifangshi,hetongksrq,hetongjsrq,chengjiaodanjia,changjiaozongjia,zhifufangshi,beizhu,beiyong,beiyongb)"); strSql.Append(" values ("); strSql.Append("@cqname,@orgcode,@cqleixing,@guimo,@danwei,@cqquanshu,@churangfang,@churangfangxingzhi,@shourangfang,@shourangfangxingzhi,@jiaoyifangshi,@hetongksrq,@hetongjsrq,@chengjiaodanjia,@changjiaozongjia,@zhifufangshi,@beizhu,@beiyong,@beiyongb)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@cqname", SqlDbType.VarChar, 150), new SqlParameter("@orgcode", SqlDbType.VarChar, 50), new SqlParameter("@cqleixing", SqlDbType.VarChar, 50), new SqlParameter("@guimo", SqlDbType.VarChar, 50), new SqlParameter("@danwei", SqlDbType.VarChar, 50), new SqlParameter("@cqquanshu", SqlDbType.VarChar, 50), new SqlParameter("@churangfang", SqlDbType.VarChar, 50), new SqlParameter("@churangfangxingzhi", SqlDbType.VarChar, 50), new SqlParameter("@shourangfang", SqlDbType.VarChar, 50), new SqlParameter("@shourangfangxingzhi", SqlDbType.VarChar, 50), new SqlParameter("@jiaoyifangshi", SqlDbType.VarChar, 50), new SqlParameter("@hetongksrq", SqlDbType.DateTime), new SqlParameter("@hetongjsrq", SqlDbType.DateTime), new SqlParameter("@chengjiaodanjia", SqlDbType.VarChar, 50), new SqlParameter("@changjiaozongjia", SqlDbType.NVarChar, 50), new SqlParameter("@zhifufangshi", SqlDbType.VarChar, 50), new SqlParameter("@beizhu", SqlDbType.VarChar, 50), new SqlParameter("@beiyong", SqlDbType.VarChar, 50), new SqlParameter("@beiyongb", SqlDbType.NVarChar, 50) }; parameters[0].Value = model.cqname; parameters[1].Value = model.orgcode; parameters[2].Value = model.cqleixing; parameters[3].Value = model.guimo; parameters[4].Value = model.danwei; parameters[5].Value = model.cqquanshu; parameters[6].Value = model.churangfang; parameters[7].Value = model.churangfangxingzhi; parameters[8].Value = model.shourangfang; parameters[9].Value = model.shourangfangxingzhi; parameters[10].Value = model.jiaoyifangshi; parameters[11].Value = model.hetongksrq; parameters[12].Value = model.hetongjsrq; parameters[13].Value = model.chengjiaodanjia; parameters[14].Value = model.changjiaozongjia; parameters[15].Value = model.zhifufangshi; parameters[16].Value = model.beizhu; parameters[17].Value = model.beiyong; parameters[18].Value = model.beiyongb; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }