public ActionResult Create(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here
                try
                {
                    //fill business object
                    var info = new EducationLevelInfo();
                    /*

                    info.EducationLevelId = collection["EducationLevelId"];

                    info.Name = collection["Name"];

                    info.Description = collection["Description"];

                    info.CreatedBy = collection["CreatedBy"];

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

                }
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        private static List<EducationLevelInfo> FillEducationLevelCollection(IDataReader reader, out int totalRecords)
        {
            var retVal = new List<EducationLevelInfo>();
            totalRecords = 0;
            try
            {
                while (reader.Read())
                {
                    //fill business object
                    var info = new EducationLevelInfo();
                    info.EducationLevelId = ConvertHelper.ToInt32(reader["EducationLevelId"]);
                    info.Name = ConvertHelper.ToString(reader["Name"]);
                    info.Description = ConvertHelper.ToString(reader["Description"]);
                    info.CreatedBy = ConvertHelper.ToInt32(reader["CreatedBy"]);
                    info.CreatedDate = ConvertHelper.ToDateTime(reader["CreatedBy"]);
                    retVal.Add(info);
                }
                //Get the next result (containing the total)
                reader.NextResult();

                //Get the total no of records from the second result
                if (reader.Read())
                {
                    totalRecords = Convert.ToInt32(reader[0]);
                }

            }
            catch (Exception exc)
            {
                //DotNetNuke.Services.Exceptions.Exceptions.LogException(exc);
            }
            finally
            {
                //close datareader
                ObjectHelper.CloseDataReader(reader, true);
            }
            return retVal;
        }
 public string Edit(FormDataCollection form)
 {
     var retVal = string.Empty;
     var operation = form.Get("oper");
     var id = ConvertHelper.ToInt32(form.Get("EducationLevelId"));
     var curUserInfo = UserRepository.GetCurrentUserInfo();
     if (!string.IsNullOrEmpty(operation))
     {
         EducationLevelInfo info = null;
         switch (operation)
         {
             case "edit":
                 info = EducationLevelRepository.GetInfo(id);
                 if (info != null)
                 {
                     info.Name = form.Get("Name");
                     info.Description = form.Get("Description");
                     EducationLevelRepository.Update(info);
                 }
                 break;
             case "add":
                 info = new EducationLevelInfo
                            {
                                Name = form.Get("Name"),
                                Description = form.Get("Description"),
                                CreatedBy = curUserInfo.UserID,
                                CreatedDate = DateTime.Now
                            };
                 EducationLevelRepository.Create(info);
                 break;
             case "del":
                 EducationLevelRepository.Delete(id);
                 break;
         }
     }
     StoreData.ListEducationLevel = EducationLevelRepository.GetAll();
     return retVal;
 }
 public static void Update(EducationLevelInfo info)
 {
     DataProvider.Instance().EducationLevels_Update( info.EducationLevelId, info.Name, info.Description, info.CreatedBy,info.CreatedDate);
 }
 public static int Create(EducationLevelInfo info)
 {
     return DataProvider.Instance().EducationLevels_Insert( info.Name, info.Description, info.CreatedBy, info.CreatedDate);
 }