예제 #1
0
        public Operation Delete(SlsRetailer obj)
        {
            Operation objOperation = new Operation { Success = true, OperationId = obj.Id };
            _RetailerRepository.Delete(obj);

            try
            {
                _unitOfWork.Commit();
            }
            catch (Exception)
            {

                objOperation.Success = false;
            }
            return objOperation;
        }
        public ActionResult Save(SlsRetailer reatiler)
        {
            int userId = Convert.ToInt32(Session["userId"]);
            Operation objOperation = new Operation { Success = false };

            if (ModelState.IsValid)
            {
                if (reatiler.Id == 0)
                {
                    if ((bool)Session["Add"])
                    {
                        int companyId = Convert.ToInt32(Session["companyId"]);
                        reatiler.SecCompanyId = companyId;
                        reatiler.CreatedBy = userId;
                        reatiler.CreatedDate = DateTime.Now.Date;
                        if (reatiler.SlsOfficeId == 0)
                        {
                            reatiler.SlsOfficeId = null;
                        }
                        if(reatiler.SlsDistributorId==0)
                        {
                            reatiler.SlsDistributorId = null;
                        }
                        objOperation = _retailerService.Save(reatiler);
                    }
                    else { objOperation.OperationId = -1; }

                }
                else
                {
                    if ((bool)Session["Edit"])
                    {
                        reatiler.ModifiedBy = userId;
                        reatiler.ModifiedDate = DateTime.Now.Date;
                        objOperation = _retailerService.Update(reatiler);
                    }
                    else { objOperation.OperationId = -2; }
                }
            }

            return Json(objOperation, JsonRequestBehavior.DenyGet);
        }
예제 #3
0
        public Operation Save(SlsRetailer obj)
        {
            Operation objOperation = new Operation { Success = true };

            long Id = _RetailerRepository.AddEntity(obj);
            objOperation.OperationId = Id;

            try
            {
                _unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                objOperation.Success = false;
            }
            return objOperation;
        }