示例#1
0
        public ActionResult Save(LocatorModel model)
        {
            string message = "";

            try
            {
                bool saved = false;
                if (SessionHelper.Locator != null)
                {
                    SessionHelper.Locator.CompanyId   = model.CompanyId;
                    SessionHelper.Locator.Description = string.IsNullOrEmpty(model.Description) ? "" : model.Description;
                    SessionHelper.Locator.Id          = model.Id;
                    SessionHelper.Locator.SOBId       = SessionHelper.SOBId;
                    SessionHelper.Locator.Status      = model.Status;

                    LocatorHelper.Save(SessionHelper.Locator);
                    SessionHelper.Locator = null;
                    saved = true;
                }
                else
                {
                    message = "No Locator information available!";
                }
                return(Json(new { success = saved, message = message }));
            }
            catch (Exception e)
            {
                message = e.Message;
                return(Json(new { success = false, message = message }));
            }
        }
        // Added by Bharat on 09 June 2017
        public JsonResult GetWarehouseData(int Locator_ID)
        {
            Ctx          ct    = Session["ctx"] as Ctx;
            LocatorModel model = new LocatorModel();

            return(Json(JsonConvert.SerializeObject(model.GetWarehouseData(Locator_ID, ct)), JsonRequestBehavior.AllowGet));
        }
示例#3
0
        private static Locator getEntityByModel(LocatorModel model)
        {
            if (model == null)
            {
                return(null);
            }

            Locator entity = new Locator();

            if (model.Id == 0)
            {
                entity.CompanyId  = AuthenticationHelper.CompanyId.Value;
                entity.CreateBy   = AuthenticationHelper.UserId;
                entity.CreateDate = DateTime.Now;
            }
            else
            {
                entity.CompanyId  = model.CompanyId;
                entity.CreateBy   = model.CreateBy;
                entity.CreateDate = model.CreateDate;
            }

            entity.Description = model.Description;
            entity.Id          = model.Id;
            entity.SOBId       = model.SOBId;
            entity.Status      = model.Status;
            entity.UpdateBy    = AuthenticationHelper.UserId;
            entity.UpdateDate  = DateTime.Now;
            return(entity);
        }
示例#4
0
        public static void DeleteLocatorWarehouse(LocatorWarehouseModel model)
        {
            LocatorModel          item             = SessionHelper.Locator;
            LocatorWarehouseModel locatorWarehouse = item.LocatorWarehouses.FirstOrDefault(x => x.Id == model.Id);

            item.LocatorWarehouses.Remove(locatorWarehouse);
        }
示例#5
0
        public static void UpdateLocatorWarehouse(LocatorWarehouseModel model)
        {
            LocatorModel item = SessionHelper.Locator;

            item.LocatorWarehouses.FirstOrDefault(x => x.Id == model.Id).EndDate   = model.EndDate;
            item.LocatorWarehouses.FirstOrDefault(x => x.Id == model.Id).Id        = model.Id;
            item.LocatorWarehouses.FirstOrDefault(x => x.Id == model.Id).LocatorId = model.LocatorId;
            item.LocatorWarehouses.FirstOrDefault(x => x.Id == model.Id).SOBId     = model.SOBId;
            item.LocatorWarehouses.FirstOrDefault(x => x.Id == model.Id).StartDate = model.StartDate;
        }
示例#6
0
        public ActionResult Edit(string id)
        {
            LocatorModel model = LocatorHelper.GetLocator(id);

            model.LocatorWarehouses = LocatorHelper.GetLocatorWarehouses(id).ToList();
            model.SOBId             = SessionHelper.SOBId;
            model.CompanyId         = AuthenticationHelper.CompanyId.Value;
            SessionHelper.Locator   = model;

            return(View("Create", model));
        }
 public JsonResult Save(string warehouseId, string tValue, string tX, string tY, string tZ)
 {
     if (Session["Ctx"] != null)
     {
         var          ctx = Session["ctx"] as Ctx;
         LocatorModel obj = new LocatorModel();
         var          id  = obj.LocatorSave(ctx, warehouseId, tValue, tX, tY, tZ);
         return(Json(new { locatorId = id }, JsonRequestBehavior.AllowGet));
     }
     return(Json(new { result = "ok" }, JsonRequestBehavior.AllowGet));
 }
示例#8
0
 private void AddItem(IReadOnlyCollection <IWebElement> elem, LocatorModel item)
 {
     if (elem.Count > 0)
     {
         var isDisplayed = elem.ToList()[0].Displayed;
         if (isDisplayed)
         {
             Count++;
             listBox1.Items.Add($"{item.Locator} || {item.Type} || {item.Page}");
         }
     }
 }
示例#9
0
        public static void Save(LocatorModel locatorModel)
        {
            Locator entity = getEntityByModel(locatorModel);

            string result = string.Empty;

            if (entity.IsValid())
            {
                if (locatorModel.Id > 0)
                {
                    result = service.Update(entity);
                }
                else
                {
                    result = service.Insert(entity);
                }

                if (!string.IsNullOrEmpty(result))
                {
                    var savedDetail = GetLocatorWarehouses(result);
                    if (savedDetail.Count() > locatorModel.LocatorWarehouses.Count())
                    {
                        var tobeDeleted = savedDetail.Take(savedDetail.Count() - locatorModel.LocatorWarehouses.Count());
                        foreach (var item in tobeDeleted)
                        {
                            service.DeleteLocatorWarehouse(item.Id);
                        }
                        savedDetail = GetLocatorWarehouses(result);
                    }

                    foreach (var detail in locatorModel.LocatorWarehouses)
                    {
                        LocatorWarehouse detailEntity = getEntityByModel(detail, 0);
                        if (detailEntity.IsValid())
                        {
                            detailEntity.LocatorId = Convert.ToInt64(result);
                            if (savedDetail.Count() > 0)
                            {
                                detailEntity.Id = savedDetail.FirstOrDefault().Id;
                                savedDetail.Remove(savedDetail.FirstOrDefault(rec => rec.Id == detailEntity.Id));
                                service.Update(detailEntity);
                            }
                            else
                            {
                                service.Insert(detailEntity);
                            }
                        }
                    }
                }
            }
        }
示例#10
0
        public LocatorViewModel(LocatorModel model)
        {
            _model = model;
            Fields = new ObservableCollection <Field>();

            _model.refreshBoard += new EventHandler <EventArgs>(Model_DrawBoard);
            _model.refreshField += new EventHandler <FieldRefreshEventArgs>(Model_FieldRefresh);
            _model.OnGameOver   += new EventHandler <int>(Model_GameOver);
            _model.StatusStrip  += new EventHandler <String>(Model_StatusStrip);

            NewGame     = new DelegateCommand(param => OnNewGame(Int32.Parse(param.ToString())));
            ExitCommand = new DelegateCommand(param => OnExitGame());
            SwitchMode  = new DelegateCommand(param => OnSwitchMode());

            CurrentGameStatus = "Bomb mode";
            drawBoard();
        }
示例#11
0
        public ActionResult Create()
        {
            LocatorModel model = SessionHelper.Locator;

            if (model == null)
            {
                model = new LocatorModel
                {
                    SOBId = SessionHelper.SOBId
                };
                ViewBag.SOBName = SetOfBookHelper.GetSetOfBook(SessionHelper.SOBId.ToString()).Name;

                SessionHelper.Locator = model;
                if (SessionHelper.Locator.LocatorWarehouses == null)
                {
                    SessionHelper.Locator.LocatorWarehouses = new List <LocatorWarehouseModel>();
                }
            }

            model.CompanyId = AuthenticationHelper.CompanyId.Value;

            return(View(model));
        }
示例#12
0
 public ActionResult DeletePartial(LocatorWarehouseModel model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             LocatorModel header = SessionHelper.Locator;
             LocatorHelper.DeleteLocatorWarehouse(model);
             SessionHelper.Locator = header;
             IList <LocatorWarehouseModel> LocatorWarehouses = LocatorHelper.GetLocatorWarehouses();
             return(PartialView("createPartial", LocatorWarehouses));
         }
         catch (Exception e)
         {
             ViewData["EditError"] = e.Message;
         }
     }
     else
     {
         ViewData["EditError"] = "Please, correct all errors.";
     }
     return(PartialView("createPartial"));
 }
示例#13
0
        public static void InsertLocatorWarehouse(LocatorWarehouseModel model)
        {
            LocatorModel item = SessionHelper.Locator;

            item.LocatorWarehouses.Add(model);
        }
示例#14
0
        public static LocatorModel GetLocator(string id)
        {
            LocatorModel model = new LocatorModel(service.GetSingle(id, AuthenticationHelper.CompanyId.Value));

            return(model);
        }