// GET: /PackingHeader/Create public ActionResult Create() { PackingHeaderViewModel p = new PackingHeaderViewModel(); p.DocDate = DateTime.Now.Date; p.CreatedDate = DateTime.Now; p.DivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"]; p.SiteId = (int)System.Web.HttpContext.Current.Session["SiteId"]; p.DocNo = _PackingHeaderService.GetMaxDocNo(); p.ShipMethodId = new ShipMethodService(_unitOfWork).Find("By Sea").ShipMethodId; int DocTypeId = 0; var DocType = new DocumentTypeService(_unitOfWork).GetDocumentTypeList(TransactionDocCategoryConstants.PackingReceive).FirstOrDefault(); if (DocType != null) { DocTypeId = DocType.DocumentTypeId; } //Getting Settings var settings = new PackingSettingService(_unitOfWork).GetPackingSettingForDocument(DocTypeId, p.DivisionId, p.SiteId); if (settings == null && UserRoles.Contains("SysAdmin")) { return(RedirectToAction("Create", "PackingSetting", new { id = DocTypeId }).Warning("Please create Packing settings")); } else if (settings == null && !UserRoles.Contains("SysAdmin")) { return(View("~/Views/Shared/InValidSettings.cshtml")); } PrepareViewBag(p); ViewBag.Mode = "Add"; return(View(p)); }
private void PrepareViewBag(int id) { int Cid = new DocumentTypeService(_unitOfWork).Find(id).DocumentCategoryId; ViewBag.Name = new DocumentTypeService(_unitOfWork).Find(id).DocumentTypeName; ViewBag.id = id; }
// GET: /PackingHeader/Create public ActionResult Create() { PackingHeaderViewModel p = new PackingHeaderViewModel(); p.DocDate = DateTime.Now.Date; p.CreatedDate = DateTime.Now; p.DivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"]; p.SiteId = (int)System.Web.HttpContext.Current.Session["SiteId"]; p.DocNo = _PackingHeaderService.GetMaxDocNo(); p.ShipMethodId = new ShipMethodService(_unitOfWork).Find("By Sea").ShipMethodId; DocumentType DT = new DocumentTypeService(_unitOfWork).FindByName("Packing Receive"); PackingSetting temp = new PackingSettingService(_unitOfWork).GetPackingSettingForDocument(DT.DocumentTypeId, p.DivisionId, p.SiteId); p.PackingSettings = Mapper.Map <PackingSetting, PackingSettingsViewModel>(temp); if (System.Web.HttpContext.Current.Session["DefaultGodownId"] != null) { p.GodownId = (int)System.Web.HttpContext.Current.Session["DefaultGodownId"]; } PrepareViewBag(p); ViewBag.Mode = "Add"; return(View(p)); }
private async Task DeleteItemsAsync(IEnumerable <DocumentTypeModel> models) { foreach (var model in models) { await DocumentTypeService.DeleteDocumentTypeAsync(model); } }
private static EntityDocumentTypesCache QueryDbWithContext(RockContext rockContext) { var entityDocumentTypes = new DocumentTypeService(rockContext) .Queryable().AsNoTracking() .GroupBy(a => new { a.EntityTypeId, a.EntityTypeQualifierColumn, a.EntityTypeQualifierValue }) .Select(a => new EntityDocumentTypes() { EntityTypeId = a.Key.EntityTypeId, EntityTypeQualifierColumn = a.Key.EntityTypeQualifierColumn, EntityTypeQualifierValue = a.Key.EntityTypeQualifierValue, DocumentTypesIds = a.Select(v => v.Id).ToList() }) .ToList(); var value = new EntityDocumentTypesCache { EntityDocumentTypes = entityDocumentTypes }; return(value); }
// GET: /ProductMaster/ public ActionResult Index() { int DocTypeId = new DocumentTypeService(_unitOfWork).Find(MasterDocTypeConstants.CostCenter).DocumentTypeId; var CostCenter = _CostCenterService.GetCostCenterList().ToList().Where(m => m.DocTypeId == DocTypeId); return(View(CostCenter)); }
// GET: /ProductBuyerSettingMaster/Create public ActionResult Create(int id) { if (!UserRoles.Contains("SysAdmin")) { return(View("~/Views/Shared/InValidSettings.cshtml")); } var DivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"]; var SiteId = (int)System.Web.HttpContext.Current.Session["SiteId"]; var settings = new ProductBuyerSettingsService(_unitOfWork).GetProductBuyerSettings(DivisionId, SiteId); int DocTypeId = new DocumentTypeService(_unitOfWork).Find(MasterDocTypeConstants.Carpet).DocumentTypeId; if (settings == null) { ProductBuyerSettingsViewModel vm = new ProductBuyerSettingsViewModel(); vm.SiteId = SiteId; vm.DivisionId = DivisionId; vm.ProductId = id; PrepareViewBag(vm); ViewBag.DocTypeId = DocTypeId; return(View("Create", vm)); } else { ProductBuyerSettingsViewModel temp = AutoMapper.Mapper.Map <ProductBuyerSettings, ProductBuyerSettingsViewModel>(settings); temp.ProductId = id; PrepareViewBag(temp); ViewBag.DocTypeId = DocTypeId; return(View("Create", temp)); } }
public void DocumentTypeService_GetAsync_ReturnsDocumentTypesByIds() { //Arrange var mockDbContextScopeFac = new Mock<IDbContextScopeFactory>(); var mockDbContextScope = new Mock<IDbContextReadOnlyScope>(); var mockEfDbContext = new Mock<EFDbContext>(); mockDbContextScopeFac.Setup(x => x.CreateReadOnly(DbContextScopeOption.JoinExisting)).Returns(mockDbContextScope.Object); mockDbContextScope.Setup(x => x.DbContexts.Get<EFDbContext>()).Returns(mockEfDbContext.Object); var dbEntry1 = new DocumentType { Id = "dummyEntryId1", DocTypeName = "Name1", DocTypeAltName = "NameAlt1", IsActive_bl = false }; var dbEntry2 = new DocumentType { Id = "dummyEntryId2", DocTypeName = "Name2", DocTypeAltName = "NameAlt2", IsActive_bl = true }; var dbEntry3 = new DocumentType { Id = "dummyEntryId3", DocTypeName = "Name3", DocTypeAltName = "NameAlt3", IsActive_bl = true }; var dbEntries = (new List<DocumentType> { dbEntry1, dbEntry2, dbEntry3 }).AsQueryable(); var mockDbSet = new Mock<DbSet<DocumentType>>(); mockDbSet.As<IDbAsyncEnumerable<DocumentType>>().Setup(m => m.GetAsyncEnumerator()).Returns(new MockDbAsyncEnumerator<DocumentType>(dbEntries.GetEnumerator())); mockDbSet.As<IQueryable<DocumentType>>().Setup(m => m.Provider).Returns(new MockDbAsyncQueryProvider<DocumentType>(dbEntries.Provider)); mockDbSet.As<IQueryable<DocumentType>>().Setup(m => m.Expression).Returns(dbEntries.Expression); mockDbSet.As<IQueryable<DocumentType>>().Setup(m => m.ElementType).Returns(dbEntries.ElementType); mockDbSet.As<IQueryable<DocumentType>>().Setup(m => m.GetEnumerator()).Returns(dbEntries.GetEnumerator()); mockDbSet.Setup(x => x.Include(It.IsAny<string>())).Returns(mockDbSet.Object); mockEfDbContext.Setup(x => x.DocumentTypes).Returns(mockDbSet.Object); var docTypeService = new DocumentTypeService(mockDbContextScopeFac.Object, "dummyUserId"); //Act var serviceResult = docTypeService.GetAsync(new string[] { "dummyEntryId3" }).Result; //Assert Assert.IsTrue(serviceResult.Count == 1); Assert.IsTrue(serviceResult[0].DocTypeAltName.Contains("NameAlt3")); }
public void Init() { _mediatorMock = new Mock <IMediator>(); _documentTypeRepositoryMock = new Mock <IRepository <DocumentType> >(); _mongoQueryableMock = new Mock <IMongoQueryable <DocumentType> >(); _expected = new List <DocumentType> { new DocumentType() { Name = "name1", Description = "t1", DisplayOrder = 0 }, new DocumentType() { Name = "name2", Description = "t2", DisplayOrder = 1 } }; _expectedQueryable = _expected.AsQueryable(); _mongoQueryableMock.Setup(x => x.ElementType).Returns(_expectedQueryable.ElementType); _mongoQueryableMock.Setup(x => x.Expression).Returns(_expectedQueryable.Expression); _mongoQueryableMock.Setup(x => x.Provider).Returns(_expectedQueryable.Provider); _mongoQueryableMock.Setup(x => x.GetEnumerator()).Returns(_expectedQueryable.GetEnumerator()); _documentTypeRepositoryMock.Setup(x => x.Table).Returns(_mongoQueryableMock.Object); _documentTypeService = new DocumentTypeService(_documentTypeRepositoryMock.Object, _mediatorMock.Object); }
public JsonResult GetLastValues() { List <ProductUidLastValues> ProductUidLastValuesJson = new List <ProductUidLastValues>(); int DocTypeId = new DocumentTypeService(_unitOfWork).Find(MasterDocTypeConstants.ProductUid).DocumentTypeId; string CreatedBy = User.Identity.Name.ToString(); ProductUidLastValues temp = (from H in context.ProductUidHeader join L in context.ProductUid on H.ProductUidHeaderId equals L.ProductUidHeaderId into ProductUidTable from ProductUidTab in ProductUidTable.DefaultIfEmpty() where H.GenDocTypeId == DocTypeId && H.CreatedBy == CreatedBy orderby H.ProductUidHeaderId descending select new ProductUidLastValues { PersonId = H.GenPersonId, PersonName = H.GenPerson.Name, GodownId = ProductUidTab.CurrenctGodownId, GodownName = ProductUidTab.CurrenctGodown.GodownName, ProcessId = ProductUidTab.CurrenctProcessId, ProcessName = ProductUidTab.CurrenctProcess.ProcessName, }).Take(1).FirstOrDefault(); ProductUidLastValuesJson.Add(temp); return(Json(ProductUidLastValuesJson)); }
public ActionResult DocumentMenu(int DocTypeId, int DocId) { if (DocTypeId == 0 || DocId == 0) { return(View("Error")); } int DivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"]; int SiteId = (int)System.Web.HttpContext.Current.Session["SiteId"]; var DocumentType = new DocumentTypeService(_unitOfWork).Find(DocTypeId); if (DocumentType.ControllerActionId.HasValue && DocumentType.ControllerActionId.Value > 0) { ControllerAction CA = new ControllerActionService(_unitOfWork).Find(DocumentType.ControllerActionId.Value); if (CA == null) { return(View("~/Views/Shared/UnderImplementation.cshtml")); } else if (!string.IsNullOrEmpty(DocumentType.DomainName)) { return(Redirect(System.Configuration.ConfigurationManager.AppSettings[DocumentType.DomainName] + "/" + CA.ControllerName + "/" + CA.ActionName + "/" + DocId)); } else { return(RedirectToAction(CA.ActionName, CA.ControllerName, new { id = DocId })); } } ViewBag.RetUrl = System.Web.HttpContext.Current.Request.UrlReferrer; HandleErrorInfo Excp = new HandleErrorInfo(new Exception("Document Settings not Configured"), "StockInHand", "DocumentMenu"); return(View("Error", Excp)); }
protected void btnSave_Click(object sender, EventArgs e) { try { switch (RowID) { case 0: DocumentTypeService.Add( txtDescription.Text, chkIsLastState.Checked, ddlCustomerStatus.SelectedValue.ToDefaultNumber <int>()); break; default: DocumentTypeService.Update( RowID, txtDescription.Text, chkIsLastState.Checked, ddlCustomerStatus.SelectedValue.ToDefaultNumber <int>()); break; } Refresh(); } catch (Exception ex) { WebFormHelper.SetLabelTextWithCssClass(lblMessage, ex.Message, LabelStyleNames.ErrorMessage); LogService.ErrorException(GetType().FullName, ex); } }
public ActionResult Report() { DocumentType Dt = new DocumentType(); Dt = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.Buyer); return(Redirect((string)System.Configuration.ConfigurationManager.AppSettings["JobsDomain"] + "/Report_ReportPrint/ReportPrint/?MenuId=" + Dt.ReportMenuId)); }
public void PrepareViewBag(int id) { DocumentType DocType = new DocumentTypeService(_unitOfWork).Find(id); ViewBag.Name = DocType.DocumentTypeName; ViewBag.id = id; ViewBag.ReasonList = new ReasonService(_unitOfWork).GetReasonList(DocType.DocumentTypeName).ToList(); }
private async Task <IList <DocumentTypeModel> > GetItemsAsync() { if (!ViewModelArgs.IsEmpty) { DataRequest <Data.DocumentType> request = BuildDataRequest(); return(await DocumentTypeService.GetDocumentTypesAsync(request)); } return(new List <DocumentTypeModel>()); }
/// <summary> /// Get the document type service /// </summary> /// <returns></returns> private DocumentTypeService GetDocumentTypeService() { if (_documentTypeService == null) { var rockContext = GetRockContext(); _documentTypeService = new DocumentTypeService(rockContext); } return(_documentTypeService); }
private void PrepareViewBag(int id) { DocumentType DocType = new DocumentTypeService(_unitOfWork).Find(id); int Cid = DocType.DocumentCategoryId; ViewBag.DocTypeList = new DocumentTypeService(_unitOfWork).FindByDocumentCategory(Cid).ToList(); ViewBag.Name = DocType.DocumentTypeName; ViewBag.id = id; var DivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"]; var SiteId = (int)System.Web.HttpContext.Current.Session["SiteId"]; }
// GET: CustomerDocument/Create public ActionResult Create() { var model = new CustomerDocumentModel(); var DocumentTypeService = new DocumentTypeService(); model.DocumentTypeSelectList = DocumentTypeService.GetSelectList(); var CustomerService = new CustomerService(); model.CustomerSelectList = CustomerService.GetSelectList(); return(View(model)); }
/// <summary> /// Handles the GridReorder event of the gDocumentTypes control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> private void gDocumentTypes_GridReorder(object sender, GridReorderEventArgs e) { var rockContext = GetRockContext(); var documentTypeService = new DocumentTypeService(rockContext); var documentTypes = documentTypeService.Queryable().OrderBy(dt => dt.Order).ToList(); documentTypeService.Reorder(documentTypes, e.OldIndex, e.NewIndex); rockContext.SaveChanges(); BindGrid(); }
// GET: /JobReceiveHeader/Create public ActionResult Create()//DocumentTypeId { JobReceiveHeaderViewModel p = new JobReceiveHeaderViewModel(); p.DocDate = DateTime.Now; p.CreatedDate = DateTime.Now; p.DivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"]; p.SiteId = (int)System.Web.HttpContext.Current.Session["SiteId"]; List <string> UserRoles = (List <string>)System.Web.HttpContext.Current.Session["Roles"]; int DocTypeId = new DocumentTypeService(_unitOfWork).Find(TransactionDoctypeConstants.WeavingBazar).DocumentTypeId; p.DocTypeId = DocTypeId; //Getting Settings var settings = new JobReceiveSettingsService(_unitOfWork).GetJobReceiveSettingsForDocument(DocTypeId, p.DivisionId, p.SiteId); if (settings == null && UserRoles.Contains("SysAdmin")) { return(RedirectToAction("Create", "JobReceiveSettings", new { id = DocTypeId }).Warning("Please create job order settings")); } else if (settings == null && !UserRoles.Contains("SysAdmin")) { return(View("~/Views/Shared/InValidSettings.cshtml")); } p.JobReceiveSettings = Mapper.Map <JobReceiveSettings, JobReceiveSettingsViewModel>(settings); if (System.Web.HttpContext.Current.Session["BarCodesWeavingWizardJobOrder"] == null) { return(Redirect(System.Configuration.ConfigurationManager.AppSettings["JobsDomain"] + "/JobReceiveHeader/Index/" + DocTypeId)); } var JobOrderLin = ((List <WeavingReceiveWizardViewModel>)System.Web.HttpContext.Current.Session["BarCodesWeavingWizardJobOrder"]).FirstOrDefault(); //p.JobReceiveById = new EmployeeService(_unitOfWork).GetEmloyeeForUser(User.Identity.GetUserId()); p.ProcessId = settings.ProcessId; if (System.Web.HttpContext.Current.Session["DefaultGodownId"] != null) { p.GodownId = (int)System.Web.HttpContext.Current.Session["DefaultGodownId"]; } PrepareViewBag(); p.DocTypeId = DocTypeId; p.DocNo = new DocumentTypeService(_unitOfWork).FGetNewDocNo("DocNo", ConfigurationManager.AppSettings["DataBaseSchema"] + ".JobReceiveHeaders", p.DocTypeId, p.DocDate, p.DivisionId, p.SiteId); List <WeavingReceiveWizardViewModel> JobOrdersAndQtys = (List <WeavingReceiveWizardViewModel>)System.Web.HttpContext.Current.Session["BarCodesWeavingWizardJobOrder"]; p.JobWorkerId = JobOrdersAndQtys.FirstOrDefault().JobWorkerId; return(View(p)); }
public ActionResult DocumentTypeIndex(int id)//DocumentCategoryId { var p = new DocumentTypeService(_unitOfWork).FindByDocumentCategory(id).ToList(); if (p != null) { if (p.Count == 1) { return(RedirectToAction("RateAmendtmentWizard", new { id = p.FirstOrDefault().DocumentTypeId })); } } return(View("DocumentTypeList", p)); }
protected void gvwMaster_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditRow") { int id = Convert.ToInt32(e.CommandArgument); RowID = id; mvwForm.SetActiveView(viwAddEdit); DocumentType docType = DocumentTypeService.Get(id); txtDescription.Text = docType.Description; chkIsLastState.Checked = docType.IsLastState; ddlCustomerStatus.SelectedValue = !docType.ChangeCustomerStatusIDTo.HasValue ? String.Empty : docType.ChangeCustomerStatusIDTo.Value.ToString(); txtDescription.Focus(); } }
public ActionResult Report(int id) { DocumentType Dt = new DocumentType(); Dt = new DocumentTypeService(_unitOfWork).Find(id); PackingSetting SEttings = new PackingSettingService(_unitOfWork).GetPackingSettingForDocument(Dt.DocumentTypeId, (int)System.Web.HttpContext.Current.Session["DivisionId"], (int)System.Web.HttpContext.Current.Session["SiteId"]); Dictionary <int, string> DefaultValue = new Dictionary <int, string>(); //if (!Dt.ReportMenuId.HasValue) // throw new Exception("Report Menu not configured in document types"); if (!Dt.ReportMenuId.HasValue) { return(Redirect((string)System.Configuration.ConfigurationManager.AppSettings["JobsDomain"] + "/GridReport/GridReportLayout/?MenuName=Packing Report&DocTypeId=" + id.ToString())); } Model.Models.Menu menu = new MenuService(_unitOfWork).Find(Dt.ReportMenuId ?? 0); if (menu != null) { ReportHeader header = new ReportHeaderService(_unitOfWork).GetReportHeaderByName(menu.MenuName); ReportLine Line = new ReportLineService(_unitOfWork).GetReportLineByName("DocumentType", header.ReportHeaderId); if (Line != null) { DefaultValue.Add(Line.ReportLineId, id.ToString()); } ReportLine Site = new ReportLineService(_unitOfWork).GetReportLineByName("Site", header.ReportHeaderId); if (Site != null) { DefaultValue.Add(Site.ReportLineId, ((int)System.Web.HttpContext.Current.Session["SiteId"]).ToString()); } ReportLine Division = new ReportLineService(_unitOfWork).GetReportLineByName("Division", header.ReportHeaderId); if (Division != null) { DefaultValue.Add(Division.ReportLineId, ((int)System.Web.HttpContext.Current.Session["DivisionId"]).ToString()); } //ReportLine Process = new ReportLineService(_unitOfWork).GetReportLineByName("Process", header.ReportHeaderId); //if (Process != null) // DefaultValue.Add(Process.ReportLineId, ((int)SEttings.ProcessId).ToString()); } TempData["ReportLayoutDefaultValues"] = DefaultValue; return(Redirect((string)System.Configuration.ConfigurationManager.AppSettings["JobsDomain"] + "/Report_ReportPrint/ReportPrint/?MenuId=" + Dt.ReportMenuId)); }
public ActionResult SummarizeProdOrders() { int DivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"]; int SiteId = (int)System.Web.HttpContext.Current.Session["SiteId"]; List <string> UserRoles = (List <string>)System.Web.HttpContext.Current.Session["Roles"]; int DocTypeId = new DocumentTypeService(_unitOfWork).Find(TransactionDoctypeConstants.DyeingOrder).DocumentTypeId; //Getting Settings var settings = new JobOrderSettingsService(_unitOfWork).GetJobOrderSettingsForDocument(DocTypeId, DivisionId, SiteId); ViewBag.AllowedPerc = settings.ExcessQtyAllowedPer; return(View("SummarizeProdOrders")); }
public ActionResult DocumentTypeIndex(int id)//DocumentCategoryId { var p = new DocumentTypeService(_unitOfWork).FindByDocumentCategory(id).ToList(); //System.Web.HttpContext.Current.Session["MaterialPlanType"] = MaterialPlanTypeConstants.ProdOrder; if (p != null) { if (p.Count == 1) { return(RedirectToAction("Index", new { id = p.FirstOrDefault().DocumentTypeId })); } } return(View("DocumentTypeList", p)); }
// GET: /JobOrderHeader/Create public ActionResult Create()//DocumentTypeId { JobOrderHeaderViewModel p = new JobOrderHeaderViewModel(); p.DocDate = DateTime.Now; p.DueDate = DateTime.Now; p.DivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"]; p.SiteId = (int)System.Web.HttpContext.Current.Session["SiteId"]; p.CreatedDate = DateTime.Now; List <string> UserRoles = (List <string>)System.Web.HttpContext.Current.Session["Roles"]; int DocTypeId = new DocumentTypeService(_unitOfWork).Find(TransactionDoctypeConstants.DyeingOrder).DocumentTypeId; //Getting Settings var settings = new JobOrderSettingsService(_unitOfWork).GetJobOrderSettingsForDocument(DocTypeId, p.DivisionId, p.SiteId); if (settings == null && UserRoles.Contains("SysAdmin")) { return(RedirectToAction("Create", "JobOrderSettings", new { id = DocTypeId }).Warning("Please create job order settings")); } else if (settings == null && !UserRoles.Contains("SysAdmin")) { return(View("~/Views/Shared/InValidSettings.cshtml")); } p.JobOrderSettings = Mapper.Map <JobOrderSettings, JobOrderSettingsViewModel>(settings); List <PerkViewModel> Perks = new List <PerkViewModel>(); //Perks if (p.JobOrderSettings.Perks != null) { foreach (var item in p.JobOrderSettings.Perks.Split(',').ToList()) { PerkViewModel temp = Mapper.Map <Perk, PerkViewModel>(new PerkService(_unitOfWork).Find(Convert.ToInt32(item))); Perks.Add(temp); } } p.PerkViewModel = Perks; p.ProcessId = settings.ProcessId; PrepareViewBag(); p.DocTypeId = DocTypeId; p.DocNo = new DocumentTypeService(_unitOfWork).FGetNewDocNo("DocNo", ConfigurationManager.AppSettings["DataBaseSchema"] + ".JobOrderHeaders", p.DocTypeId, p.DocDate, p.DivisionId, p.SiteId); return(View(p)); }
public void DocumentTypeService_CheckInsert_ThrowNameException() { // Arrange var mock = new Mock <IDocumentTypeRepository>(); mock.Setup(repo => repo.Create(new DocumentTypeEntity())) .Returns(() => Task.CompletedTask); var service = new DocumentTypeService(mock.Object); // Act var ex = Assert.ThrowsAnyAsync <NameException>(() => service.Create(new DocumentType())); // Assert Assert.Equal("The DocumentType have not empty or null name.", ex.Result.Message); }
public void DocumentTypeService_CheckInsert_Created() { // Arrange var mock = new Mock <IDocumentTypeRepository>(); mock.Setup(repo => repo.Create(StubsObjects.DocumentType.ToEntity())) .Returns(() => Task.CompletedTask); var service = new DocumentTypeService(mock.Object); // Act var result = service.Create(StubsObjects.DocumentType).Result; // Assert Assert.Equal(StatusCode.Created, result); }
private ActionResult _Modify(int id) { JobReceiveQAPenaltyViewModel temp = _JobReceiveQAPenaltyService.GetJobReceiveQAPenaltyForEdit(id); JobReceiveQALine L = new JobReceiveQALineService(db, _unitOfWork).Find(temp.JobReceiveQALineId); JobReceiveQAHeader Header = new JobReceiveQAHeaderService(db).Find(L.JobReceiveQAHeaderId); DocumentType D = new DocumentTypeService(_unitOfWork).Find(Header.DocTypeId); if (temp == null) { return(HttpNotFound()); } #region DocTypeTimeLineValidation try { TimePlanValidation = DocumentValidation.ValidateDocumentLine(new DocumentUniqueId { LockReason = temp.LockReason }, User.Identity.Name, out ExceptionMsg, out Continue); } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXCL"] += message; TimePlanValidation = false; } if (!TimePlanValidation) { TempData["CSEXCL"] += ExceptionMsg; } #endregion if ((TimePlanValidation || Continue)) { ViewBag.LineMode = "Edit"; } PrepareViewBag(); //ViewBag.DocNo = D.DocumentTypeName + "-" + Header.DocNo; ViewBag.DocNo = D.DocumentTypeName + "-" + Header.DocNo + " ( Deal Qty : " + L.DealQty.ToString() + " )"; return(PartialView("_Create", temp)); }
//GET: CustomerDocument/Edit/5 public ActionResult Edit(int id) { #region DocumentTypeService var DocumentTypeService = new DocumentTypeService(); #region CustomerService var CustomerService = new CustomerService(); #endregion var model = new CustomerDocumentModel() { CustomerDocument = _service.GetDetails(id), CustomerSelectList = CustomerService.GetSelectList(), DocumentTypeSelectList = DocumentTypeService.GetSelectList(), }; return(View(model)); }
public ActionResult _Create(int Id) //Id ==> JobReceiveQALineId { JobReceiveQALine L = new JobReceiveQALineService(db, _unitOfWork).Find(Id); JobReceiveQAHeader H = new JobReceiveQAHeaderService(db).Find(L.JobReceiveQAHeaderId); DocumentType D = new DocumentTypeService(_unitOfWork).Find(H.DocTypeId); JobReceiveQAPenaltyViewModel s = new JobReceiveQAPenaltyViewModel(); s.DocTypeId = H.DocTypeId; s.JobReceiveQALineId = Id; //Getting Settings PrepareViewBag(); if (!string.IsNullOrEmpty((string)TempData["CSEXCL"])) { ViewBag.CSEXCL = TempData["CSEXCL"]; TempData["CSEXCL"] = null; } ViewBag.LineMode = "Create"; ViewBag.DocNo = D.DocumentTypeName + "-" + H.DocNo; return(PartialView("_Create", s)); }
//Constructors---------------------------------------------------------------------------------------------------------// public DocumentTypeSrvController(DocumentTypeService documentTypeService) { this.documentTypeService = documentTypeService; }