internal bool Add(TechnologyAwards model) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("insert into TechnologyAwards("); stringBuilder.Append("TechnologyAwardsNo,TechnologyAwardsee,TechnologyAwardsPName,TechnologyAwardsYear,TechnologyAwardsTypeLevel,TechnologyAwardsContent,TechnologyAwardsPDF,TechnologyAwardsPDFOName,TechnologyAwardsOrder)"); stringBuilder.Append(" values ("); stringBuilder.Append("@TechnologyAwardsNo,@TechnologyAwardsee,@TechnologyAwardsPName,@TechnologyAwardsYear,@TechnologyAwardsTypeLevel,@TechnologyAwardsContent,@TechnologyAwardsPDF,@TechnologyAwardsPDFOName,@TechnologyAwardsOrder)"); SQLiteParameter[] array = new SQLiteParameter[] { new SQLiteParameter("@TechnologyAwardsNo", DbType.String), new SQLiteParameter("@TechnologyAwardsee", DbType.String), new SQLiteParameter("@TechnologyAwardsPName", DbType.String), new SQLiteParameter("@TechnologyAwardsYear", DbType.String), new SQLiteParameter("@TechnologyAwardsTypeLevel", DbType.String), new SQLiteParameter("@TechnologyAwardsContent", DbType.String), new SQLiteParameter("@TechnologyAwardsPDF", DbType.String), new SQLiteParameter("@TechnologyAwardsPDFOName", DbType.String), new SQLiteParameter("@TechnologyAwardsOrder", DbType.Int32, 4) }; array[0].Value = model.TechnologyAwardsNo; array[1].Value = model.TechnologyAwardsee; array[2].Value = model.TechnologyAwardsPName; array[3].Value = model.TechnologyAwardsYear; array[4].Value = model.TechnologyAwardsTypeLevel; array[5].Value = model.TechnologyAwardsContent; array[6].Value = model.TechnologyAwardsPDF; array[7].Value = model.TechnologyAwardsPDFOName; array[8].Value = model.TechnologyAwardsOrder; string text = ""; base.ExecuteNonQuery(stringBuilder.ToString(), array, out text); return(true); }
private bool SaveProgress() { this.OnSaveCheckDenyEvent(EventArgs.Empty); IList <TechnologyAwards> list = new List <TechnologyAwards>(); for (int i = 0; i < this.dTechnologyAwards.RowCount - 1; i++) { DataGridViewRow dataGridViewRow = this.dTechnologyAwards.Rows[i]; TechnologyAwards technologyAwards = new TechnologyAwards(); technologyAwards.TechnologyAwardsNo = ((dataGridViewRow.Cells["scienceid"].Value == null) ? "" : dataGridViewRow.Cells["scienceid"].Value.ToString()); technologyAwards.TechnologyAwardsPName = ((dataGridViewRow.Cells["sciencename"].Value == null || dataGridViewRow.Cells["sciencename"].Value == DBNull.Value) ? "" : dataGridViewRow.Cells["sciencename"].Value.ToString()); technologyAwards.TechnologyAwardsTypeLevel = ((dataGridViewRow.Cells["sciencelevel"].Value == null || dataGridViewRow.Cells["sciencelevel"].Value == DBNull.Value) ? "" : dataGridViewRow.Cells["sciencelevel"].Value.ToString()); technologyAwards.TechnologyAwardsYear = ((dataGridViewRow.Cells["sciencedate"].Value == null || dataGridViewRow.Cells["sciencedate"].Value == DBNull.Value) ? "" : dataGridViewRow.Cells["sciencedate"].Value.ToString()); technologyAwards.TechnologyAwardsee = ((dataGridViewRow.Cells["scienceorder"].Value == null || dataGridViewRow.Cells["scienceorder"].Value == DBNull.Value) ? "" : dataGridViewRow.Cells["scienceorder"].Value.ToString()); technologyAwards.TechnologyAwardsPDFOName = ((dataGridViewRow.Cells["scienceattainfo"].Value == null || dataGridViewRow.Cells["scienceattainfo"].Value == DBNull.Value) ? "" : dataGridViewRow.Cells["scienceattainfo"].Value.ToString()); technologyAwards.TechnologyAwardsPDF = ((dataGridViewRow.Cells["hiddenStoreName"].Value == null || dataGridViewRow.Cells["hiddenStoreName"].Value == DBNull.Value) ? "" : dataGridViewRow.Cells["hiddenStoreName"].Value.ToString()); technologyAwards.UpLoadFullPath = ((dataGridViewRow.Cells["UpLoadFullyName"].Value == null || dataGridViewRow.Cells["UpLoadFullyName"].Value == DBNull.Value) ? "" : dataGridViewRow.Cells["UpLoadFullyName"].Value.ToString()); technologyAwards.TechnologyAwardsOrder = this.dTechnologyAwards.RowCount - i; if (technologyAwards.TechnologyAwardsPName == "" || technologyAwards.TechnologyAwardsTypeLevel == "" || technologyAwards.TechnologyAwardsYear == "" || technologyAwards.TechnologyAwardsee == "" || technologyAwards.TechnologyAwardsPDFOName == "") { MessageBox.Show("所有字段均为必填字段,重要科技奖项需要上传对应的PDF支撑文件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } int num; if (!int.TryParse(technologyAwards.TechnologyAwardsee, out num)) { MessageBox.Show("录入的排名有非整数数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } list.Add(technologyAwards); } if (list.Count > 10) { MessageBox.Show("录入的重要科技奖项记录条数超过10条", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } this.OnSaveCheckPassedEvent(EventArgs.Empty); this._technologyAwardsService.UpdateTechnologyAwards(list); list = this._technologyAwardsService.GetTechnologyAwards(); this.LoadData(list); return(true); }
internal bool Update(TechnologyAwards model) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("update TechnologyAwards set "); stringBuilder.Append("TechnologyAwardsNo=@TechnologyAwardsNo,"); stringBuilder.Append("TechnologyAwardsee=@TechnologyAwardsee,"); stringBuilder.Append("TechnologyAwardsPName=@TechnologyAwardsPName,"); stringBuilder.Append("TechnologyAwardsYear=@TechnologyAwardsYear,"); stringBuilder.Append("TechnologyAwardsTypeLevel=@TechnologyAwardsTypeLevel,"); stringBuilder.Append("TechnologyAwardsContent=@TechnologyAwardsContent,"); stringBuilder.Append("TechnologyAwardsPDF=@TechnologyAwardsPDF,"); stringBuilder.Append("TechnologyAwardsPDFOName=@TechnologyAwardsPDFOName,"); stringBuilder.Append("TechnologyAwardsOrder=@TechnologyAwardsOrder"); stringBuilder.Append(" where TechnologyAwardsNo=@TechnologyAwardsNo"); SQLiteParameter[] array = new SQLiteParameter[] { new SQLiteParameter("@TechnologyAwardsNo", DbType.String), new SQLiteParameter("@TechnologyAwardsee", DbType.String), new SQLiteParameter("@TechnologyAwardsPName", DbType.String), new SQLiteParameter("@TechnologyAwardsYear", DbType.String), new SQLiteParameter("@TechnologyAwardsTypeLevel", DbType.String), new SQLiteParameter("@TechnologyAwardsContent", DbType.String), new SQLiteParameter("@TechnologyAwardsPDF", DbType.String), new SQLiteParameter("@TechnologyAwardsPDFOName", DbType.String), new SQLiteParameter("@TechnologyAwardsOrder", DbType.Int32, 4) }; array[0].Value = model.TechnologyAwardsNo; array[1].Value = model.TechnologyAwardsee; array[2].Value = model.TechnologyAwardsPName; array[3].Value = model.TechnologyAwardsYear; array[4].Value = model.TechnologyAwardsTypeLevel; array[5].Value = model.TechnologyAwardsContent; array[6].Value = model.TechnologyAwardsPDF; array[7].Value = model.TechnologyAwardsPDFOName; array[8].Value = model.TechnologyAwardsOrder; string text = ""; base.ExecuteNonQuery(stringBuilder.ToString(), array, out text); return(true); }