Beispiel #1
0
        public string Edit(FormDataCollection form)
        {
            var retVal = string.Empty;
            var operation = form.Get("oper");
            var id = ConvertHelper.ToInt32(form.Get("LevelId"));
            if (!string.IsNullOrEmpty(operation))
            {
                LevelInfo info;
                switch (operation)
                {
                    case "edit":
                        info = LevelRepository.GetInfo(id);
                        if (info != null)
                        {

                            info.Name = form.Get("Name");

                            info.Description = form.Get("Description");

                            info.Priority = ConvertHelper.ToInt32(form.Get("Priority"));

                            info.ChangedBy = UserRepository.GetCurrentUserInfo().UserID;

                            LevelRepository.Update(info);

                        }
                        break;
                    case "add":
                        info = new LevelInfo
                                   {
                                       Name = form.Get("Name"),
                                       Description = form.Get("Description"),
                                       Priority = ConvertHelper.ToInt32(form.Get("Priority")),
                                       CreatedBy = UserRepository.GetCurrentUserInfo().UserID
                                   };

                        LevelRepository.Create(info);
                        break;
                    case "del":
                        LevelRepository.Delete(id,UserRepository.GetCurrentUserInfo().UserID);
                        break;
                }
            }
            StoreData.ListLevel = LevelRepository.GetAll();
            return retVal;
        }
Beispiel #2
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here
                try
                {
                    //fill business object
                    var info = new LevelInfo();
                    /*

                    info.LevelId = collection["LevelId"];

                    info.Name = collection["Name"];

                    info.Description = collection["Description"];

                    info.Priority = collection["Priority"];

                    info.CreatedBy = collection["CreatedBy"];

                    info.ChangedBy = collection["ChangedBy"];

                    */
                    LevelRepository.Create(info);
                }
                catch (Exception ex)
                {

                }
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
Beispiel #3
0
 public static void Update(LevelInfo info)
 {
     DataProvider.Instance().Levels_Update( info.LevelId, info.Name, info.Description, info.Priority,info.ChangedBy);
 }
Beispiel #4
0
 public static int Create(LevelInfo info)
 {
     return DataProvider.Instance().Levels_Insert( info.Name, info.Description, info.Priority,info.CreatedBy);
 }