コード例 #1
0
ファイル: ToolBorrowBLL.cs プロジェクト: paddy235/BSFramework
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, ToolBorrowEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #2
0
        /// <summary>
        /// 借用
        /// </summary>
        /// <param name="id">工具id</param>
        /// <returns></returns>
        public ActionResult Borrow(string id)
        {
            var              user = OperatorProvider.Provider.Current();
            ToolInfoEntity   t    = ibll.GetEntity(id);
            ToolBorrowEntity b    = new ToolBorrowEntity();

            if (!string.IsNullOrEmpty(t.CurrentNumber))
            {
                if (t.CurrentNumber != "0")
                {
                    t.CurrentNumber = (Convert.ToInt32(t.CurrentNumber) - 1).ToString();
                    ibll.SaveForm(t.ID, t);

                    b.ID = Guid.NewGuid().ToString();

                    b.IsGood         = "";
                    b.Remark         = "";
                    b.ToolName       = t.Name;
                    b.ToolSpec       = t.Spec;
                    b.BorrwoPerson   = user.UserName;
                    b.BorrwoPersonId = user.UserId;
                    b.BorrwoDate     = DateTime.Now;
                    b.BackDate       = null;
                    b.TypeId         = t.ID;
                    b.BZId           = user.DeptId;
                    tbll.SaveForm(string.Empty, b);
                    return(Success("0", new { typeid = t.TypeId }));
                }
                else
                {
                    return(Success("1"));
                }
            }
            else
            {
                return(Success("1"));
            }
        }
コード例 #3
0
        public ActionResult Back(string id, string isgood, string state)
        {
            var user = OperatorProvider.Provider.Current();

            ToolBorrowEntity tb = tbll.GetEntity(id);
            ToolInfoEntity   t  = ibll.GetEntity(tb.TypeId);

            if (!string.IsNullOrEmpty(state))
            {
                //state = state.Substring(0, state.Length - 1);
            }
            t.IsGood = isgood;
            t.State  = state;
            if (!string.IsNullOrEmpty(t.CurrentNumber))
            {
                t.CurrentNumber = (Convert.ToInt32(t.CurrentNumber) + 1).ToString();  //更新工具当前数量
            }
            ibll.SaveForm(t.ID, t);
            tb.BackDate = DateTime.Now;
            tb.IsGood   = isgood;
            tb.Remark   = state;
            tbll.SaveForm(tb.ID, tb);
            return(Success("0"));
        }