示例#1
0
        internal bool Add(TalentsPlan model)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("insert into TalentsPlan(");
            stringBuilder.Append("TalentsPlanNo,TalentsPlanDate,TalentsPlanName,TalentsPlanRA,TalentsPlanOutlay,TalentsPlanOrder)");
            stringBuilder.Append(" values (");
            stringBuilder.Append("@TalentsPlanNo,@TalentsPlanDate,@TalentsPlanName,@TalentsPlanRA,@TalentsPlanOutlay,@TalentsPlanOrder)");
            SQLiteParameter[] array = new SQLiteParameter[]
            {
                new SQLiteParameter("@TalentsPlanNo", DbType.String),
                new SQLiteParameter("@TalentsPlanDate", DbType.String),
                new SQLiteParameter("@TalentsPlanName", DbType.String),
                new SQLiteParameter("@TalentsPlanRA", DbType.String),
                new SQLiteParameter("@TalentsPlanOutlay", DbType.String),
                new SQLiteParameter("@TalentsPlanOrder", DbType.Int32, 4)
            };
            array[0].Value = model.TalentsPlanNo;
            array[1].Value = model.TalentsPlanDate;
            array[2].Value = model.TalentsPlanName;
            array[3].Value = model.TalentsPlanRA;
            array[4].Value = model.TalentsPlanOutlay;
            array[5].Value = model.TalentsPlanOrder;
            string text = "";

            base.ExecuteNonQuery(stringBuilder.ToString(), array, out text);
            return(true);
        }
示例#2
0
        internal bool Update(TalentsPlan model)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("update TalentsPlan set ");
            stringBuilder.Append("TalentsPlanDate=@TalentsPlanDate,");
            stringBuilder.Append("TalentsPlanName=@TalentsPlanName,");
            stringBuilder.Append("TalentsPlanRA=@TalentsPlanRA,");
            stringBuilder.Append("TalentsPlanOutlay=@TalentsPlanOutlay,");
            stringBuilder.Append("TalentsPlanOrder=@TalentsPlanOrder");
            stringBuilder.Append(" where TalentsPlanNo=@TalentsPlanNo");
            SQLiteParameter[] array = new SQLiteParameter[]
            {
                new SQLiteParameter("@TalentsPlanNo", DbType.String),
                new SQLiteParameter("@TalentsPlanDate", DbType.String),
                new SQLiteParameter("@TalentsPlanName", DbType.String),
                new SQLiteParameter("@TalentsPlanRA", DbType.String),
                new SQLiteParameter("@TalentsPlanOutlay", DbType.String),
                new SQLiteParameter("@TalentsPlanOrder", DbType.Int32, 4)
            };
            array[0].Value = model.TalentsPlanNo;
            array[1].Value = model.TalentsPlanDate;
            array[2].Value = model.TalentsPlanName;
            array[3].Value = model.TalentsPlanRA;
            array[4].Value = model.TalentsPlanOutlay;
            array[5].Value = model.TalentsPlanOrder;
            string text = "";

            base.ExecuteNonQuery(stringBuilder.ToString(), array, out text);
            return(true);
        }
示例#3
0
        private bool SaveProgress()
        {
            this.OnSaveCheckDenyEvent(EventArgs.Empty);
            IList <TalentsPlan> list = new List <TalentsPlan>();

            for (int i = 0; i < this.dtalent.RowCount - 1; i++)
            {
                DataGridViewRow dataGridViewRow = this.dtalent.Rows[i];
                TalentsPlan     talentsPlan     = new TalentsPlan();
                talentsPlan.TalentsPlanNo     = ((dataGridViewRow.Cells["selpersonid"].Value == null) ? "" : dataGridViewRow.Cells["selpersonid"].Value.ToString());
                talentsPlan.TalentsPlanDate   = ((dataGridViewRow.Cells["selpersonidstartdate"].Value == null || dataGridViewRow.Cells["selpersonidstartdate"].Value == DBNull.Value) ? "" : dataGridViewRow.Cells["selpersonidstartdate"].Value.ToString());
                talentsPlan.TalentsPlanName   = ((dataGridViewRow.Cells["selpersonname"].Value == null || dataGridViewRow.Cells["selpersonname"].Value == DBNull.Value) ? "" : dataGridViewRow.Cells["selpersonname"].Value.ToString());
                talentsPlan.TalentsPlanRA     = ((dataGridViewRow.Cells["TalentsPlanRA"].Value == null || dataGridViewRow.Cells["TalentsPlanRA"].Value == DBNull.Value) ? "" : dataGridViewRow.Cells["TalentsPlanRA"].Value.ToString());
                talentsPlan.TalentsPlanOutlay = ((dataGridViewRow.Cells["selpersonfee"].Value == null || dataGridViewRow.Cells["selpersonfee"].Value == DBNull.Value) ? "" : dataGridViewRow.Cells["selpersonfee"].Value.ToString());
                talentsPlan.TalentsPlanOrder  = this.dtalent.RowCount - i;
                if (talentsPlan.TalentsPlanDate == "")
                {
                    MessageBox.Show("入选时间为必填字段,检测到部分字段未填写完整", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(false);
                }
                decimal num;
                if (talentsPlan.TalentsPlanOutlay != string.Empty && !decimal.TryParse(talentsPlan.TalentsPlanOutlay, out num))
                {
                    MessageBox.Show("录入的资助经费有非数值数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(false);
                }
                list.Add(talentsPlan);
            }
            this.OnSaveCheckPassedEvent(EventArgs.Empty);
            this._talentsPlanService.UpdateTalentsPlans(list);
            list = this._talentsPlanService.GetTalentsPlan();
            this.LoadData(list);
            return(true);
        }