public string AddFloor(FloorVM floor)
        {
            string floorId = string.Empty;

            SqlParameter[] parameters =
            {
                new SqlParameter {
                    ParameterName = "@Name", Value = floor.Name
                },
                new SqlParameter {
                    ParameterName = "@Code", Value = floor.Code
                },
                new SqlParameter {
                    ParameterName = "@FloorNo", Value = floor.FloorNo
                },
                new SqlParameter {
                    ParameterName = "@NoOfRoom", Value = floor.NoOfRoom
                },
                new SqlParameter {
                    ParameterName = "@Description", Value = floor.Description
                },
                new SqlParameter {
                    ParameterName = "@IsActive", Value = floor.IsActive
                },
                new SqlParameter {
                    ParameterName = "@CreatedBy", Value = floor.CreatedBy
                }
            };

            floorId = Convert.ToString(DALHelper.ExecuteScalar("AddFloor", parameters));

            return(floorId);
        }
        public UCFloorMaintain(FloorVM vm)
        {
            InitializeComponent();
            if (vm.SysNo > 0)
            {
                Model = new FloorVM()
                {
                    SysNo         = vm.SysNo,
                    FloorLogoSrc  = vm.FloorLogoSrc,
                    FloorName     = vm.FloorName,
                    Remark        = vm.Remark,
                    Status        = vm.Status,
                    TemplateName  = vm.TemplateName,
                    Templates     = vm.Templates,
                    TemplateSysNo = vm.TemplateSysNo,
                    Priority      = vm.Priority,
                    PageType      = vm.PageType,
                    PageCode      = vm.PageCode,
                    PageName      = vm.PageName,
                };
            }
            else
            {
                Model = vm;
            }
            facade = new FloorFacade(CPApplication.Current.CurrentPage);
            cbPageCodes.ItemsSource   = EnumConverter.GetKeyValuePairs <PageCodeType>(EnumConverter.EnumAppendItemType.Select);
            cbPageCodes.SelectedIndex = 0;

            this.cbPageCodes.SelectionChanged += new SelectionChangedEventHandler(cbPageCodes_SelectionChanged);
            this.DataContext = Model;
        }
 public UCFloorMaintain()
 {
     InitializeComponent();
     Model       = new FloorVM();
     DataContext = Model;
     facade      = new FloorFacade(CPApplication.Current.CurrentPage);
 }
        public JsonResult Update([FromBody] FloorVM model)
        {
            var floor = Mapper.Map <Floor>(model);

            _floorService.Update(floor);
            _floorService.SaveChanges();
            return(Json(_floorService.Get(floor.Id)));
        }
Exemple #5
0
        public ActionResult Create()
        {
            FloorVM model = new FloorVM();

            model.FloorNo  = (floorRepository.GetMaxFloorNo() + 1);
            model.IsActive = true;
            return(View(model));
        }
Exemple #6
0
        private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
        {
            FloorVM vm = DataGrid.SelectedItem as FloorVM;

            if (vm != null)
            {
                var sysNo = vm.SysNo;
                Window.Navigate(string.Format(ConstValue.MKT_FloorSectionMaintainUrlFormat, sysNo), null, true);
            }
        }
Exemple #7
0
        private void DataGrid_LoadingDataSource(object sender, Newegg.Oversea.Silverlight.Controls.Data.LoadingDataEventArgs e)
        {
            FloorMasterQueryFilter filter = new FloorMasterQueryFilter();

            filter.PageType = PageCodeType.Promotion;
            filter.PageCode = cbPageID.SelectedItem == null ? filter.PageCode : ((KeyValuePair <string, string>)cbPageID.SelectedItem).Key;

            filter.PageInfo = new QueryFilter.Common.PagingInfo
            {
                PageIndex = DataGrid.PageIndex,
                PageSize  = DataGrid.PageSize
            };

            facade.QueryFloor(filter, (s, args) =>
            {
                var model = new List <FloorVM>();

                foreach (var row in args.Result.Rows)
                {
                    var vm          = new FloorVM();
                    vm.FloorLogoSrc = row.FloorLogoSrc;
                    vm.FloorName    = row.FloorName;
                    //vm.FloorNo = "#" + i;
                    vm.Remark        = row.Remark;
                    vm.Status        = row.Status;
                    vm.SysNo         = row.SysNo;
                    vm.TemplateName  = GetTemplateName(row.TemplateSysNo);
                    vm.Templates     = Templates;
                    vm.TemplateSysNo = row.TemplateSysNo;
                    vm.Priority      = row.Priority.ToString();
                    vm.PageType      = row.PageType;
                    vm.PageCode      = row.PageCode;
                    vm.PageName      = row.PageName;
                    model.Add(vm);
                }

                var query = from a in model
                            group a by a.PageCode into g
                            select g;
                foreach (var m in query)
                {
                    var ls = m.ToList <FloorVM>();
                    if (ls != null)
                    {
                        for (var i = 0; i < ls.Count(); i++)
                        {
                            ls[i].FloorNo = "#" + (i + 1);
                        }
                    }
                }

                DataGrid.ItemsSource = model;
                DataGrid.TotalCount  = args.Result.TotalCount;
            });
        }
Exemple #8
0
        private void HyperlinkButtonEdit_Click(object sender, RoutedEventArgs e)
        {
            FloorVM         vm = DataGrid.SelectedItem as FloorVM;
            UCFloorMaintain uc = new UCFloorMaintain(vm);

            uc.Dialog = CurrentPage.Context.Window.ShowDialog(MKT.Resources.ResFloor.Title_Floor_Maintain,
                                                              uc, (s, args) =>
            {
                DataGrid.Bind();
            });
        }
Exemple #9
0
        public ActionResult Edit(FloorVM model)
        {
            try
            {
                string floorId = string.Empty;
                model.UpdatedBy = LogInManager.LoggedInUserId;

                #region Check Floor Code Available.

                if (this.CheckFloorCodeAvailable(model.Id, model.Code) == false)
                {
                    return(Json(new
                    {
                        IsSuccess = false,
                        errorMessage = string.Format("Floor Code : {0} already exist.", model.Code)
                    }, JsonRequestBehavior.AllowGet));
                }

                #endregion

                floorId = floorRepository.UpdateFloor(model);

                if (!string.IsNullOrWhiteSpace(floorId))
                {
                    return(Json(new
                    {
                        IsSuccess = true,
                        data = new
                        {
                            FloorId = floorId
                        }
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new
                    {
                        IsSuccess = false,
                        errorMessage = "Floor details not updated successfully."
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception e)
            {
                Utility.Utility.LogError(e, "Edit");
                return(Json(new
                {
                    IsSuccess = false,
                    errorMessage = e.Message
                }));
            }
        }
Exemple #10
0
        private void ButtonCreate_Click(object sender, RoutedEventArgs e)
        {
            FloorVM v = new FloorVM();

            v.Templates     = Templates;
            v.TemplateSysNo = Templates[0].TemplateSysNo.Value;
            UCFloorMaintain uc = new UCFloorMaintain(v);

            uc.Dialog = CurrentPage.Context.Window.ShowDialog(MKT.Resources.ResFloor.Title_Floor_New,
                                                              uc, (ss, argss) =>
            {
                DataGrid.Bind();
            });
        }
Exemple #11
0
        public ActionResult Edit(Guid id)
        {
            var floor = floorRepository.GetFloorById(id);

            FloorVM model = new FloorVM();

            if (floor != null && floor.Count > 0)
            {
                model = floor[0];

                return(View(model));
            }

            return(RedirectToAction("List"));
        }
Exemple #12
0
        public void Save(FloorVM vm, EventHandler <RestClientEventArgs <object> > callback)
        {
            var    master = vm.ConvertVM <FloorVM, FloorMaster>();
            string relativeUrl;

            if (master.SysNo > 0)
            {
                relativeUrl = "/MKTService/Floor/UpdateFloorMaster";
                restClient.Update(relativeUrl, master, callback);
            }
            else
            {
                relativeUrl = "/MKTService/Floor/CreateFloorMaster";
                restClient.Create(relativeUrl, master, callback);
            }
        }
 protected override void OnAppearing()
 {
     Vm             = new FloorVM();
     BindingContext = Vm;
 }
Exemple #14
0
        public ActionResult Create(FloorVM model)
        {
            try
            {
                string floorId = string.Empty;
                model.CreatedBy = LogInManager.LoggedInUserId;

                #region Check Floor Code Available.

                if (this.CheckFloorCodeAvailable(model.Id, model.Code) == false)
                {
                    return(Json(new
                    {
                        IsSuccess = false,
                        errorMessage = string.Format("Floor Code : {0} already exist.", model.Code)
                    }, JsonRequestBehavior.AllowGet));
                }

                #endregion

                floorId = floorRepository.AddFloor(model);

                if (!string.IsNullOrWhiteSpace(floorId))
                {
                    #region Add Rooms

                    int roomNo = (model.FloorNo.Value * 100);

                    for (int intI = 1; intI <= model.NoOfRoom; intI++)
                    {
                        RoomVM room = new RoomVM();
                        room.FloorId     = Guid.Parse(floorId);
                        room.Type        = "";
                        room.RoomNo      = (roomNo + intI).ToString();
                        room.Description = "";
                        room.StatusId    = Guid.Parse(RoomStatusType.CLEAN);
                        room.IsActive    = true;
                        room.IsOccupied  = false;
                        room.CreatedBy   = LogInManager.LoggedInUserId;

                        roomRepository.AddRoom(room);
                    }

                    #endregion

                    return(Json(new
                    {
                        IsSuccess = true,
                        data = new
                        {
                            FloorId = floorId
                        }
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new
                    {
                        IsSuccess = false,
                        errorMessage = "Floor details not saved successfully."
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception e)
            {
                Utility.Utility.LogError(e, "Create");
                return(Json(new
                {
                    IsSuccess = false,
                    errorMessage = e.Message
                }));
            }
        }