Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.drpTestTraining.Value))
            {
                Model.Base_TrainTypeItem newItem = new Model.Base_TrainTypeItem()
                {
                    TrainTypeId = this.TrainTypeId,
                    TrainingId  = this.drpTestTraining.Value,
                    SCount      = Funs.GetNewIntOrZero(this.txtSCount.Text),
                    MCount      = Funs.GetNewIntOrZero(this.txtMCount.Text),
                    JCount      = Funs.GetNewIntOrZero(this.txtJCount.Text),
                };

                var deleteItem = Funs.DB.Base_TrainTypeItem.FirstOrDefault(x => x.TrainTypeId == newItem.TrainTypeId && x.TrainingId == newItem.TrainingId);
                if (deleteItem != null)
                {
                    TrainTypeService.DeleteTrainTypeItemById(deleteItem.TrainTypeItemId);
                }

                TrainTypeService.AddTrainTypeItem(newItem);
                this.BindGrid();
                this.reSetTable();

                this.ShowNotify("保存成功!", MessageBoxIcon.Success);
            }
        }
Beispiel #2
0
 /// <summary>
 /// 根据主键删除培训类型
 /// </summary>
 /// <param name="trainTypeId"></param>
 public static void DeleteTrainTypeItemById(string trainTypeItemId)
 {
     Model.SUBHSSEDB          db = Funs.DB;
     Model.Base_TrainTypeItem delTrainTypeItem = db.Base_TrainTypeItem.FirstOrDefault(e => e.TrainTypeItemId == trainTypeItemId);
     if (delTrainTypeItem != null)
     {
         db.Base_TrainTypeItem.DeleteOnSubmit(delTrainTypeItem);
         db.SubmitChanges();
     }
 }
Beispiel #3
0
 /// <summary>
 /// 添加培训类型题型数量
 /// </summary>
 /// <param name="getTrainTypeItem"></param>
 public static void AddTrainTypeItem(Model.Base_TrainTypeItem getTrainTypeItem)
 {
     Model.SUBHSSEDB          db = Funs.DB;
     Model.Base_TrainTypeItem newTrainTypeItem = new Model.Base_TrainTypeItem
     {
         TrainTypeItemId = SQLHelper.GetNewID(),
         TrainTypeId     = getTrainTypeItem.TrainTypeId,
         TrainingId      = getTrainTypeItem.TrainingId,
         SCount          = getTrainTypeItem.SCount,
         MCount          = getTrainTypeItem.MCount,
         JCount          = getTrainTypeItem.JCount
     };
     db.Base_TrainTypeItem.InsertOnSubmit(newTrainTypeItem);
     db.SubmitChanges();
 }