/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.CoreEnvelopeDesign model) { StringBuilder strBuilder = new StringBuilder(); strBuilder.Append("update T_CoreEnvelopeDesignData set "); strBuilder.Append("Id=" + model.Id + ","); strBuilder.Append("DesignData_Name='" + model.DesignData_Name + "',"); strBuilder.Append("DesignData_Submitter='" + model.DesignData_Submitter + "',"); strBuilder.Append("Helicopter_Name='" + model.Helicopter_Name + "',"); strBuilder.Append("DataRemark='" + model.DataRemark + "',"); strBuilder.Append("LastModify_Time='" + model.LastModify_Time + "',"); strBuilder.Append("DesignTaking_Weight=" + model.DesignTaking_Weight + ","); strBuilder.Append("CoreEnvelope='" + model.CoreEnvelope + "'"); strBuilder.Append(" where Id=" + model.Id.ToString()); int rows = SQLiteDBHelper.ExecuteNonQuery(strBuilder.ToString(), null); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.CoreEnvelopeDesign model) { StringBuilder strBuilder = new StringBuilder(); strBuilder.Append("insert into T_CoreEnvelopeDesignData("); strBuilder.Append("Id,DesignData_Name,DesignData_Submitter,Helicopter_Name,DataRemark,LastModify_Time,DesignTaking_Weight,CoreEnvelope)"); strBuilder.Append(" values ("); strBuilder.Append("" + model.Id + ","); strBuilder.Append("'" + model.DesignData_Name + "',"); strBuilder.Append("'" + model.DesignData_Submitter + "',"); strBuilder.Append("'" + model.Helicopter_Name + "',"); strBuilder.Append("'" + model.DataRemark + "',"); strBuilder.Append("'" + model.LastModify_Time + "',"); strBuilder.Append("" + model.DesignTaking_Weight + ","); strBuilder.Append("'" + model.CoreEnvelope + "'"); strBuilder.Append(")"); int rows = SQLiteDBHelper.ExecuteNonQuery(strBuilder.ToString(), null); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.CoreEnvelopeDesign GetModel(int Id) { //该表无主键信息,请自定义主键/条件字段 StringBuilder strSql = new StringBuilder(); strSql.Append("select Id,DesignData_Name,DesignData_Submitter,Helicopter_Name,DataRemark,LastModify_Time,DesignTaking_Weight,CoreEnvelope from T_CoreEnvelopeDesignData "); strSql.Append(" where Id=" + Id.ToString()); Model.CoreEnvelopeDesign model = new Model.CoreEnvelopeDesign(); DataTable table = SQLiteDBHelper.ExecuteDataTable(strSql.ToString(), null); if (table.Rows.Count > 0) { return(DataRowToModel(table.Rows[0])); } else { return(null); } }
/// <summary> /// 获取所有对象实体 /// </summary> public List <Model.CoreEnvelopeDesign> GetListModel() { //该表无主键信息,请自定义主键/条件字段 StringBuilder strSql = new StringBuilder(); strSql.Append("select Id,DesignData_Name,DesignData_Submitter,Helicopter_Name,DataRemark,LastModify_Time,DesignTaking_Weight,CoreEnvelope from T_CoreEnvelopeDesignData "); List <Model.CoreEnvelopeDesign> lstModel = new List <Model.CoreEnvelopeDesign>(); DataTable table = SQLiteDBHelper.ExecuteDataTable(strSql.ToString(), null); if (table.Rows.Count > 0) { for (int i = 0; i < table.Rows.Count; i++) { Model.CoreEnvelopeDesign model = DataRowToModel(table.Rows[i]); lstModel.Add(model); } } return(lstModel); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.CoreEnvelopeDesign DataRowToModel(DataRow row) { Model.CoreEnvelopeDesign model = new Model.CoreEnvelopeDesign(); if (row != null) { if (row["Id"] != null && row["Id"].ToString() != "") { model.Id = int.Parse(row["Id"].ToString()); } if (row["DesignData_Name"] != null) { model.DesignData_Name = row["DesignData_Name"].ToString(); } if (row["DesignData_Submitter"] != null) { model.DesignData_Submitter = row["DesignData_Submitter"].ToString(); } if (row["Helicopter_Name"] != null) { model.Helicopter_Name = row["Helicopter_Name"].ToString(); } if (row["DataRemark"] != null) { model.DataRemark = row["DataRemark"].ToString(); } if (row["LastModify_Time"] != null) { model.LastModify_Time = row["LastModify_Time"].ToString(); } if (row["DesignTaking_Weight"] != null && row["DesignTaking_Weight"].ToString() != "") { model.DesignTaking_Weight = Convert.ToDouble(row["DesignTaking_Weight"]); } if (row["CoreEnvelope"] != null) { model.CoreEnvelope = row["CoreEnvelope"].ToString(); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.CoreEnvelopeDesign model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Add(Model.CoreEnvelopeDesign model) { return(dal.Add(model)); }