Example #1
0
        public ActionResult AllListComissionMembers()
        {
            var user             = UserHelper.GetCurrentEmployee();
            var comissionMemebrs = new PriceProjectRepository().GetComissionMembers().Where(x => x.Id != user.Id);

            return(Json(comissionMemebrs.Select(o => new { o.Id, Name = o.FullName }), JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public ActionResult ListProtocol([DataSourceRequest] DataSourceRequest request)
        {
            var user   = UserHelper.GetCurrentEmployee();
            var list   = new PriceProjectRepository().GetProtocols(user.Id, null);
            var result = list.ToDataSourceResult(request);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Example #3
0
 public ActionResult CompleteProtocol(string rowId)
 {
     try {
         var result = new PriceProjectRepository().CompleteProtocol(new Guid(rowId));
         return(result ? Content(bool.TrueString) : Content(bool.FalseString));
     }
     catch (Exception ex) {
         LogHelper.Log.Error("Ошибка завершения протокола", ex);
         return(Content(bool.FalseString));
     }
 }
Example #4
0
        public ActionResult GetProtocolPriceDetails(string id, bool isImn)
        {
            var prices = new PriceProjectRepository().GetPricesByRequester(new Guid(id), isImn);

            ViewBag.IsSelected = false;
            return(PartialView("ProtocolPriceTable", prices.Select(x => new PP_ProtocolProductPrices {
                PriceProjectId = x.PpId,
                PriceFirst = x.UnitPrice,
                ProductNameRu = x.ProductName
            }).ToList()));
        }
Example #5
0
        public ActionResult SignOperation(string id)
        {
            var repository  = new PriceProjectRepository();
            var project     = repository.GetPreamble(new Guid(id));
            var isSuccess   = true;
            var preambleXml = string.Empty;

            try
            {
                preambleXml = SerializeHelper.SerializeDataContract(project);
                preambleXml = preambleXml.Replace("utf-16", "utf-8");
            }
            catch (Exception e)
            {
                isSuccess = false;
            }

            return(Json(new
            {
                IsSuccess = isSuccess,
                preambleXml
            }, JsonRequestBehavior.AllowGet));
        }
Example #6
0
        public ActionResult ProtocolForm(Guid?id)
        {
            var user         = UserHelper.GetCurrentEmployee();
            var ppRepository = new PriceProjectRepository();

            PP_Protocols protocol;

            if (id.HasValue)
            {
                protocol = db.PP_Protocols.FirstOrDefault(x => x.Id == id.Value);
                if (protocol == null)
                {
                    LogHelper.Log.ErrorFormat("Не удалось найти протокол по идентификатору {0}", id.Value);
                    return(null);
                }
            }
            else
            {
                protocol = new PP_Protocols {
                    ProtocolDate = DateTime.Now,
                    Type         = (int)ProtocolType.Protocol1,
                    Status       = (int)ProtocolStatus.Draft,
                    Number       = ppRepository.GenerateProtocolNumber(),
                    IsImn        = false
                };
            }

            var model = new ProtocolModel {
                Guid     = Guid.NewGuid(),
                Protocol = protocol
            };

            if (protocol.Status == (int)ProtocolStatus.Draft)
            {
                ViewBag.Leadership = ppRepository.GetLeadership().ToList().Select(e => new SelectListItem
                {
                    Value = e.Id.ToString(),
                    Text  = e.FullName
                }).ToList();

                var list = new List <SelectListItem>();
                list.AddRange(EnumHelper.GetDisplayNameEnumList <ProtocolType>().ToList().Select(x => new SelectListItem
                {
                    Value = x.Key.ToString(),
                    Text  = x.Value
                }));
                ViewBag.ProtocolTypes = list;

                ViewBag.Requesters = ppRepository.GetRequesters().ToList().Select(e => new SelectListItem
                {
                    Value = e.Id.ToString(),
                    Text  = e.DisplayName
                }).ToList();
                return(PartialView(model));
            }
            else
            {
                ViewBag.HasEdit = model.Protocol.OwnerId == user.Id;

                var file = FileHelper.GetProtocolAttachFile(db, protocol.Id);
                if (file != null)
                {
                    ViewBag.AttFileName      = file.Name;
                    ViewBag.AttFileExtension = file.Extension;
                    ViewBag.AttFileSize      = file.Length;
                }

                var employee = ppRepository.GetEmployeeById(protocol.RequesterId.Value);
                ViewBag.RequesterDisplayName = employee != null ? employee.DisplayName : "";
                employee = ppRepository.GetEmployeeById(protocol.ChiefId.Value);
                ViewBag.ChiefDisplayName = employee != null ? employee.DisplayName : "";

                ViewBag.ComissionMembers = string.Join("<br/>", protocol.PP_ProtocolComissionMembers.Select(x => x.Employee.FullName).ToArray());

                return(PartialView("ProtocolFormView", model));
            }
        }
Example #7
0
        public ActionResult GetBossFio(string id)
        {
            var fio = new PriceProjectRepository().GetBossFio(new Guid(id));

            return(Json(fio, JsonRequestBehavior.AllowGet));
        }