/// <summary> /// 增加一条数据 /// </summary> public int Add(NCPEP.Model.T_IndicatorsRelations model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into T_IndicatorsRelations("); strSql.Append("ApplicationType,FK_MemberTypeCertificationId,FK_TypeIndicatorNameId,Editor,CreateDate)"); strSql.Append(" values ("); strSql.Append("@ApplicationType,@FK_MemberTypeCertificationId,@FK_TypeIndicatorNameId,@Editor,@CreateDate)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@ApplicationType", SqlDbType.Int, 4), new SqlParameter("@FK_MemberTypeCertificationId", SqlDbType.Int, 4), new SqlParameter("@FK_TypeIndicatorNameId", SqlDbType.Int, 4), new SqlParameter("@Editor", SqlDbType.NVarChar, 50), new SqlParameter("@CreateDate", SqlDbType.DateTime) }; parameters[0].Value = model.ApplicationType; parameters[1].Value = model.FK_MemberTypeCertificationId; parameters[2].Value = model.FK_TypeIndicatorNameId; parameters[3].Value = model.Editor; parameters[4].Value = model.CreateDate; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public NCPEP.Model.T_IndicatorsRelations DataRowToModel(DataRow row) { NCPEP.Model.T_IndicatorsRelations model = new NCPEP.Model.T_IndicatorsRelations(); if (row != null) { if (row["Id"] != null && row["Id"].ToString() != "") { model.Id = int.Parse(row["Id"].ToString()); } if (row["ApplicationType"] != null && row["ApplicationType"].ToString() != "") { model.ApplicationType = int.Parse(row["ApplicationType"].ToString()); } if (row["FK_MemberTypeCertificationId"] != null && row["FK_MemberTypeCertificationId"].ToString() != "") { model.FK_MemberTypeCertificationId = int.Parse(row["FK_MemberTypeCertificationId"].ToString()); } if (row["FK_TypeIndicatorNameId"] != null && row["FK_TypeIndicatorNameId"].ToString() != "") { model.FK_TypeIndicatorNameId = int.Parse(row["FK_TypeIndicatorNameId"].ToString()); } if (row["Editor"] != null) { model.Editor = row["Editor"].ToString(); } if (row["CreateDate"] != null && row["CreateDate"].ToString() != "") { model.CreateDate = DateTime.Parse(row["CreateDate"].ToString()); } } return(model); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strid = Request.QueryString["p"]; NCPEP.Bll.T_Bid bllbid = new NCPEP.Bll.T_Bid(); NCPEP.Model.T_Bid modelbid = new NCPEP.Model.T_Bid(); modelbid = bllbid.GetModel(int.Parse(strid)); if (modelbid != null) { NCPEP.Bll.T_LiceTran bllli = new NCPEP.Bll.T_LiceTran(); NCPEP.Model.T_LiceTran modelli = new NCPEP.Model.T_LiceTran(); modelli = bllli.GetModel(modelbid.FK_LiceTranId); if (modelli != null) { NCPEP.Bll.T_IndicatorsRelations bllin = new NCPEP.Bll.T_IndicatorsRelations(); NCPEP.Model.T_IndicatorsRelations modelin = new NCPEP.Model.T_IndicatorsRelations(); DataTable dt = bllin.GetList(" FK_MemberTypeCertificationId='" + modelli.MemberTypeId + "' and ApplicationType='3'").Tables[0];//出让方申请对应关系 string strids = ""; foreach (DataRow dr in dt.Rows) { strids += dr["FK_TypeIndicatorNameId"].ToString() + ","; } strids = strids.Trim().TrimEnd(','); NCPEP.Bll.T_UploadTypeIndicator bllup = new NCPEP.Bll.T_UploadTypeIndicator(); DataTable ddldt = new DataTable(); if (string.IsNullOrEmpty(strids)) { MessageBox.Show(this, "没有对应的指标关系,请先设置对应的指标关系再进行上传!"); return; } ddldt = bllup.GetList(" id in(" + strids + ")").Tables[0]; if (ddldt.Rows.Count > 0) { this.txtFK_UploadTypeIndicatorId.DataSource = ddldt; this.txtFK_UploadTypeIndicatorId.DataTextField = "TypeIndicatorName"; this.txtFK_UploadTypeIndicatorId.DataValueField = "id"; this.txtFK_UploadTypeIndicatorId.DataBind(); } } } BindFujian(strid); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(NCPEP.Model.T_IndicatorsRelations model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update T_IndicatorsRelations set "); strSql.Append("ApplicationType=@ApplicationType,"); strSql.Append("FK_MemberTypeCertificationId=@FK_MemberTypeCertificationId,"); strSql.Append("FK_TypeIndicatorNameId=@FK_TypeIndicatorNameId,"); strSql.Append("Editor=@Editor,"); strSql.Append("CreateDate=@CreateDate"); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@ApplicationType", SqlDbType.Int, 4), new SqlParameter("@FK_MemberTypeCertificationId", SqlDbType.Int, 4), new SqlParameter("@FK_TypeIndicatorNameId", SqlDbType.Int, 4), new SqlParameter("@Editor", SqlDbType.NVarChar, 50), new SqlParameter("@CreateDate", SqlDbType.DateTime), new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = model.ApplicationType; parameters[1].Value = model.FK_MemberTypeCertificationId; parameters[2].Value = model.FK_TypeIndicatorNameId; parameters[3].Value = model.Editor; parameters[4].Value = model.CreateDate; parameters[5].Value = model.Id; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public NCPEP.Model.T_IndicatorsRelations GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 Id,ApplicationType,FK_MemberTypeCertificationId,FK_TypeIndicatorNameId,Editor,CreateDate from T_IndicatorsRelations "); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = Id; NCPEP.Model.T_IndicatorsRelations model = new NCPEP.Model.T_IndicatorsRelations(); 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_IndicatorsRelations model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(NCPEP.Model.T_IndicatorsRelations model) { return(dal.Add(model)); }