Exemplo n.º 1
0
        public void Delete(AssetCircle ObjDelete)
        {
            var ObjToDelete = _context.AssetCircles.SingleOrDefault(m => m.CompanyID == ObjDelete.CompanyID && m.CircleID == ObjDelete.CircleID);

            if (ObjToDelete != null)
            {
                _context.AssetCircles.Remove(ObjToDelete);
            }
        }
Exemplo n.º 2
0
        public void Update(AssetCircle ObjUpdate)
        {
            var ObjToUpdate = _context.AssetCircles.FirstOrDefault(m => m.CompanyID == ObjUpdate.CompanyID && m.CircleID == ObjUpdate.CircleID);

            if (ObjToUpdate != null)
            {
                ObjToUpdate.CircleName  = ObjUpdate.CircleName;
                ObjToUpdate.InsDateTime = ObjUpdate.InsDateTime;
                ObjToUpdate.InsUserID   = ObjUpdate.InsUserID;
            }
        }
Exemplo n.º 3
0
        public ActionResult AddNew()
        {
            var         userId   = User.Identity.GetUserId();
            var         UserInfo = _unitOfWork.User.GetMyInfo(userId);
            AssetCircle Obj      = new AssetCircle
            {
                CircleID = _unitOfWork.AssetCircle.GetMaxSerial(UserInfo.fCompanyId)
            };

            return(PartialView(Obj));
        }
Exemplo n.º 4
0
        public JsonResult SaveAssetCircle(AssetCircle ObjSave)
        {
            MsgUnit Msg = new MsgUnit();

            try
            {
                var userId   = User.Identity.GetUserId();
                var UserInfo = _unitOfWork.User.GetMyInfo(userId);
                ObjSave.CircleID    = _unitOfWork.AssetCircle.GetMaxSerial(UserInfo.fCompanyId);
                ObjSave.InsDateTime = DateTime.Now;
                ObjSave.InsUserID   = userId;
                ObjSave.CompanyID   = UserInfo.fCompanyId;

                if (!ModelState.IsValid)
                {
                    string Err    = " ";
                    var    errors = ModelState.Values.SelectMany(v => v.Errors);
                    foreach (ModelError error in errors)
                    {
                        Err = Err + error.ErrorMessage + " * ";
                    }

                    Msg.Msg  = Resources.Resource.SomthingWentWrong + " : " + Err;
                    Msg.Code = 0;
                    return(Json(Msg, JsonRequestBehavior.AllowGet));
                }
                _unitOfWork.AssetCircle.Add(ObjSave);
                _unitOfWork.Complete();
                Msg.LastID = _unitOfWork.AssetCircle.GetMaxSerial(UserInfo.fCompanyId).ToString();
                Msg.Code   = 1;
                Msg.Msg    = Resources.Resource.AddedSuccessfully;
                return(Json(Msg, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                Msg.Msg  = Resources.Resource.SomthingWentWrong + " : " + ex.Message.ToString();
                Msg.Code = 0;
                return(Json(Msg, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 5
0
 public void Add(AssetCircle ObjSave)
 {
     _context.AssetCircles.Add(ObjSave);
 }