コード例 #1
0
ファイル: UnitType.aspx.cs プロジェクト: klniu/SUBHSSE
        /// <summary>
        /// 保存按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strRowID = hfFormID.Text;

            Model.Base_UnitType newUnitType = new Model.Base_UnitType
            {
                UnitTypeCode = this.txtUnitTypeCode.Text.Trim(),
                UnitTypeName = this.txtUnitTypeName.Text.Trim(),
                Remark       = txtRemark.Text.Trim()
            };
            if (string.IsNullOrEmpty(strRowID))
            {
                newUnitType.UnitTypeId = SQLHelper.GetNewID(typeof(Model.Base_UnitType));
                BLL.UnitTypeService.AddUnitType(newUnitType);
                BLL.LogService.AddSys_Log(this.CurrUser, newUnitType.UnitTypeCode, newUnitType.UnitTypeId, BLL.Const.UnitTypeMenuId, BLL.Const.BtnAdd);
            }
            else
            {
                newUnitType.UnitTypeId = strRowID;
                BLL.UnitTypeService.UpdateUnitType(newUnitType);
                BLL.LogService.AddSys_Log(this.CurrUser, newUnitType.UnitTypeCode, newUnitType.UnitTypeId, BLL.Const.UnitTypeMenuId, BLL.Const.BtnModify);
            }
            this.SimpleForm1.Reset();
            // 重新绑定表格,并点击当前编辑或者新增的行
            BindGrid();
            PageContext.RegisterStartupScript(String.Format("F('{0}').selectRow('{1}');", Grid1.ClientID, newUnitType.UnitTypeId));
        }
コード例 #2
0
 /// <summary>
 /// 根据主键删除信息
 /// </summary>
 /// <param name="unitTypeId"></param>
 public static void DeleteUnitTypeById(string unitTypeId)
 {
     Model.SUBHSSEDB     db       = Funs.DB;
     Model.Base_UnitType unitType = db.Base_UnitType.FirstOrDefault(e => e.UnitTypeId == unitTypeId);
     {
         db.Base_UnitType.DeleteOnSubmit(unitType);
         db.SubmitChanges();
     }
 }
コード例 #3
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="teamGroup"></param>
 public static void UpdateUnitType(Model.Base_UnitType unitType)
 {
     Model.SUBHSSEDB     db          = Funs.DB;
     Model.Base_UnitType newUnitType = db.Base_UnitType.FirstOrDefault(e => e.UnitTypeId == unitType.UnitTypeId);
     if (newUnitType != null)
     {
         newUnitType.UnitTypeCode = unitType.UnitTypeCode;
         newUnitType.UnitTypeName = unitType.UnitTypeName;
         newUnitType.Remark       = unitType.Remark;
         db.SubmitChanges();
     }
 }
コード例 #4
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="?"></param>
        public static void AddUnitType(Model.Base_UnitType unitType)
        {
            Model.SUBHSSEDB     db          = Funs.DB;
            Model.Base_UnitType newUnitType = new Model.Base_UnitType
            {
                UnitTypeId   = unitType.UnitTypeId,
                UnitTypeCode = unitType.UnitTypeCode,
                UnitTypeName = unitType.UnitTypeName,
                Remark       = unitType.Remark
            };

            db.Base_UnitType.InsertOnSubmit(newUnitType);
            db.SubmitChanges();
        }