示例#1
0
        public ActionResult SaveGRN(Model.GoodsReceivedNote entity)
        {
            entity.Id = Guid.NewGuid();
            entity.CountryProgrammeId = countryProg.Id;
            entity.PreparedBy         = currentStaff.Id;
            entity.Verified           = false;
            entity.PreparedOn         = DateTime.Now;
            entity.IsSubmitted        = false;
            //entity.RefNumber = gRNService.GenerateUniquNumber(countryProg);
            if (!gRNService.SaveGRN(entity))
            {
                ViewBag.Response      = 0;
                ViewBag.msg           = Resources.Global_String_AnErrorOccurred;
                entity.staffs         = new SelectList(SessionData.CurrentSession.StaffList, "Id", "StaffName");
                entity.SupplierId     = gRNService.GetPO(entity.PurchaseOrderId).Supplier.Id;
                entity.PurchaseOrders = new SelectList(gRNService.GetGRNPurchaseOrders(), "Id", "RefNumber");
                entity.SubOffices     = new SelectList(SessionData.CurrentSession.CountrySubOfficeList, "Id", "Name");
                entity.POItemz        = gRNService.GetPOItemsDetails(entity.PurchaseOrderId);
                entity.SupplierName   = gRNService.GetPO(entity.PurchaseOrderId).Supplier.Name;
                return(View("LoadGRN", entity));
            }
            //Send notification
            notificationService.SendToAppropriateApprover(NotificationHelper.grnCode, NotificationHelper.verificationCode, entity.Id);
            ViewBag.Response = 1;
            ViewBag.msg      = Resources.Global_String_ProcessCompleted;

            return(ViewGRNDetails(new GRNDetailsParams {
                GRNId = entity.Id, Verify = false
            }));
        }