Пример #1
0
        public PartialViewResult FaultDetails(FaultModel fm)
        {
            try
               {
               Fault f = new Fault();
               f.ID = Guid.NewGuid();
               string pid = (string) Session["faultProductID"];
               f.ProductID = new Guid(pid);
               string oID = (string)Session["faultOrderID"];
               f.OrderID = new Guid(oID);
               f.Username = User.Identity.Name;
               f.Barcode = fm.Code;
               f.Details = fm.Details;
               f.CategoryID = new Guid(fm.Category);
               f.Status = new Guid("cbd3ea58-b2b6-4549-9279-1711986bfb49");

               new FaultServ.WCFFaultClient().AddFault(f);

               Log l = new Log();
               l.ID = Guid.NewGuid();
               l.FaultID = f.ID;
               l.Details = f.Details;
               l.Date = DateTime.Now;
               l.Status = f.Status;

               new FaultServ.WCFFaultClient().AddFaultToLog(l);
               @ViewBag.faultAddedMsg = "Fault Was Added Succesfully";
               return PartialView("_faultAdded");
               }
               catch (Exception e)
               {
               @ViewBag.faultAddedMsg = "Fault Was Not Added";
               return PartialView("_faultAdded");
               }
        }
Пример #2
0
        public PartialViewResult FaultDetails(string barcodeImg, int code)
        {
            FaultModel fm = new FaultModel();
               fm.BarCodeImg = barcodeImg;
               fm.Code = code;

               return PartialView("_FaultDetails", fm);
        }
Пример #3
0
        public ActionResult FaultLogIn(LogInModel model, string returnUrl)
        {
            //Get  6 Digit Ticket
               string code = new WCFBAFuncClient().GenerateRandomTicket(6);

               //Check if ticket is filled
               if (code != null)
               {
               if (ModelState.IsValid)
               {
                   //Authorise the user
                   //call the service to check the username and password
                   bool validateUser = new UserServ.WCFUserClient().LogIn(model.Username, model.PasswordToken);

                   if (validateUser)
                   {
                       FormsAuthentication.SetAuthCookie(model.Username, true);
                       BarCode b = new BarCode();
                       MemoryStream ms = new MemoryStream(b.Code39(code, 100, false, code));

                       var img = System.Drawing.Image.FromStream(ms);
                       string imgPath = Server.MapPath("\\Content\\Images\\" + code + ".jpg");

                       img.Save(imgPath);

                       FaultModel fm = new FaultModel();
                       fm.BarCodeImg = "..\\Content\\Images\\" + code + ".jpg";
                       fm.Code = Convert.ToInt32(code);

                       return RedirectToAction("FaultDetails", new { barcodeImg = fm.BarCodeImg, code=fm.Code });
                       //return PartialView("_FaultDetails", fm);
                   }
                   else
                   {
                       ModelState.AddModelError("", "The user name or password provided is incorrect.");
                       return PartialView("_FaultLogIn", model);
                   }
               }
               else
               {
                   ModelState.AddModelError("", "The user name or password provided is incorrect.");
                   return PartialView("_FaultLogIn", model);
               }
               }
               else
               {
               return PartialView("_FaultLogIn",model);
               }
        }