public ActionResult SearchByPasgah() { //TODO string pasgahName = Request.Form["ctl00$MainContent$Pasgah"]; int pasgahId = PasgahHelper.GetAllPasgahNamesAndID(PasgahRepository.GetInstance().GetAllPasgahs())[pasgahName]; try { List <ConfirmedPatte> result = ConfirmedPatteRepository.GetInstance().FindByPasgahId(pasgahId); if (result != null && result.Count > 0) { Session["allConfirmationForPasgah"] = result; return(RedirectToAction("ByPasgah", "ConfirmationReport")); } Session["Error"] = "هیچ تاییدیه ای در این مرکز ثبت نشده است."; return(RedirectToAction("ByPasgah", "ConfirmationReport")); } catch (EntityNotFoundException ex) { Session["Error"] = ex.Message; return(RedirectToAction("ByPasgah", "ConfirmationReport")); } catch (Exception ex) { Log.Error("در هنگام گزارش گیری بر اساس مرکز استعلام خطای نامشخص رخ داده است.", ex); Session["Information"] = "خطای داخلی رخ داده است."; return(RedirectToAction("MessagePage", "Default")); } }
public ActionResult Confirm(FormCollection form) { int pasgahId = Int32.Parse(Request.Form["pasgahID"]); int pateDBId = Int32.Parse(Request.Form["patteID"]); string pateSerialFromBarcodeReader = Request.Form["pateSerialFromBarcodeReader"]; string pateSerial = Request.Form["pateSerial"]; if (!pateSerial.Equals(pateSerialFromBarcodeReader)) { Session["Information"] = "برای تایید یک پته باید بارکد همان پته را مجددا با دستگاه بخوانید."; Session["Type"] = "Error"; Session["redirect"] = "~/Patte/Index"; return(RedirectToAction("MessagePage", "Default")); } User user = Utilities.CommonUtilities.GetUser(); try { bool isSucceed = ConfirmedPatteRepository.GetInstance() .CheckIfNotRedundant(pasgahId, pateDBId); if (isSucceed) { isSucceed = ConfirmedPatteRepository.GetInstance().Save(new ConfirmedPatte() { PasgahID = pasgahId, PatteID = pateDBId, UserID = user.Id, ConfirmationIp = Request.UserHostAddress }); if (isSucceed) { Session["Information"] = "پته با موفقیت تایید شد."; } else { Session["Information"] = "در ذخیره سازی تاییدیه پته خطا رخ داده است."; Session["Type"] = "Error"; } } else { Session["Information"] = "این پته قبلا در این مرکز ثبت شده است و امکان تایید مجدد آن وجود ندارد."; Session["Type"] = "Error"; } } catch (Exception ex) { Log.Error(String.Format("Uknown Error occured during saving patteConfirm with PatteID {0}", pateDBId)); Log.Error(ex.Message); Session["Information"] = "این پته قبلا در این مرکز ثبت شده است و امکان تایید مجدد آن وجود ندارد."; Session["Type"] = "Error"; } Session["redirect"] = "~/Patte/Index"; return(RedirectToAction("MessagePage", "Default")); }
public ActionResult ShowUwPate() { ViewData["uwPate"] = Session["uwPate"]; try { ViewData["History"] = ConfirmedPatteRepository.GetInstance().FindByPatteSerial(((Patte)Session["uwPate"]).PatteSerial); } catch (Exception ex) { //Noting } Session.Remove("uwPate"); return(View()); }
public JsonResultWithObject <Patte> Get(string hexPelaq, string hexPasgah) { string plaq = CommonUtilities.HexStringToString(hexPelaq, Encoding.UTF8); string pasgahName = CommonUtilities.HexStringToString(hexPasgah, Encoding.UTF8); Pasgah pasgah = PasgahRepository.GetInstance().FindByName(pasgahName); JsonResultWithObject <Patte> response = Logics.BitaServices.GetPatte(plaq, true); if (!response.isSuccess) { return(response); } try { bool isSucceed = ConfirmedPatteRepository.GetInstance() .CheckIfNotRedundant(pasgah.Id, response.result.Id); if (isSucceed) { isSucceed = ConfirmedPatteRepository.GetInstance().Save(new ConfirmedPatte() { PasgahID = pasgah.Id, PatteID = response.result.Id, UserID = pasgah.Users.FirstOrDefault().Id, ConfirmationIp = "WEB SERVICE" }); if (isSucceed) { response.messages = new [] { "پته با موفقیت تایید شد." }; } else { response.messages = new[] { "در ذخیره سازی تاییدیه پته خطا رخ داده است." }; response.isSuccess = false; } } else { response.messages = new[] { "این پته قبلا در این مرکز ثبت شده است و امکان تایید مجدد آن وجود ندارد." }; response.isSuccess = false; } } catch (Exception ex) { Log.Error(String.Format("Uknown Error occured during saving patteConfirm with plaq {0}", plaq)); Log.Error(ex.Message); response.messages = new[] { "این پته قبلا در این مرکز ثبت شده است و امکان تایید مجدد آن وجود ندارد" }; response.isSuccess = false; } return(response); }
public ActionResult ShowPatte() { ViewData["patte"] = Session["patte"]; ViewData["infoException"] = Session["infoException"]; // ViewData["ValueDeclaration"] = Session["ValueDeclaration"]; try { ViewData["History"] = ConfirmedPatteRepository.GetInstance().FindByPatteSerial(((Patte)Session["Patte"]).PatteSerial); } catch (Exception ex) { //Noting } Session.Remove("infoException"); return(View()); }
public ActionResult SearchByUser() { string nationalCode = Request.Form["nationalCode"]; try { List <ConfirmedPatte> result = ConfirmedPatteRepository.GetInstance().FindByUserNationalCode(nationalCode); if (result != null && result.Count > 0) { Session["allConfirmationForUser"] = result; return(RedirectToAction("ByUser", "ConfirmationReport")); } Session["Error"] = "شماره ملی وارد شده صحیح نیست و یا هیچ تاییدیه ای با این شماره ملی ثبت نشده است."; return(RedirectToAction("ByUser", "ConfirmationReport")); } catch (EntityNotFoundException ex) { Session["Error"] = ex.Message; return(RedirectToAction("ByUser", "ConfirmationReport")); } }