Exemplo n.º 1
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_CostType costType = new Model.Base_CostType
            {
                CostTypeCode = this.txtCostTypeCode.Text.Trim(),
                CostTypeName = this.txtCostTypeName.Text.Trim(),
                Remark       = txtRemark.Text.Trim()
            };
            if (string.IsNullOrEmpty(strRowID))
            {
                costType.CostTypeId = SQLHelper.GetNewID(typeof(Model.Base_CostType));
                BLL.CostTypeService.AddCostType(costType);
                BLL.LogService.AddSys_Log(this.CurrUser, costType.CostTypeCode, costType.CostTypeId, BLL.Const.CostTypeMenuId, BLL.Const.BtnAdd);
            }
            else
            {
                costType.CostTypeId = strRowID;
                BLL.CostTypeService.UpdateCostType(costType);
                BLL.LogService.AddSys_Log(this.CurrUser, costType.CostTypeCode, costType.CostTypeId, BLL.Const.CostTypeMenuId, BLL.Const.BtnModify);
            }

            this.SimpleForm1.Reset();
            // 重新绑定表格,并点击当前编辑或者新增的行
            BindGrid();
            PageContext.RegisterStartupScript(String.Format("F('{0}').selectRow('{1}');", Grid1.ClientID, costType.CostTypeId));
        }
Exemplo n.º 2
0
 /// <summary>
 /// 根据主键删除费用类型
 /// </summary>
 /// <param name="costTypeId"></param>
 public static void DeleteCostTypeById(string costTypeId)
 {
     Model.SUBHSSEDB     db       = Funs.DB;
     Model.Base_CostType costType = db.Base_CostType.FirstOrDefault(e => e.CostTypeId == costTypeId);
     if (costType != null)
     {
         db.Base_CostType.DeleteOnSubmit(costType);
         db.SubmitChanges();
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 修改费用类型
 /// </summary>
 /// <param name="costType"></param>
 public static void UpdateCostType(Model.Base_CostType costType)
 {
     Model.SUBHSSEDB     db          = Funs.DB;
     Model.Base_CostType newCostType = db.Base_CostType.FirstOrDefault(e => e.CostTypeId == costType.CostTypeId);
     if (newCostType != null)
     {
         newCostType.CostTypeCode = costType.CostTypeCode;
         newCostType.CostTypeName = costType.CostTypeName;
         newCostType.Remark       = costType.Remark;
         db.SubmitChanges();
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// 添加费用类型
 /// </summary>
 /// <param name="costType"></param>
 public static void AddCostType(Model.Base_CostType costType)
 {
     Model.SUBHSSEDB     db          = Funs.DB;
     Model.Base_CostType newCostType = new Model.Base_CostType
     {
         CostTypeId   = costType.CostTypeId,
         CostTypeCode = costType.CostTypeCode,
         CostTypeName = costType.CostTypeName,
         Remark       = costType.Remark
     };
     db.Base_CostType.InsertOnSubmit(newCostType);
     db.SubmitChanges();
 }