public async Task <IActionResult> Index() { // 3.系統在Action【Home/Index】讀取首頁行銷圖示。 List <HomeImageViewModel> lHIMV = await IMR.GetHomeImageList(0, 1000); // 4.系統在Action【Home/Index】讀取youtube影片網址。 YoutubeVideoViewModel YVVM = await IPR.GetYoutubeVideoList(); // 5.系統在Action【Home/Index】讀取最新商品清單。 List <ProductListViewModel> lPLVM = await IPRR.GetNewProductList(6); // 6.系統傳回View【Home/Index】,並回傳new HomeViewModel { HomeImage=3讀取值, YoutubeVideo=4讀取值, NewProduct=5讀取值}。 ViewBag.MemberMobile = HttpContext.Session.GetString("MemberMobile"); if (HttpContext.Session.GetInt32("MemberLevelId") != null) { ViewBag.MemberLevelId = HttpContext.Session.GetInt32("MemberLevelId"); } else { ViewBag.MemberLevelId = -1; } ViewBag.NickName = HttpContext.Session.GetString("NickName"); return(View(new HomeViewModel { HomeImage = lHIMV, YoutubeVideo = YVVM, NewProduct = lPLVM })); }
public async Task <IViewComponentResult> InvokeAsync(int Month, string ReferrerMobile, string AClass, int Page = 1, int StartPage = 1) { //9-1.系統在ViewComponent【MemberBonusList】中讀取Appsetting.json中的每頁筆數RowsPerPage以及分頁頁碼連結總數PageCount。 int RowsPerPage = int.Parse(config["Page:RowsPerPage"]); int PageCount = int.Parse(config["Page:PageCount"]); //9-2.系統在ViewComponent【MemberBonusList】讀取批發會員獎金記錄總數。 long BonusListCount = await IMR.GetMemberBonusListCount(Month, ReferrerMobile); //9-3.系統依9-2傳回值將9傳送頁碼重設在Between 1 and(9讀取記錄筆數/RowsPerPage)+(9讀取記錄筆數%RowsPerPage==0?0:1)。 int TotalPages = (int)(BonusListCount / RowsPerPage); if (BonusListCount % RowsPerPage > 0) { TotalPages += 1; } if (Page < 1) { Page = 1; } if (Page > TotalPages) { Page = TotalPages; } if (Page <= 0) { Page = 1; } //9-4.系統計算資料Skip數 = (9傳送頁碼(預設1) - 1)*9 - 1讀取RowsPerPage。 int Skip = (Page - 1) * RowsPerPage; //9-5.系統在ViewComponent【MemberBonusListViewComponent】讀取批發會員獎金記錄清單: List <MemberBonusListViewModel> MLVM = await IPR.GetMemberBonusList(Month, ReferrerMobile, Skip, RowsPerPage); //9-6.系統設定PagerTagHelper之相關參數 int CurrentPage = Page; //9-6-1.系統將管理者權限清單Session["EmployeeRights"]暫存在ViewBag.TR。 ViewBag.TR = HttpContext.Session.GetObjectFromJson <List <int> >("EmployeeRights"); ViewBag.Page = Page; //9 - 7.系統回傳View(new MemberBonusListManageViewModel //{ // listMemberBonusListViewModel = 9 - 5讀取值, // CurrentPage = 9 - 6設定值, // TotalPages = 9 - 6設定值, // PageCount = 9 - 6設定值, // StartPage = 9 - 6設定值, // Parameters = 9 - 6設定值 //}); return(View(new MemberBonusListManageViewModel { listMemberBonusListViewModel = MLVM, CurrentPage = CurrentPage, TotalPages = TotalPages, PageCount = PageCount, StartPage = StartPage, Parameters = Page, BonusListCount = BonusListCount, //測試用 })); }
public async Task <IActionResult> GetFreight(int CartTotals) { // 9-2.系統在Get Action【Cart/GetFreight】讀取運費: OrderFreightViewModel ofvm = await IPR.GetOrderFreight(CartTotals); // 9-3.系統回傳json( new { Freight=9-2讀取值}) return(Json(new { Freight = ofvm })); }
public ActionResult DeleteConfirmed(int id) { IPR iPR = db.Iprs.Find(id); db.Iprs.Remove(iPR); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,ParentCaseId,StartDate,EndDate,MedicalActNo,NextDateExamination")] IPR iPR) { if (ModelState.IsValid) { db.Entry(iPR).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ParentCaseId = new SelectList(db.ParentCases, "Id", "FullName", iPR.ParentCaseId); return(View(iPR)); }
///<summary> /// Returns first repetition of IPR (Invoice Processing Results) - creates it if necessary ///</summary> public IPR GetIPR() { IPR ret = null; try { ret = (IPR)this.GetStructure("IPR"); } catch (HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e); throw new System.Exception("An unexpected error ocurred", e); } return(ret); }
// GET: IPRs/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } IPR iPR = db.Iprs.Find(id); if (iPR == null) { return(HttpNotFound()); } return(View(iPR)); }
// GET: IPRs/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } IPR iPR = db.Iprs.Find(id); if (iPR == null) { return(HttpNotFound()); } ViewBag.ParentCaseId = new SelectList(db.ParentCases, "Id", "FullName", iPR.ParentCaseId); return(View(iPR)); }
// GET: IPRs/Create public ActionResult Create(int patientId) { var parentCase = db.ParentCases.Include(x => x.Patient).FirstOrDefault(x => x.PatientId == patientId); var ipr = new IPR { ParentCaseId = parentCase.Id, ParentCase = parentCase }; var targets = db.RehabilitationTargets.ToList(); targets.Insert(0, new RehabilitationTarget()); ViewBag.TargetSelected = new MultiSelectList(targets, "Id", "Name"); var model = new CreateIPRViewModel { IPR = ipr }; return(View(model)); }
public async Task <int> GetOutFreight(string ContactAddress) { int ret = 0; try { // 3-2.系統在Get Action【Cart/GetOutFreight】讀取離島地區資料: List <OutlyingIslandViewModel> lstOIVM = await IPR.GetOutlyingIslandList(); bool isIs = false; foreach (var item in lstOIVM) { if (ContactAddress.Contains(item.OutlyingIsland)) { isIs = true; break; } } if (isIs) { // 3-3.系統判斷3-1上傳送貨地址中包含3-2之離島地區名稱。 // 3-4.系統回傳1。 ret = 1; } else { // 3-3.a系統判斷3-1上傳送貨地址中未包含3-2之離島地區名稱。 // 3-3a-1.系統回傳0。 ret = 0; } } catch (Exception ex) { ret = 0; } return(ret); }
public ActionResult Create(FormCollection collection) { var parentCaseId = int.Parse(collection["IPR.ParentCaseId"]); var parentCase = db.ParentCases.Include(x => x.Patient).FirstOrDefault(x => x.Id == parentCaseId); var ipr = new IPR { ParentCaseId = parentCaseId, ParentCase = parentCase }; var model = new CreateIPRViewModel { IPR = ipr, Targets = new List <RehabilitationTargetToIPR>() }; if (collection.AllKeys.Contains("TargetSelected")) { var TargetSelectedStr = collection["TargetSelected"]; if (string.IsNullOrEmpty(TargetSelectedStr)) { ModelState.AddModelError("TargetSelected", "Это поле обязательное!"); } else { model.TargetSelected = TargetSelectedStr.Split(','); } } else { ModelState.AddModelError("TargetSelected", "Это поле обязательное!"); } if (collection.AllKeys.Contains("IPR.StartDate")) { var startDateStr = collection["IPR.StartDate"]; DateTime startDate = DateTime.MinValue; if (!DateTime.TryParse(startDateStr, out startDate)) { ModelState.AddModelError("IPR.StartDate", "Это поле обязательное!"); } else { model.IPR.StartDate = startDate; } } if (collection.AllKeys.Contains("IPR.EndDate")) { var endDateStr = collection["IPR.EndDate"]; DateTime endDate = DateTime.MinValue; if (!DateTime.TryParse(endDateStr, out endDate)) { ModelState.AddModelError("IPR.EndDate", "Это поле обязательное!"); } else { model.IPR.EndDate = endDate; } } if (collection.AllKeys.Contains("IPR.MedicalActNo")) { var medicalActNoStr = collection["IPR.MedicalActNo"]; if (string.IsNullOrEmpty(medicalActNoStr)) { ModelState.AddModelError("IPR.MedicalActNo", "Это поле обязательное!"); } else { model.IPR.MedicalActNo = medicalActNoStr; } } if (collection.AllKeys.Contains("IPR.NextDateExamination")) { var NextDateExaminationStr = collection["IPR.NextDateExamination"]; DateTime NextDateExamination = DateTime.MinValue; if (!DateTime.TryParse(NextDateExaminationStr, out NextDateExamination)) { ModelState.AddModelError("IPR.NextDateExamination", "Это поле обязательное!"); } else { model.IPR.NextDateExamination = NextDateExamination; } } if (ModelState.IsValid) { //db.Iprs.Add(model.IPR); //db.SaveChanges(); var targetNo = 1; foreach (var targetId in model.TargetSelected.Select(x => int.Parse(x))) { model.Targets.Add(new RehabilitationTargetToIPR { RehabilitationTarget = db.RehabilitationTargets.Find(targetId), TargetId = targetId, No = targetNo }); targetNo++; } var question = db.Questions.FirstOrDefault(x => x.PatientId == model.IPR.ParentCase.PatientId); if (question == null) { return(HttpNotFound("Question not found!")); } model.QuestionViewModel = new QuestionViewModel { Question = question }; model.QuestionViewModel.Answers1 = db.Answers1.Where(x => x.QuestionId == question.Id).ToList(); model.QuestionViewModel.Answers2 = db.Answers2.Where(x => x.QuestionId == question.Id).ToList(); model.QuestionViewModel.Answers3 = db.Answers3.Where(x => x.QuestionId == question.Id).ToList(); model.QuestionViewModel.Answers4 = db.Answers4.Where(x => x.QuestionId == question.Id).ToList(); ViewBag.Answer1Values = db.Answer1Values.ToList(); ViewBag.Answer2Values1 = db.Answer2Values1.ToList(); ViewBag.Answer2Values2 = db.Answer2Values2.ToList(); ViewBag.Answer3Values1 = db.Answer3Values1.ToList(); ViewBag.Answer3Values2 = db.Answer3Values2.ToList(); ViewBag.Answer4Values = db.Answer4Values.ToList(); model.AnswerTargets1 = new List <AnswerTarget1>(); model.AnswerTargets2 = new List <AnswerTarget2>(); model.AnswerTargets3 = new List <AnswerTarget3>(); model.AnswerTargets4 = new List <AnswerTarget4>(); model.SelectedTargets1 = new List <SelectedTarget1>(); model.SelectedTargets2 = new List <SelectedTarget2>(); model.SelectedTargets3 = new List <SelectedTarget3>(); model.SelectedTargets4 = new List <SelectedTarget4>(); model.SelectedServices1 = new List <SelectedService1>(); model.SelectedServices2 = new List <SelectedService2>(); model.SelectedServices3 = new List <SelectedService3>(); model.SelectedServices4 = new List <SelectedService4>(); model.ServiceTypes = db.ServiceTypes.ToList(); return(View("CreateMain", model)); } var targets = db.RehabilitationTargets.ToList(); targets.Insert(0, new RehabilitationTarget()); ViewBag.TargetSelected = new MultiSelectList(targets, "Id", "Name", model.TargetSelected); return(View(model)); }
public ActionResult CreateMain(FormCollection collection) { var parentCaseId = int.Parse(collection["IPR.ParentCaseId"]); var parentCase = db.ParentCases.Include(x => x.Patient).FirstOrDefault(x => x.Id == parentCaseId); var ipr = new IPR { ParentCaseId = parentCaseId, ParentCase = parentCase }; var model = new CreateIPRViewModel { IPR = ipr, Targets = new List <RehabilitationTargetToIPR>() }; if (collection.AllKeys.Contains("TargetSelected")) { var TargetSelectedStr = collection["TargetSelected"]; if (string.IsNullOrEmpty(TargetSelectedStr)) { ModelState.AddModelError("TargetSelected", "Это поле обязательное!"); } else { model.TargetSelected = TargetSelectedStr.Split(','); } } else { ModelState.AddModelError("TargetSelected", "Это поле обязательное!"); } if (collection.AllKeys.Contains("IPR.StartDate")) { var startDateStr = collection["IPR.StartDate"]; DateTime startDate = DateTime.MinValue; if (!DateTime.TryParse(startDateStr, out startDate)) { ModelState.AddModelError("IPR.StartDate", "Это поле обязательное!"); } else { model.IPR.StartDate = startDate; } } if (collection.AllKeys.Contains("IPR.EndDate")) { var endDateStr = collection["IPR.EndDate"]; DateTime endDate = DateTime.MinValue; if (!DateTime.TryParse(endDateStr, out endDate)) { ModelState.AddModelError("IPR.EndDate", "Это поле обязательное!"); } else { model.IPR.EndDate = endDate; } } if (collection.AllKeys.Contains("IPR.MedicalActNo")) { var medicalActNoStr = collection["IPR.MedicalActNo"]; if (string.IsNullOrEmpty(medicalActNoStr)) { ModelState.AddModelError("IPR.MedicalActNo", "Это поле обязательное!"); } else { model.IPR.MedicalActNo = medicalActNoStr; } } if (collection.AllKeys.Contains("IPR.NextDateExamination")) { var NextDateExaminationStr = collection["IPR.NextDateExamination"]; DateTime NextDateExamination = DateTime.MinValue; if (!DateTime.TryParse(NextDateExaminationStr, out NextDateExamination)) { ModelState.AddModelError("IPR.NextDateExamination", "Это поле обязательное!"); } else { model.IPR.NextDateExamination = NextDateExamination; } } var codes1 = db.Codes1.ToList(); var codes2 = db.Codes2.ToList(); var codes3 = db.Codes3.ToList(); var codes4 = db.Codes4.ToList(); var answers1 = new List <AnswerTarget1>(); var answers2 = new List <AnswerTarget2>(); var answers3 = new List <AnswerTarget3>(); var answers4 = new List <AnswerTarget4>(); var selectedTargets1 = new List <SelectedTarget1>(); var selectedTargets2 = new List <SelectedTarget2>(); var selectedTargets3 = new List <SelectedTarget3>(); var selectedTargets4 = new List <SelectedTarget4>(); var selectedServices1 = new List <SelectedService1>(); var selectedServices2 = new List <SelectedService2>(); var selectedServices3 = new List <SelectedService3>(); var selectedServices4 = new List <SelectedService4>(); foreach (var code in codes1) { //parsing the selected target values var codeVal = ""; if (collection.AllKeys.Contains(code.Name + "_target")) { codeVal = collection[code.Name + "_target"]; } int valId = 0; if (!string.IsNullOrEmpty(codeVal)) { valId = int.Parse(codeVal); } else { ModelState.AddModelError(code.Name + "_target", "Значение цели для кода \"" + code.Name + "\" не указано."); } answers1.Add(new AnswerTarget1 { CodeId = code.Id, Code = code, ValueId = valId, IPR = model.IPR }); //parsing the selected target no var codeTarget = ""; if (collection.AllKeys.Contains(code.Name + "_target_id")) { codeTarget = collection[code.Name + "_target_id"]; } int codeTargetValId = 0; if (!string.IsNullOrEmpty(codeTarget)) { codeTargetValId = int.Parse(codeTarget); } else { ModelState.AddModelError(code.Name + "_target_id", "Номер цели для кода \"" + code.Name + "\" не указан."); } selectedTargets1.Add(new SelectedTarget1 { CodeId = code.Id, Code = code, TargetId = codeTargetValId, IPR = model.IPR }); //parsing the selected service var codeService = ""; if (collection.AllKeys.Contains(code.Name + "_service_id")) { codeService = collection[code.Name + "_service_id"]; } int[] codeServiceValIds = { 0 }; if (!string.IsNullOrEmpty(codeService)) { codeServiceValIds = codeService.Split(',').Select(x => int.Parse(x)).ToArray(); } else { ModelState.AddModelError(code.Name + "_service_id", "Услуга для кода \"" + code.Name + "\" не указан."); } foreach (var codeServiceValId in codeServiceValIds) { selectedServices1.Add(new SelectedService1 { CodeId = code.Id, Code = code, ServiceTypeId = codeServiceValId, IPR = model.IPR }); } } foreach (var code in codes2) { var codeVal1 = ""; if (collection.AllKeys.Contains(code.Name + "_v1_target")) { codeVal1 = collection[code.Name + "_v1_target"]; } int valId1 = 0; if (!string.IsNullOrEmpty(codeVal1)) { valId1 = int.Parse(codeVal1); } else { ModelState.AddModelError(code.Name + "_v1_target", "Значение цели для кода \"" + code.Name + "_v1" + "\" не указан."); } var codeVal2 = ""; if (collection.AllKeys.Contains(code.Name + "_v2_target")) { codeVal2 = collection[code.Name + "_v2_target"]; } int valId2 = 0; if (!string.IsNullOrEmpty(codeVal2)) { valId2 = int.Parse(codeVal2); } else { ModelState.AddModelError(code.Name + "_v2_target", "Значение цели для кода \"" + code.Name + "_v2" + "\" не указан."); } answers2.Add(new AnswerTarget2 { CodeId = code.Id, Code = code, ValueId1 = valId1, ValueId2 = valId2, IPR = model.IPR }); //parsing the selected targets var codeTarget1 = ""; if (collection.AllKeys.Contains(code.Name + "_v1_target_id")) { codeTarget1 = collection[code.Name + "_v1_target_id"]; } int codeTargetValId1 = 0; if (!string.IsNullOrEmpty(codeTarget1)) { codeTargetValId1 = int.Parse(codeTarget1); } else { ModelState.AddModelError(code.Name + "_v1_target_id", "Номер цели для кода \"" + code.Name + "\" не указан."); } var codeTarget2 = ""; if (collection.AllKeys.Contains(code.Name + "_v2_target_id")) { codeTarget2 = collection[code.Name + "_v2_target_id"]; } int codeTargetValId2 = 0; if (!string.IsNullOrEmpty(codeTarget2)) { codeTargetValId2 = int.Parse(codeTarget2); } else { ModelState.AddModelError(code.Name + "_v2_target_id", "Номер цели для кода \"" + code.Name + "\" не указан."); } selectedTargets2.Add(new SelectedTarget2 { CodeId = code.Id, Code = code, TargetId1 = codeTargetValId1, TargetId2 = codeTargetValId2, IPR = model.IPR }); } foreach (var code in codes3) { var codeVal1 = ""; if (collection.AllKeys.Contains(code.Name + "_v1_target")) { codeVal1 = collection[code.Name + "_v1_target"]; } int valId1 = 0; if (!string.IsNullOrEmpty(codeVal1)) { valId1 = int.Parse(codeVal1); } else { ModelState.AddModelError(code.Name + "_v1_target", "Значение цели для кода \"" + code.Name + "_v1" + "\" не указан."); } var codeVal2 = ""; if (collection.AllKeys.Contains(code.Name + "_v2_target")) { codeVal2 = collection[code.Name + "_v2_target"]; } int valId2 = 0; if (!string.IsNullOrEmpty(codeVal2)) { valId2 = int.Parse(codeVal2); } else { ModelState.AddModelError(code.Name + "_v2_target", "Значение цели для кода \"" + code.Name + "_v2" + "\" не указан."); } answers3.Add(new AnswerTarget3 { CodeId = code.Id, Code = code, ValueId1 = valId1, ValueId2 = valId2, IPR = model.IPR }); //parsing the selected targets var codeTarget1 = ""; if (collection.AllKeys.Contains(code.Name + "_v1_target_id")) { codeTarget1 = collection[code.Name + "_v1_target_id"]; } int codeTargetValId1 = 0; if (!string.IsNullOrEmpty(codeTarget1)) { codeTargetValId1 = int.Parse(codeTarget1); } else { ModelState.AddModelError(code.Name + "_v1_target_id", "Номер цели для кода \"" + code.Name + "\" не указан."); } var codeTarget2 = ""; if (collection.AllKeys.Contains(code.Name + "_v2_target_id")) { codeTarget2 = collection[code.Name + "_v2_target_id"]; } int codeTargetValId2 = 0; if (!string.IsNullOrEmpty(codeTarget2)) { codeTargetValId2 = int.Parse(codeTarget2); } else { ModelState.AddModelError(code.Name + "_v2_target_id", "Номер цели для кода \"" + code.Name + "\" не указан."); } selectedTargets3.Add(new SelectedTarget3 { CodeId = code.Id, Code = code, TargetId1 = codeTargetValId1, TargetId2 = codeTargetValId2, IPR = model.IPR }); } foreach (var code in codes4) { var codeVal = ""; if (collection.AllKeys.Contains(code.Name + "_target")) { codeVal = collection[code.Name + "_target"]; } int valId = 0; if (!string.IsNullOrEmpty(codeVal)) { valId = int.Parse(codeVal); } else { ModelState.AddModelError(code.Name + "_target", "Значение цели для кода \"" + code.Name + "\" не указан."); } answers4.Add(new AnswerTarget4 { CodeId = code.Id, Code = code, ValueId = valId, IPR = model.IPR }); //parsing the selected targets var codeTarget = ""; if (collection.AllKeys.Contains(code.Name + "_target_id")) { codeTarget = collection[code.Name + "_target_id"]; } int codeTargetValId = 0; if (!string.IsNullOrEmpty(codeTarget)) { codeTargetValId = int.Parse(codeTarget); } else { ModelState.AddModelError(code.Name + "_target_id", "Номер цели для кода \"" + code.Name + "\" не указан."); } selectedTargets4.Add(new SelectedTarget4 { CodeId = code.Id, Code = code, TargetId = codeTargetValId, IPR = model.IPR }); } if (ModelState.IsValid) { ModelState.AddModelError("", "success"); } model.AnswerTargets1 = answers1; model.AnswerTargets2 = answers2; model.AnswerTargets3 = answers3; model.AnswerTargets4 = answers4; model.SelectedTargets1 = selectedTargets1; model.SelectedTargets2 = selectedTargets2; model.SelectedTargets3 = selectedTargets3; model.SelectedTargets4 = selectedTargets4; model.SelectedServices1 = selectedServices1; var targetNo = 1; foreach (var targetId in model.TargetSelected.Select(x => int.Parse(x))) { model.Targets.Add(new RehabilitationTargetToIPR { RehabilitationTarget = db.RehabilitationTargets.Find(targetId), TargetId = targetId, No = targetNo }); targetNo++; } var question = db.Questions.FirstOrDefault(x => x.PatientId == model.IPR.ParentCase.PatientId); if (question == null) { return(HttpNotFound("Question not found!")); } model.QuestionViewModel = new QuestionViewModel { Question = question }; model.QuestionViewModel.Answers1 = db.Answers1.Where(x => x.QuestionId == question.Id).ToList(); model.QuestionViewModel.Answers2 = db.Answers2.Where(x => x.QuestionId == question.Id).ToList(); model.QuestionViewModel.Answers3 = db.Answers3.Where(x => x.QuestionId == question.Id).ToList(); model.QuestionViewModel.Answers4 = db.Answers4.Where(x => x.QuestionId == question.Id).ToList(); ViewBag.Answer1Values = db.Answer1Values.ToList(); ViewBag.Answer2Values1 = db.Answer2Values1.ToList(); ViewBag.Answer2Values2 = db.Answer2Values2.ToList(); ViewBag.Answer3Values1 = db.Answer3Values1.ToList(); ViewBag.Answer3Values2 = db.Answer3Values2.ToList(); ViewBag.Answer4Values = db.Answer4Values.ToList(); model.ServiceTypes = db.ServiceTypes.ToList(); return(View(model)); }
public void DustWasteFormFactoryTestMethod() { IPR _ipr1 = new IPR() { Currency = "USD", DocumentNo = "OGL/362010/00/001295/2012", GrossMass = 854, IPRUnitPrice = 8.06, NetMass = 800, Title = "IPR-2012000003" }; IPR _ipr2 = new IPR() { Currency = "USD", DocumentNo = "OGL/362010/00/001300/2012", GrossMass = 428, IPRUnitPrice = 8.24, NetMass = 400, Title = "IPR-2012000006", }; IPR _ipr3 = new IPR() { Currency = "USD", DocumentNo = "OGL/362010/00/001302/2012", GrossMass = 1025, IPRUnitPrice = 6.73, NetMass = 950, Title = "IPR-2012000008", }; IPR _ipr4 = new IPR() { Currency = "USD", DocumentNo = "OGL/362010/00/001303/2012", GrossMass = 780, IPRUnitPrice = 5.06, NetMass = 720, Title = "IPR-2012000009", }; List <Disposal> _disposals = new List <Disposal>(); _disposals.Add( (new Disposal() { Disposal2ClearenceIndex = null, ClearingType = ClearingType.PartialWindingUp, Created = DateTime.Now, CustomsProcedure = String.Empty, CustomsStatus = CustomsStatus.NotStarted, Disposal2BatchIndex = null, Disposal2IPRIndex = _ipr1, Disposal2MaterialIndex = null, Disposal2PCNID = null, DisposalStatus = DisposalStatus.Dust, DutyAndVAT = 392.70, DutyPerSettledAmount = 125.992, InvoiceNo = String.Empty, IPRDocumentNo = string.Empty, JSOXCustomsSummaryIndex = null, SPNo = 0, RemainingQuantity = 0, SADDate = Extensions.SPMinimum, SADDocumentNo = String.Empty, SettledQuantity = 117.75, Title = "Disposal: Dust of FG Cigarette SKU: 12650149; Batch: 0007444111", TobaccoValue = 949.418, VATPerSettledAmount = 266.704, } )); _disposals.Add( (new Disposal() { Disposal2ClearenceIndex = null, ClearingType = ClearingType.PartialWindingUp, CustomsProcedure = String.Empty, Created = DateTime.Now, CustomsStatus = CustomsStatus.NotStarted, Disposal2BatchIndex = null, Disposal2IPRIndex = _ipr1, Disposal2MaterialIndex = null, Disposal2PCNID = null, DisposalStatus = DisposalStatus.Waste, DutyAndVAT = 13.84, DutyPerSettledAmount = 4.44, InvoiceNo = String.Empty, IPRDocumentNo = String.Empty, JSOXCustomsSummaryIndex = null, SPNo = 0, RemainingQuantity = 0, SADDate = Extensions.SPMinimum, SADDocumentNo = String.Empty, SettledQuantity = 4.15, Title = "Disposal: Waste of FG Cigarette SKU: 12650149; Batch: 0007444111", TobaccoValue = 33.461, VATPerSettledAmount = 9.4, } )); _disposals.Add( (new Disposal() { Disposal2ClearenceIndex = null, ClearingType = ClearingType.PartialWindingUp, CustomsProcedure = String.Empty, CustomsStatus = CustomsStatus.NotStarted, Created = DateTime.Now, Disposal2BatchIndex = null, Disposal2IPRIndex = _ipr2, Disposal2MaterialIndex = null, Disposal2PCNID = null, DisposalStatus = DisposalStatus.Dust, DutyAndVAT = 30.65, DutyPerSettledAmount = 0, InvoiceNo = String.Empty, IPRDocumentNo = String.Empty, JSOXCustomsSummaryIndex = null, SPNo = 0, RemainingQuantity = 0, SADDate = Extensions.SPMinimum, SADDocumentNo = String.Empty, Title = "Disposal: Dust of FG Cigarette SKU: 12988459; Batch: 0007403609", TobaccoValue = 113.327, SettledQuantity = 13.76, VATPerSettledAmount = 30.65, } )); _disposals.Add( (new Disposal() { Disposal2ClearenceIndex = null, ClearingType = ClearingType.PartialWindingUp, CustomsProcedure = String.Empty, CustomsStatus = CustomsStatus.NotStarted, Created = DateTime.Now, Disposal2BatchIndex = null, Disposal2IPRIndex = _ipr2, Disposal2MaterialIndex = null, Disposal2PCNID = null, DisposalStatus = DisposalStatus.Waste, DutyAndVAT = 1.09, DutyPerSettledAmount = 0, InvoiceNo = String.Empty, IPRDocumentNo = String.Empty, JSOXCustomsSummaryIndex = null, SPNo = 0, RemainingQuantity = 0, SADDate = Extensions.SPMinimum, SADDocumentNo = String.Empty, Title = "Disposal: Waste of FG Cigarette SKU: 12988459; Batch: 0007403609", TobaccoValue = 4.036, SettledQuantity = 0.49, VATPerSettledAmount = 1.091, } )); _disposals.Add( (new Disposal() { Disposal2ClearenceIndex = null, ClearingType = ClearingType.PartialWindingUp, CustomsProcedure = String.Empty, CustomsStatus = CustomsStatus.NotStarted, Created = DateTime.Now, Disposal2BatchIndex = null, Disposal2IPRIndex = _ipr3, Disposal2MaterialIndex = null, Disposal2PCNID = null, DisposalStatus = DisposalStatus.Dust, DutyAndVAT = 48.19, DutyPerSettledAmount = 17.343, InvoiceNo = String.Empty, IPRDocumentNo = String.Empty, JSOXCustomsSummaryIndex = null, SPNo = 0, RemainingQuantity = 0, SADDate = Extensions.SPMinimum, SADDocumentNo = String.Empty, Title = "Disposal: Dust of FG Cigarette SKU: 12988459; Batch: 0007403609", TobaccoValue = 108.977, SettledQuantity = 16.2, VATPerSettledAmount = 30.848, } )); _disposals.Add( (new Disposal() { Disposal2ClearenceIndex = null, ClearingType = ClearingType.PartialWindingUp, CustomsProcedure = String.Empty, CustomsStatus = CustomsStatus.NotStarted, Created = DateTime.Now, Disposal2BatchIndex = null, Disposal2IPRIndex = _ipr3, Disposal2MaterialIndex = null, Disposal2PCNID = null, DisposalStatus = DisposalStatus.Waste, DutyAndVAT = 1.73, DutyPerSettledAmount = 0.621, InvoiceNo = String.Empty, IPRDocumentNo = String.Empty, JSOXCustomsSummaryIndex = null, SPNo = 0, RemainingQuantity = 0, SADDate = Extensions.SPMinimum, SADDocumentNo = String.Empty, Title = "Disposal: Waste of FG Cigarette SKU: 12988459; Batch: 0007403609", TobaccoValue = 3.902, SettledQuantity = 0.58, VATPerSettledAmount = 1.104, } )); _disposals.Add( (new Disposal() { Disposal2ClearenceIndex = null, ClearingType = ClearingType.PartialWindingUp, Created = DateTime.Now, CustomsProcedure = String.Empty, CustomsStatus = CustomsStatus.NotStarted, Disposal2BatchIndex = null, Disposal2IPRIndex = _ipr4, Disposal2MaterialIndex = null, Disposal2PCNID = null, DisposalStatus = DisposalStatus.Dust, DutyAndVAT = 6.18, DutyPerSettledAmount = 1.973, InvoiceNo = String.Empty, IPRDocumentNo = String.Empty, JSOXCustomsSummaryIndex = null, SPNo = 0, RemainingQuantity = 0, SADDate = Extensions.SPMinimum, SADDocumentNo = String.Empty, Title = "Disposal: Dust of FG Cigarette SKU: 12988459; Batch: 0007403609", TobaccoValue = 14.975, SettledQuantity = 2.96, VATPerSettledAmount = 4.206, } )); _disposals.Add( (new Disposal() { Disposal2ClearenceIndex = null, ClearingType = ClearingType.PartialWindingUp, Created = DateTime.Now, CustomsProcedure = String.Empty, CustomsStatus = CustomsStatus.NotStarted, Disposal2BatchIndex = null, Disposal2IPRIndex = _ipr4, Disposal2MaterialIndex = null, Disposal2PCNID = null, DisposalStatus = DisposalStatus.Waste, DutyAndVAT = 0.23, DutyPerSettledAmount = 0.073, InvoiceNo = String.Empty, IPRDocumentNo = String.Empty, JSOXCustomsSummaryIndex = null, SPNo = 0, RemainingQuantity = 0, SADDate = Extensions.SPMinimum, SADDocumentNo = String.Empty, Title = "Disposal: Waste of FG Cigarette SKU: 12988459; Batch: 0007403609", TobaccoValue = 0.556, SettledQuantity = 0.11, VATPerSettledAmount = 0.156, } )); //TODO refers to environment: DocumentContent _newDoc = DisposalsFormFactory.GetDustWasteFormContent(_disposals.AsQueryable<Disposal>(), ClearenceProcedure._4051, "OGL Number"); //Assert.AreEqual(_newDoc.DocumentNo, "OGL Number"); }
public void CigaretteExportFormCollectionConstructorTest() { double _quantity = 1000; double _portion = 0.5; SKUCigarette _sku = new SKUCigarette() { FormatIndex = new Format() { Title = "Format title", CigaretteLenght = "100", FilterLenght = "20" }, Brand = "Slims Menthol ", Family = "Salem", CigaretteLenght = "99.00 mm ", FilterLenght = "27.00 mm", IPRMaterial = true, Menthol = "M", MentholMaterial = true, PrimeMarket = "PL", ProductType = CAS.SmartFactory.IPR.WebsiteModel.Linq.ProductType.Cigarette, SKU = "12419574 ", Title = "SKU SA MXSR 99 CPB 20 5000 05 N PL1" }; Batch _batch = new Batch() { Batch0 = "99999999", BatchLibraryIndex = null, BatchStatus = BatchStatus.Final, CalculatedOveruse = 0, DustCooeficiencyVersion = 1, BatchDustCooeficiency = 1, Dust = 1.1, FGQuantityAvailable = 1000, FGQuantity = _quantity, MaterialQuantity = 5000.1234567, MaterialQuantityPrevious = 0, Overuse = 0, ProductType = CAS.SmartFactory.IPR.WebsiteModel.Linq.ProductType.Cigarette, SHCooeficiencyVersion = 1, BatchSHCooeficiency = 0.01234567, SHMenthol = 1.3, SKU = "SKU1234567890", SKUIndex = _sku, WasteCooeficiencyVersion = 1, Waste = 1.3, BatchWasteCooeficiency = 0.012345678, Title = "Testing batch" }; _batch.Tobacco = _batch.MaterialQuantity.Value - _batch.SHMenthol.Value - _batch.Dust.Value - _batch.Waste.Value; InvoiceContent invoice = new InvoiceContent() { InvoiceContent2BatchIndex = _batch, InvoiceIndex = null, ProductType = CAS.SmartFactory.IPR.WebsiteModel.Linq.ProductType.Cigarette, Quantity = _quantity * _portion, SKUDescription = _batch.SKU, InvoiceContentStatus = InvoiceContentStatus.OK, Title = "Testing Invoice", Units = "kU", }; List <CAS.SmartFactory.xml.DocumentsFactory.CigaretteExportForm.Ingredient> ingridients = new List <CAS.SmartFactory.xml.DocumentsFactory.CigaretteExportForm.Ingredient>(); IPR _ipr1 = new IPR() { AccountBalance = 0, AccountClosed = false, Batch = "TobaccoBatch", Cartons = 0, ClearenceIndex = null, ClosingDate = DateTime.Today, IPR2ConsentTitle = null, Currency = "PLN", CustomsDebtDate = DateTime.Today, DocumentNo = "SADDocumentNomber", Duty = 123.45, DutyName = "DustyName", IPRDutyPerUnit = 67.89, Grade = "GradeName", GrossMass = 12345.67, InvoiceNo = "InvoiceNo", IPRLibraryIndex = null, IPR2JSOXIndex = null, NetMass = 23456.78, OGLValidTo = DateTime.Today + TimeSpan.FromDays(364), IPR2PCNPCN = null, SKU = "IPR Tobacco SKU", TobaccoName = "TobaccoName", TobaccoNotAllocated = 9876.54, IPRUnitPrice = 5.67, Title = "Testing IPR", Value = 89012.34, VAT = 56.78, VATName = "VATName", IPRVATPerUnit = 9.12 }; IPR _ipr2 = new IPR() { AccountBalance = 0, AccountClosed = false, Batch = "TobaccoBatch", Cartons = 0, ClearenceIndex = null, ClosingDate = DateTime.Today, IPR2ConsentTitle = null, Currency = "USD", CustomsDebtDate = DateTime.Today, DocumentNo = "SADDocumentNomber", Duty = 123.45, DutyName = "DustyName", IPRDutyPerUnit = 67.89, Grade = "GradeName", GrossMass = 12345.67, InvoiceNo = "InvoiceNo", IPRLibraryIndex = null, IPR2JSOXIndex = null, NetMass = 23456.78, OGLValidTo = DateTime.Today + TimeSpan.FromDays(364), IPR2PCNPCN = null, SKU = "IPR Tobacco SKU", TobaccoName = "TobaccoName", TobaccoNotAllocated = 9876.54, IPRUnitPrice = 5.67, Title = "Testing IPR", Value = 89012.34, VAT = 56.78, VATName = "VATName", IPRVATPerUnit = 9.12 }; Disposal _disposal1 = new Disposal() { Disposal2BatchIndex = _batch, Disposal2ClearenceIndex = null, ClearingType = CAS.SmartFactory.IPR.WebsiteModel.Linq.ClearingType.PartialWindingUp, CustomsProcedure = "5100", CustomsStatus = CustomsStatus.NotStarted, DisposalStatus = DisposalStatus.TobaccoInCigaretes, DutyAndVAT = 123.4321, DutyPerSettledAmount = 345.6789, IPRDocumentNo = null, InvoiceNo = "InvoiceNomber", Disposal2IPRIndex = _ipr1, JSOXCustomsSummaryIndex = null, Disposal2MaterialIndex = null, SPNo = 7.8, RemainingQuantity = 0, SADDate = new Nullable <DateTime>(), SADDocumentNo = "N/A", SettledQuantity = 9.12, TobaccoValue = 34.567, Title = "Testing disposal", VATPerSettledAmount = 78.901, }; Disposal _disposal2 = new Disposal() { Disposal2BatchIndex = _batch, Disposal2ClearenceIndex = null, ClearingType = CAS.SmartFactory.IPR.WebsiteModel.Linq.ClearingType.PartialWindingUp, CustomsProcedure = "5100", CustomsStatus = CustomsStatus.NotStarted, DisposalStatus = DisposalStatus.TobaccoInCigaretes, DutyAndVAT = 123.4567, DutyPerSettledAmount = 345.67891234, IPRDocumentNo = null, InvoiceNo = "InvoiceNomber", Disposal2IPRIndex = _ipr2, JSOXCustomsSummaryIndex = null, Disposal2MaterialIndex = null, SPNo = 7.8, RemainingQuantity = 0, SADDate = new Nullable <DateTime>(), SADDocumentNo = "N/A", SettledQuantity = 9.12345678, TobaccoValue = 34.56789012, Title = "Testing disposal", VATPerSettledAmount = 78.9012345, }; CutfillerCoefficient _cc = new CutfillerCoefficient { CFTProductivityNormMax = 995, CFTProductivityNormMin = 985, CFTProductivityRateMax = 0.995, CFTProductivityRateMin = 0.985 }; ingridients.Add(CAS.SmartFactory.IPR.Dashboards.Clearance.FinishedGoodsFormFactory.GetIPRIngredient(_disposal1)); ingridients.Add(CAS.SmartFactory.IPR.Dashboards.Clearance.FinishedGoodsFormFactory.GetIPRIngredient(_disposal2)); ingridients.Add(new CAS.SmartFactory.xml.DocumentsFactory.CigaretteExportForm.RegularIngredient("Reg Batch 54321", "Reg SKU 12345", 1234.56789)); //string _masterDocumentName = "CigaretteExportFormCollection"; //string _invoiceNumber = "INV987654"; //int _position = 1; //List<XmlCigaretteExportForm> cigaretteExportFormList = new List<XmlCigaretteExportForm>(); //CigaretteExportForm _cigaretteExportForm = FinishedGoodsFormFactory.GetCigaretteExportForm( _cc, _batch, invoice, 0.5, ingridients, _masterDocumentName, ref _position, ClearenceProcedure._3151 ); //cigaretteExportFormList.Add( _cigaretteExportForm ); //_cigaretteExportForm = FinishedGoodsFormFactory.GetCigaretteExportForm( _cc, _batch, invoice, 0.5, ingridients, _masterDocumentName, ref _position, ClearenceProcedure._4071 ); //cigaretteExportFormList.Add( _cigaretteExportForm ); //CigaretteExportFormCollection target = FinishedGoodsFormFactory.GetCigaretteExportFormCollection( cigaretteExportFormList, _masterDocumentName, _invoiceNumber ); //XmlSerializer _srlzr = new XmlSerializer( typeof( CigaretteExportFormCollection ) ); //XmlWriterSettings _setting = new XmlWriterSettings() //{ // Indent = true, // IndentChars = " ", // NewLineChars = "\r\n" //}; //using ( XmlWriter file = XmlWriter.Create( _masterDocumentName + ".xml", _setting ) ) //{ // file.WriteProcessingInstruction( "xml-stylesheet", "type=\"text/xsl\" href=\"CigaretteExportFormCollection.xslt\"" ); // _srlzr.Serialize( file, target ); // Assert.IsTrue( true, "Success" ); //} }
public async Task <IActionResult> Index(string MemberMobile, List <CartsViewModel> Carts) { List <CartListViewModel> lstCLVM = new List <CartListViewModel>(); CartListViewModel CLVM; MemberViewModel MVM = null; if (MemberMobile != "" && MemberMobile != null) { // 3-1.系統在Action【Cart/Index】判斷MemberMobile!=""。 // 4.系統在Action【Cart/Index】讀取購物車清單。 lstCLVM = await IMER.GetCartList(MemberMobile); // 4-1.系統讀取會員基本資料。 MVM = await IMER.GetMember(MemberMobile); } else { // 3-1a.系統在Action【Cart/Index】判斷MemberMobile!="" // 3-1a-1.系統將carts轉換為List<CartListViewModel>。 foreach (CartsViewModel item in Carts) { CLVM = new CartListViewModel(); CLVM.ProductId = item.productId; CLVM.Product = item.product; CLVM.ProducSizeId = item.sizeId; CLVM.ProductColorId = item.colorId; CLVM.Quantity = item.quantity; CLVM.Price = item.price; CLVM.ProductSize = item.size; CLVM.ProductColor = item.color; lstCLVM.Add(CLVM); } // 3-1a-2.回4-2。 } // 4-2.系統讀取運費: int total = 0; foreach (var item in lstCLVM) { total += (item.Quantity * item.Price); } OrderFreightViewModel ofvm = await IPR.GetOrderFreight(total); // 5.系統在Action【Cart/Index】依4讀取值(List<CartListViewModel>)中每一筆記錄之ProductId, // 讀取對應之List<ProductSizeViewModel>與List<ProductColorViewModel>再分別指定給List<CartListViewModel>中的lstPSVM和lstPCVM。 for (int i = 0; i <= lstCLVM.Count - 1; i++) { // 5-1.系統讀取商品尺寸資料。 lstCLVM[i].lstPSVM = await IPRR.GetProductSize(lstCLVM[i].ProductId); // 5-2.系統讀取商品顏色資料。 lstCLVM[i].lstPCVM = await IPRR.GetProductColor(lstCLVM[i].ProductId); } List <MemberDeliveryAddressListViewModel> MDAL = await IMER.GetMemberDeliveryAddressList(MemberMobile, null, null, null, 0, 10); // 5-3.系統回傳View【Cart/Index】,並回傳new CartHomesViewModel { lstCLVM=4傳回值, MVM=4-1傳回值, Freight=4-2讀取值}。 return(View(new CartHomesViewModel { lstCLVM = lstCLVM, MVM = MVM, Freight = ofvm, MDAL = MDAL })); }
///<summary> ///Removes the given IPR ///</summary> public void RemoveIPR(IPR toRemove) { this.RemoveStructure("IPR", toRemove); }
public async Task <IViewComponentResult> InvokeAsync(int Month, int Enabled, string MemberMobile = "", string MemberName = "", string ReferrerMobile = "", int MemberLevelId = 0, int Page = 1, int LinkType = 0, int StartPage = 1, string AClass = "page-link") { // 9-1.系統在ViewComponent【MemberList】中讀取Appsetting.json中的每頁筆數RowsPerPage以及分頁頁碼連結總數PageCount。 int RowsPerPage = int.Parse(config["Page:RowsPerPage"]); int PageCount = int.Parse(config["Page:PageCount"]); // 9-2.系統在ViewComponent【MemberList】讀取會員總數。 long memberCount = await IMR.GetMemberListCount(MemberMobile, MemberName, ReferrerMobile, MemberLevelId, Enabled); long BonusListCount = await IMR.GetMemberBonusListCount(Month, ReferrerMobile); // 9-3.系統依9-2傳回值將9傳送頁碼重設在Between 1 and (9讀取記錄筆數/RowsPerPage)+(9讀取記錄筆數%RowsPerPage==0?0:1)。 int TotalPages = (int)(memberCount / RowsPerPage); if (memberCount % RowsPerPage > 0) { TotalPages += 1; } if (Page < 1) { Page = 1; } if (Page > TotalPages) { Page = TotalPages; } if (Page <= 0) { Page = 1; } // 9-4.系統計算資料Skip數=(9傳送頁碼(預設1)-1)*9-1讀取RowsPerPage。 int Skip = (Page - 1) * RowsPerPage; // 9-5系統在ViewComponent【MemberListViewComponent】讀取會員清單: MemberViewModel Member = await IMR.GetMember(MemberMobile); List <MemberBonusListViewModel> o = await IPR.GetMemberBonusList(int.Parse(DateTime.Now.ToString("yyyyMM")), ReferrerMobile, Skip, RowsPerPage); List <MemberViewModel> lMLVM = await IMR.GetMemberList(MemberMobile, MemberName, ReferrerMobile, MemberLevelId, Enabled, Skip, RowsPerPage); int ret = 0; foreach (MemberViewModel tmp in lMLVM) { lMLVM[ret].OrderBonus = await IMR.GetMemberOrderBonusSum(tmp.MemberMobile); ret++; } // 9-6.系統設定PagerTagHelper之相關參數 int CurrentPage = Page; // 9-6-1.系統將管理者權限清單Session["EmployeeRights"]暫存在ViewBag.TR。 ViewBag.TR = HttpContext.Session.GetObjectFromJson <List <int> >("EmployeeRights"); // 9-7.系統回傳View(new MemberManageViewModel { //listMemberListViewModel = 9 - 5讀取值, //CurrentPage = 9 - 6設定值, //TotalPages = 9 - 6設定值, //PageCount = 9 - 6設定值, //StartPage = 9 - 6設定值, //Parameters = 9 - 6設定值 //}); return(View(new MemberListManageViewModel { listMemberListViewModel = lMLVM, listMemberBonusListViewModel = o, CurrentPage = CurrentPage, TotalPages = TotalPages, PageCount = PageCount, StartPage = StartPage, LinkType = LinkType, AClass = AClass })); }