예제 #1
0
        public JsonResult EditConsumeItem()
        {
            ReturnedData data = new ReturnedData();
            IConsumeItemMgm conMgm = new ConsumeItemMgm();
            try
            {
                int id = NullHelper.Convert<int>(Request["id"], 0);
                string itemName = NullHelper.Convert<string>(Request["citemName"], "");
                decimal itemPrice = NullHelper.Convert<decimal>(Request["citemPrice"], 0M);

                var result = conMgm.GetConsumeItemByID(id);
                if (result != null)
                {
                    result.ItemName = itemName;
                    result.ItemPrice = itemPrice;
                    result.LastModifierID = Emp.UserName;
                    result.LastModifiedDate = DateTime.Now;
                    conMgm.EditConsumeItem(result);
                    data.Success = true;
                    data.Message = "消费项目修改成功";
                    LogHandler.Info("员工" + Emp.UserName + "修改一条消费项目,项目id:" + id);
                }
                else
                {
                    data.Success = false;
                    data.Message = "该消费项目不存在";
                }

            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "消费项目修改失败";
                data.Error = ex.ToString();
                LogHandler.Error("修改消费项目出现错误:" + (ex.Message.ToString()));
                throw;
            }
            return Json(data,JsonRequestBehavior.AllowGet);
        }
예제 #2
0
        public JsonResult GetConsumeitemModel(int id)
        {
            IConsumeItemMgm conMgm = new ConsumeItemMgm();
            ReturnedData data = new ReturnedData();
            try
            {
                var result = conMgm.GetConsumeItemByID(id);
                data.Success = true;
                data.Data = result;
            }
            catch(Exception ex)
            {
                data.Success = false;
                data.Error = ex.ToString();
                data.Message = "网络错误,请稍后重试";
                LogHandler.Error("获取一项消费项目信息出现错误:" + (ex.Message.ToString()));
            }

            return Json(data,JsonRequestBehavior.AllowGet);
        }
예제 #3
0
 public JsonResult GetConsumeItem()
 {
     ReturnedData data = new ReturnedData();
     try
     {
         int itemId = NullHelper.Convert<int>(Request["itemId"], 0);
         ConsumeItemMgm conMgm = new ConsumeItemMgm();
         var conItem = conMgm.GetConsumeItemByID(itemId);
         data.Data = conItem;
         data.Success = true;
     }
     catch (Exception ex)
     {
         data.Success = false;
         data.Message = "出现错误,请联系维护人员";
         data.Error = ex.ToString();
         LogHandler.Error(ex.Message.ToString());
     }
     return Json(data, JsonRequestBehavior.AllowGet);
 }