Esempio n. 1
0
 /// <summary>
 /// 修改培训类型
 /// </summary>
 /// <param name="trainType"></param>
 public static void UpdateTrainType(Model.Base_TrainType trainType)
 {
     Model.SUBHSSEDB      db           = Funs.DB;
     Model.Base_TrainType newTrainType = db.Base_TrainType.FirstOrDefault(e => e.TrainTypeId == trainType.TrainTypeId);
     if (newTrainType != null)
     {
         newTrainType.TrainTypeCode   = trainType.TrainTypeCode;
         newTrainType.TrainTypeName   = trainType.TrainTypeName;
         newTrainType.Remark          = trainType.Remark;
         newTrainType.IsAboutSendCard = trainType.IsAboutSendCard;
         newTrainType.IsRepeat        = trainType.IsRepeat;
         db.SubmitChanges();
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 添加培训类型
 /// </summary>
 /// <param name="trainType"></param>
 public static void AddTrainType(Model.Base_TrainType trainType)
 {
     Model.SUBHSSEDB      db           = Funs.DB;
     Model.Base_TrainType newTrainType = new Model.Base_TrainType
     {
         TrainTypeId     = trainType.TrainTypeId,
         TrainTypeCode   = trainType.TrainTypeCode,
         TrainTypeName   = trainType.TrainTypeName,
         Remark          = trainType.Remark,
         IsAboutSendCard = trainType.IsAboutSendCard,
         IsRepeat        = trainType.IsRepeat
     };
     db.Base_TrainType.InsertOnSubmit(newTrainType);
     db.SubmitChanges();
 }
Esempio n. 3
0
 /// <summary>
 /// 根据主键删除培训类型
 /// </summary>
 /// <param name="trainTypeId"></param>
 public static void DeleteTrainTypeById(string trainTypeId)
 {
     Model.SUBHSSEDB      db        = Funs.DB;
     Model.Base_TrainType trainType = db.Base_TrainType.FirstOrDefault(e => e.TrainTypeId == trainTypeId);
     if (trainType != null)
     {
         var getItems = from x in db.Base_TrainTypeItem where x.TrainTypeId == trainType.TrainTypeId select x;
         if (getItems.Count() > 0)
         {
             foreach (var item in getItems)
             {
                 DeleteTrainTypeItemById(item.TrainTypeItemId);
             }
         }
         db.Base_TrainType.DeleteOnSubmit(trainType);
         db.SubmitChanges();
     }
 }
Esempio n. 4
0
        /// <summary>
        /// 保存按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strRowID = hfFormID.Text;

            Model.Base_TrainType newTrainType = new Model.Base_TrainType
            {
                TrainTypeCode = this.txtTrainTypeCode.Text.Trim(),
                TrainTypeName = this.txtTrainTypeName.Text.Trim()
            };
            if (this.ckbIsAboutSendCard.Checked == true)
            {
                newTrainType.IsAboutSendCard = true;
            }
            else
            {
                newTrainType.IsAboutSendCard = false;
            }
            if (this.ckbIsRepeat.Checked == true)
            {
                newTrainType.IsRepeat = true;
            }
            else
            {
                newTrainType.IsRepeat = false;
            }
            newTrainType.Remark = txtRemark.Text.Trim();
            if (string.IsNullOrEmpty(strRowID))
            {
                newTrainType.TrainTypeId = SQLHelper.GetNewID(typeof(Model.Base_TrainType));
                BLL.TrainTypeService.AddTrainType(newTrainType);
                BLL.LogService.AddSys_Log(this.CurrUser, newTrainType.TrainTypeCode, newTrainType.TrainTypeId, BLL.Const.TrainTypeMenuId, BLL.Const.BtnAdd);
            }
            else
            {
                newTrainType.TrainTypeId = strRowID;
                BLL.TrainTypeService.UpdateTrainType(newTrainType);
                BLL.LogService.AddSys_Log(this.CurrUser, newTrainType.TrainTypeCode, newTrainType.TrainTypeId, BLL.Const.TrainTypeMenuId, BLL.Const.BtnModify);
            }
            this.SimpleForm1.Reset();
            // 重新绑定表格,并点击当前编辑或者新增的行
            BindGrid();
            PageContext.RegisterStartupScript(String.Format("F('{0}').selectRow('{1}');", Grid1.ClientID, newTrainType.TrainTypeId));
            Alert.ShowInTop("保存成功!", MessageBoxIcon.Success);
        }