public ActionResult Resource(string workspace, string collection)
 {
   EntryModel model = new EntryModel()
   {
     Entry = AtomPubService.GetEntry(EntryId)
   };
   return View("AtomPubResource", model);
 }
Exemple #2
0
        // Update properties in Entry class from the input object
        public void Update(EntryModel modelEntry)
        {
            // If adding new customer, set created date
            if (modelEntry.EntryId == 0)
            {
                CreatedDate = DateTime.Now;
            }

            // Copy values from input object to Customer properties
            Name = modelEntry.Name;
            EntryText = modelEntry.EntryText;
        }
        /// <summary>
        /// Copies to clipboard selected item password.
        /// </summary>
        private void CopyToClipboardSelectedItemPassword()
        {
            EntriesDataSource ds       = (EntriesTableView.DataSource as EntriesDataSource);
            EntryModel        selected = ds.Items[EntriesTableView.SelectedRow];

            string passwordToCopy = selected.Password;

            NSPasteboard pasteBoard = NSPasteboard.GeneralPasteboard;

            pasteBoard.DeclareTypes(new string[] { NSPasteboard.NSStringType }, null);
            pasteBoard.SetStringForType(passwordToCopy, NSPasteboard.NSStringType);

            //Console.WriteLine("Pasted: " + pasteBoard.GetStringForType(NSPasteboard.NSStringType));
        }
        protected override int Add(EntryViewModel model, UserInfo sysUser, string viewTitle)
        {
            string    sql = @"select * from AssetsTransfer where 1<>1 ";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql, DbUpdate.cmd).Tables[0];

            dt.TableName = "AssetsTransfer";
            DataRow    dr = dt.NewRow();
            string     assetsTransferId = IdGenerator.GetMaxId(dt.TableName);
            int        retApprove       = InitFirstApproveTask("AssetsTransfer", "assetsTransferId", assetsTransferId, viewTitle, "", sysUser.UserId);
            EntryModel myModel          = model as EntryModel;

            myModel.AssetsTransferId = assetsTransferId;
            UpdateUser(myModel, sysUser, viewTitle);
            dr["assetsTransferNo"]   = myModel.AssetsTransferNo;
            dr["assetsTransferName"] = myModel.AssetsTransferName;
            string updateType = "Add";

            if (retApprove != 0)
            {
                dr["approveState"] = "O";
                updateType         = "ApproveAdd";
            }
            dr["assetsTransferId"] = assetsTransferId;
            dr["setBooksId"]       = sysUser.MySetBooks.SetBooksId;
            dt.Rows.Add(dr);
            Create5Field(dt, sysUser.UserId, viewTitle);
            DbUpdate.Update(dt);
            List <AssetsTransfer> gridData = JsonHelper.JSONStringToList <AssetsTransfer>(DataConvert.ToString(myModel.EntryGridString));

            if (gridData.Count < 1)
            {
                throw new Exception(AppMember.AppText["NeedMoreThanOneAssets"]);
            }
            foreach (AssetsTransfer assetsTransfer in gridData)
            {
                AddDetail(assetsTransfer, myModel, assetsTransferId, sysUser, viewTitle, updateType);
                if (retApprove == 0)
                {
                    UpdateAssets(assetsTransfer.AssetsId, DataConvert.ToString(myModel.DepartmentId),
                                 DataConvert.ToString(myModel.StoreSiteId), DataConvert.ToString(myModel.Keeper),
                                 DataConvert.ToString(myModel.UsePeople), sysUser.UserId, viewTitle, assetsTransfer.AssetsStateId);
                }
                else
                {
                    UpdateAssetsState(assetsTransfer.AssetsId, "TI", sysUser.UserId, viewTitle);
                }
            }

            return(1);
        }
Exemple #5
0
        public static IEntry MappFrom(EntryDTO entry)
        {
            EntryModel entryModel = new EntryModel();

            SetCommonDboProperties(entryModel, entry);
            entryModel.EntryNo          = entry.EntryNo;
            entryModel.EntryName        = entry.EntryName;
            entryModel.RegistrationDate = entry.RegistrationDate;
            entryModel.PaidAmount       = entry.PaidAmount;
            entryModel.Boat             = MappFrom(entry.Boat);
            entryModel.Club             = MappFrom(entry.Club);
            entryModel.User             = MappFrom(entry.User);
            return(entryModel);
        }
Exemple #6
0
        /// <summary>
        /// Lets you know if the entry in question is equal to all other root directories.
        /// </summary>
        public bool IsRootDirectoryEqualToOthers(EntryModel entry)
        {
            foreach (var currentEntry in _entries)
            {
                var proposedEntryRoot = _pathBuilder.GetRootDirectory(entry);
                var currentEntryRoot  = _pathBuilder.GetRootDirectory(currentEntry);
                if (!currentEntryRoot.EqualsIgnoreCase(proposedEntryRoot))
                {
                    return(false);
                }
            }

            return(true);
        }
        /// <summary>
        ///		Pega una entrada sobre la categoría
        /// </summary>
        private void PasteEntryToCategory(EntryModel entry, CategoryModel category)
        {
            EntryModel newEntry = entry.Clone();

            // Quita el ID de la entrada clonada para que se cree de nuevo
            newEntry.Id = null;
            // Añade la entrada
            category.Entries.Add(newEntry);
            // Borra la entrada inicial si se debía cortar
            if (MustCut)
            {
                DevConferencesViewModel.Instance.TrackManager.RemoveEntry(entry);
            }
        }
Exemple #8
0
        // Konvertuje úkol a den na hodnotu isChecked zaškrtávacího políčka
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            _values = (object[])values.Clone();

            _entry = (EntryModel)values[0];
            _date  = (DateTime)values[1];

            if (_entry.Completed.Contains(_date))
            {
                return(true);
            }

            return(false);
        }
        private void SetThisModel(EntryModel model)
        {
            model.GridHeight                  = 370;
            model.RemindDays                  = "30";
            model.DepartmentUrl               = Url.Action("DropList", "Department", new { Area = "BusinessCommon" });
            model.DepartmentDialogUrl         = Url.Action("Select", "Department", new { Area = "BusinessCommon" });
            model.DepartmentAddFavoritUrl     = Url.Action("AddFavorit", "Department", new { Area = "BusinessCommon", tableName = "AppDepartment" });
            model.DepartmentReplaceFavoritUrl = Url.Action("ReplaceFavorit", "Department", new { Area = "BusinessCommon", tableName = "AppDepartment" });

            model.StoreSiteUrl               = Url.Action("DropList", "StoreSite", new { Area = "BasicData", currentId = model.StoreSiteId });
            model.StoreSiteDialogUrl         = Url.Action("Select", "StoreSite", new { Area = "BasicData" });
            model.StoreSiteAddFavoritUrl     = Url.Action("AddFavorit", "StoreSite", new { Area = "BasicData", tableName = "StoreSite" });
            model.StoreSiteReplaceFavoritUrl = Url.Action("ReplaceFavorit", "StoreSite", new { Area = "BasicData", tableName = "StoreSite" });
        }
 /// <summary>
 /// Deletes the given EntryModel from Database
 /// </summary>
 /// <param name="entryToDelete">EntryModel to remove</param>
 public static void DeleteEntryFromDatabase(EntryModel entryToDelete)
 {
     try
     {
         using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
         {
             cnn.Query($"DELETE FROM Entry WHERE id = {entryToDelete.Id}");
         }
     }
     catch (SQLiteException ex)
     {
         LogHelper.WriteToLog("DeleteEntryFromDatabase Error", LogState.Error);
     }
 }
        public void Update(EntryModel entry)
        {
            using (var key = Registry.CurrentUser.CreateSubKey(@"Software\Blizzard Entertainment\Diablo II"))
            {
                string saveDirectory = _pathBuilder.GetSaveDirectory(entry);
                string rootDirectory = _pathBuilder.GetRootDirectory(entry);
                int    resolution    = entry.IsExpansion ? 1 : 0;

                key.SetValue("Save Path", saveDirectory);
                key.SetValue("NewSavePath", saveDirectory);
                key.SetValue("Resolution", resolution);
                key.SetValue("InstallPath", rootDirectory);
            }
        }
        private static bool GroupFilter(EntryModel model)
        {
            if (model is ChatEntryModel chatEntryModel)
            {
                var chat = chatEntryModel.Chat;
                if (chat.ChatData.Type is TdApi.ChatType.ChatTypeSupergroup supergroupType)
                {
                    return(!supergroupType.IsChannel);
                }

                return(chat.ChatData.Type is TdApi.ChatType.ChatTypeBasicGroup);
            }
            return(false);
        }
 public ActionResult Check(EntryModel model)
 {
     try
     {
         string ret = "";
         ret = Repository.Check(model);
         return(Content(ret, "text/html"));
     }
     catch (Exception ex)
     {
         AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "MonthRecordController.Check", "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace);
         return(Content("[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace, "text/html"));
     }
 }
Exemple #14
0
 public void SetModel(string primaryKey, string formMode, EntryModel model)
 {
     if (formMode != "new")
     {
         Dictionary <string, object> paras = new Dictionary <string, object>();
         paras.Add("projectManageId", primaryKey);
         string    sql    = @"select * from ProjectManage where projectManageId=@projectManageId";
         DataTable dtGrid = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0];
         DataRow   dr     = dtGrid.Rows[0];
         model.ProjectManageId   = primaryKey;
         model.ProjectManageNo   = DataConvert.ToString(dr["projectManageNo"]);
         model.ProjectManageName = DataConvert.ToString(dr["projectManageName"]);
     }
 }
 public ActionResult Entry(EntryModel model, string approveReturn)
 {
     //if (model.FormMode != "approve")
     //{
     //    if (CheckModelIsValid(model))
     //    {
     //        Update(EntryRepository, model, model.FormMode, model.AssetsSellId, model.ViewTitle);
     //        model.EntryGridLayout = EntryGridLayout(model.FormMode);
     //    }
     //    if (model.FormMode == "reapply")
     //        return RedirectToAction("List", "AssetsSell", new { Area = "AssetsBusiness", pageId = model.PageId, viewTitle = model.ViewTitle, approvemode = model.FormMode });
     //    else
     //    {
     //        SetMustModel(model);
     //        return View(model);
     //    }
     //}
     //else
     //{
     //    return DealApprove(EntryRepository, model, approveReturn);
     //}
     if (Update(Repository, model, model.AssetsSellId, approveReturn) == 1)
     {
         if (model.FormMode == "approve" || model.FormMode == "reapply")
         {
             return(RedirectToAction("List", new { pageId = model.PageId, viewTitle = model.ViewTitle, listMode = model.FormMode }));
         }
         else if (model.FormMode == "new" || model.FormMode == "new2")
         {
             EntryModel newModel = new EntryModel();
             SetParentEntryModel(model.PageId, "", model.FormMode, model.ViewTitle, newModel);
             SetThisEntryModel(newModel);
             return(View(newModel));
         }
         else
         {
             return(RedirectToAction("List", new { pageId = model.PageId, viewTitle = model.ViewTitle }));
         }
     }
     else
     {
         if (model.FormMode == "approve")
         {
             Repository.SetModel(model.ApprovePkValue, model.FormMode, model);
             SetParentEntryModel(model.PageId, model.ApprovePkValue, model.FormMode, model.ViewTitle, model);
         }
         SetThisEntryModel(model);
         return(View(model));
     }
 }
Exemple #16
0
 public ActionResult Entry(EntryModel model, string approveReturn)
 {
     try
     {
         //if (model.FormMode != "approve")
         //{
         //    if (CheckModelIsValid(model))
         //        Update(EntryRepository, model, model.FormMode, model.AssetsBorrowId, model.ViewTitle);
         //    if (model.FormMode == "reapply")
         //        return RedirectToAction("List", "AssetsBorrow", new { Area = "AssetsBusiness", pageId = model.PageId, viewTitle = model.ViewTitle, approvemode = model.FormMode });
         //    else
         //    {
         //        SetMustModel(model);
         //        return View(model);
         //    }
         //}
         //else
         //{
         //    return DealApprove(EntryRepository, model, approveReturn);
         //}
         if (Update(Repository, model, model.AssetsBorrowId, approveReturn) == 1)
         {
             if (model.FormMode == "approve" || model.FormMode == "reapply")
             {
                 return(RedirectToAction("List", new { pageId = model.PageId, viewTitle = model.ViewTitle, listMode = model.FormMode }));
             }
             else if (model.FormMode == "new" || model.FormMode == "new2")
             {
                 EntryModel newModel = new EntryModel();
                 SetParentEntryModel(model.PageId, "", model.FormMode, model.ViewTitle, newModel);
                 SetThisEntryModel(newModel);
                 return(View(newModel));
             }
             else
             {
                 return(RedirectToAction("List", new { pageId = model.PageId, viewTitle = model.ViewTitle }));
             }
         }
         else
         {
             SetThisEntryModel(model);
             return(View(model));
         }
     }
     catch (Exception ex)
     {
         AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "AssetsBorrowController.Entry post", "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace);
         return(Content("[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace, "text/html"));
     }
 }
Exemple #17
0
        public void UpdateEntryStrings(EntryModel edited, ProtectedStringDictionary m_vStrings /*, bool bGuiToInternal, bool bSetRepeatPw*/)
        {
//         if(bGuiToInternal)
//         {
            m_vStrings.Set(PwDefs.TitleField, new ProtectedString(db.MemoryProtection.ProtectTitle, edited.Title));
            m_vStrings.Set(PwDefs.UserNameField, new ProtectedString(db.MemoryProtection.ProtectUserName, edited.UserName));

            byte[] pb = edited.Password.ToUtf8(); //m_icgPassword.GetPasswordUtf8();
            m_vStrings.Set(PwDefs.PasswordField, new ProtectedString(db.MemoryProtection.ProtectPassword, pb));
            MemUtil.ZeroByteArray(pb);

            m_vStrings.Set(PwDefs.UrlField, new ProtectedString(db.MemoryProtection.ProtectUrl, edited.Url));
            m_vStrings.Set(PwDefs.NotesField, new ProtectedString(db.MemoryProtection.ProtectNotes, edited.Notes));
//         }
//         else // Internal to GUI
//         {
//            m_tbTitle.Text = m_vStrings.ReadSafe(PwDefs.TitleField);
//            m_tbUserName.Text = m_vStrings.ReadSafe(PwDefs.UserNameField);
//
//            byte[] pb = m_vStrings.GetSafe(PwDefs.PasswordField).ReadUtf8();
//            m_icgPassword.SetPassword(pb, bSetRepeatPw);
//            MemUtil.ZeroByteArray(pb);
//
//            m_tbUrl.Text = m_vStrings.ReadSafe(PwDefs.UrlField);
//            m_rtNotes.Text = m_vStrings.ReadSafe(PwDefs.NotesField);
//
//            int iTopVisible = UIUtil.GetTopVisibleItem(m_lvStrings);
//            m_lvStrings.Items.Clear();
//            foreach(KeyValuePair<string, ProtectedString> kvpStr in m_vStrings)
//            {
//               if(!PwDefs.IsStandardField(kvpStr.Key))
//               {
//                  PwIcon pwIcon = (kvpStr.Value.IsProtected ? m_pwObjectProtected :
//                     m_pwObjectPlainText);
//
//                  ListViewItem lvi = m_lvStrings.Items.Add(kvpStr.Key, (int)pwIcon);
//
//                  if(kvpStr.Value.IsProtected)
//                     lvi.SubItems.Add(PwDefs.HiddenPassword);
//                  else
//                  {
//                     string strValue = StrUtil.MultiToSingleLine(
//                        kvpStr.Value.ReadString());
//                     lvi.SubItems.Add(strValue);
//                  }
//               }
//            }
//            UIUtil.SetTopVisibleItem(m_lvStrings, iTopVisible);
        }
Exemple #18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="exerciseId"></param>
        /// <returns></returns>
        public async Task <ExerciseModel> GetExerciseByIdAsync(int exerciseId)
        {
            if (Online)
            {
                try
                {
                    ExerciseModel exercise = await mgnService.GetExerciseByIdAsync(exerciseId);

                    Exercise insert = new Exercise();
                    insert.Id          = exercise.Id;
                    insert.Name        = exercise.Name;
                    insert.Url         = exercise.Url;
                    insert.Description = exercise.Description;
                    db.insertUpdateExercise(insert);
                    return(exercise);
                }
                catch (ServerException ex)
                {
                    System.Console.WriteLine("Fehler beim Abrufen einer Übung: " + ex.StackTrace);
                    throw;
                }
            }
            else
            {
                try
                {
                    Exercise      exercise = db.GetExerciseById(exerciseId);
                    ExerciseModel output   = new ExerciseModel();
                    output.Id          = exercise.Id;
                    output.Name        = exercise.Name;
                    output.Url         = exercise.Url;
                    output.Description = exercise.Description;
                    List <EntryModel <int> > temp = new List <EntryModel <int> >();
                    foreach (var item in db.GetAllSchedulesByExercise(output.Id))
                    {
                        EntryModel <int> e = new EntryModel <int>();
                        e.Id = item;
                        temp.Add(e);
                    }
                    output.Schedules = temp;
                    return(output);
                }
                catch (Exception exc)
                {
                    System.Console.WriteLine("Fehler beim lokalen Abrufen einer Übung: " + exc.StackTrace);
                    return(null);
                }
            }
        }
Exemple #19
0
        protected override int Add(EntryViewModel model, UserInfo sysUser, string viewTitle)
        {
            string    sql = @"select * from AssetsMerge where 1<>1 ";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql, DbUpdate.cmd).Tables[0];

            dt.TableName = "AssetsMerge";
            DataRow    dr            = dt.NewRow();
            string     assetsMergeId = IdGenerator.GetMaxId(dt.TableName);
            int        retApprove    = InitFirstApproveTask("AssetsMerge", "AssetsMergeId", assetsMergeId, viewTitle, "", sysUser.UserId);
            EntryModel myModel       = model as EntryModel;

            dr["assetsMergeNo"]   = myModel.AssetsMergeNo;
            dr["assetsMergeName"] = myModel.AssetsMergeName;
            string updateType = "Add";

            if (retApprove != 0)
            {
                dr["approveState"] = "O";
                updateType         = "ApproveAdd";
            }
            dr["AssetsMergeId"] = assetsMergeId;
            dr["setBooksId"]    = sysUser.MySetBooks.SetBooksId;
            dt.Rows.Add(dr);
            Create5Field(dt, sysUser.UserId, viewTitle);
            DbUpdate.Update(dt);
            List <AssetsMerge> gridData    = JsonHelper.JSONStringToList <AssetsMerge>(DataConvert.ToString(myModel.EntryGridString));
            AssetsMerge        assetsMerge = gridData[0];

            assetsMerge.AssetsId = IdGenerator.GetMaxId("Assets");
            List <AssetsMerge> upGridData = JsonHelper.JSONStringToList <AssetsMerge>(DataConvert.ToString(myModel.UpEntryGridString));

            foreach (AssetsMerge originalAssetsMerge in upGridData)
            {
                AddDetail(assetsMerge, originalAssetsMerge, assetsMergeId, sysUser, viewTitle, updateType);
                if (retApprove == 0)
                {
                    UpdateAssetsState(originalAssetsMerge.AssetsId, "M", sysUser.UserId, viewTitle);
                }
                else
                {
                    UpdateAssetsState(originalAssetsMerge.AssetsId, "MI", sysUser.UserId, viewTitle);
                }
            }
            if (retApprove == 0)
            {
                AddNewAssets(assetsMerge, sysUser, viewTitle);
            }
            return(1);
        }
Exemple #20
0
        public bool createJournalEntry(EntryModel entry)
        {
            string query    = "INSERT INTO entries (uid, date, resting_heart_rate, exercise, speed, resistance, time_in_THR_zone) VALUES (@uid, @date, @rhr, @exercise, @speed, @resistance, @timeInTHRZone)";
            object paramObj = new {
                uid           = entry.uid,
                date          = entry.date.ToString(),
                rhr           = entry.resting_heart_rate,
                exercise      = entry.exercise,
                speed         = entry.speed,
                resistance    = entry.resistance,
                timeInTHRZone = entry.time_in_THR_zone
            };

            return(this.Execute(query, paramObj));
        }
        protected DataTable EntryGridDataTable(string formVar, string formMode, string primaryKey)
        {
            EntryModel model = new EntryModel();
            Dictionary <string, object> paras = SetParas(formVar);
            string sortField  = DataConvert.ToString(Request.Form["sidx"]);
            string sortType   = DataConvert.ToString(Request.Params["sord"]);
            int    pageIndex  = DataConvert.ToInt32(Request.Params["page"]);
            int    pageRowNum = DataConvert.ToInt32(Request.Params["rows"]);

            paras.Add("sortField", sortField);
            paras.Add("sortType", sortType);
            paras.Add("pageIndex", pageIndex);
            paras.Add("pageRowNum", pageRowNum);
            return(Repository.GetEntryGridDataTable(paras, formMode, primaryKey));
        }
Exemple #22
0
        public static EntryModel convertDTOToModel(DtoEntry entry)
        {
            EntryModel entryModel = new EntryModel();

            if (entry != null)
            {
                entryModel.CC            = entry.CC;
                entryModel.IdVehicle     = entry.IdVehicle;
                entryModel.IdVehicleType = entry.IdVehicleType;
                entryModel.Id            = entry.Id;
                entryModel.EntryTime     = entry.EntryTime;
            }

            return(entryModel);
        }
Exemple #23
0
 public void SetModel(string primaryKey, string formMode, EntryModel model)
 {
     if (formMode != "new")
     {
         Dictionary <string, object> paras = new Dictionary <string, object>();
         paras.Add("fiscalYearId", primaryKey);
         string    sql    = @"select * from FiscalYear where fiscalYearId=@fiscalYearId";
         DataTable dtGrid = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0];
         DataRow   dr     = dtGrid.Rows[0];
         model.FiscalYearId   = primaryKey;
         model.FiscalYearName = DataConvert.ToString(dr["fiscalYearName"]);
         model.FromDate       = DataConvert.ToDateTime(dr["fromDate"]);
         model.ToDate         = DataConvert.ToDateTime(dr["toDate"]);
     }
 }
        protected override int Modified(EntryViewModel model, UserInfo sysUser, string pkValue, string viewTitle, string formMode)
        {
            Dictionary <string, object> paras = new Dictionary <string, object>();

            paras.Add("equityOwnerId", pkValue);
            string    sql = @"select * from EquityOwner where equityOwnerId=@equityOwnerId";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0];

            dt.TableName = "EquityOwner";
            EntryModel myModel = model as EntryModel;

            SetDataRow(myModel, dt.Rows[0]);
            Update5Field(dt, sysUser.UserId, viewTitle);
            return(DbUpdate.Update(dt));
        }
Exemple #25
0
 public static int AddEntry(EntryModel model)
 {
     lock (locker)
     {
         var check = database.Table <EntryModel>().FirstOrDefault(t => t.ID == model.ID);
         if (check == null)
         {
             return(database.Insert(model));
         }
         else
         {
             return(UpdateEntry(model));
         }
     }
 }
Exemple #26
0
        public void MoveUp(EntryModel entry)
        {
            int selectedEntryIndex = _entries.FindIndex(_ => _ == entry);

            // If we are already at the top, then nothing needs to be done.
            if (selectedEntryIndex != 0)
            {
                // Find previous entry and swap
                int previousEntryIndex = selectedEntryIndex - 1;

                var previousEntry = _entries[previousEntryIndex];
                _entries[previousEntryIndex] = entry;
                _entries[selectedEntryIndex] = previousEntry;
            }
        }
        protected override int Add(EntryViewModel model, UserInfo sysUser, string viewTitle)
        {
            string    sql = @"select * from EquityOwner where 1<>1 ";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql).Tables[0];

            dt.TableName = "EquityOwner";
            DataRow    dr      = dt.NewRow();
            EntryModel myModel = model as EntryModel;

            SetDataRow(myModel, dr);
            dr["equityOwnerId"] = IdGenerator.GetMaxId(dt.TableName);
            dt.Rows.Add(dr);
            Create5Field(dt, sysUser.UserId, viewTitle);
            return(DbUpdate.Update(dt));
        }
Exemple #28
0
        public static int CreateEntry(string name, float amount, string currency, string description)
        {
            EntryModel data = new EntryModel
            {
                Name        = name,
                Amount      = amount,
                Currency    = currency,
                Description = description
            };

            string sql = @"insert into dbo.Entry (Name, Amount, Currency, Description)
                           values (@Name, @Amount, @Currency, @Description)";

            return(SqlDataAccess.SaveData(sql, data));
        }
Exemple #29
0
        public IActionResult deleteConf(int entryID)
        {
            // find entry by id
            EntryModel matchingEntry = _context.entries.FirstOrDefault(e => e.id == entryID);

            // if GameModel is found
            if (matchingEntry != null)
            {
                return(View(matchingEntry));
            }
            else
            {
                return(Content($"No entry found for entry id {entryID}"));
            }
        }
Exemple #30
0
        public void Update(EntryModel obj)
        {
            var storedProc = "sp_update_entry";
            var updateObj  = new
            {
                id               = obj.Id,
                category_id      = obj.CategoryId,
                sub_category_id  = obj.SubCategoryId,
                lexicon_function = obj.LexiconFunction,
                recommendation   = obj.Recommendation,
                notes            = obj.Notes
            };

            Update(storedProc, updateObj);
        }
Exemple #31
0
        public void Copy()
        {
            if (SelectedEntry == null)
            {
                MessageBox.Show("No entry to copy was selected.");
                return;
            }

            var newEntry = _entryManager.Copy(SelectedEntry);

            _entryManager.SaveEntries();

            RefreshEntriesList();
            SelectedEntry = newEntry;
        }
Exemple #32
0
        private void AddRowButton_Click(object sender, RoutedEventArgs e)
        {
            var entry = new EntryModel
            {
                EntryKey     = "",
                EntryValue   = "",
                EntryDate    = DateTime.Now,
                EntryDateRaw = 0
            };

            _model.VaultCollection.Add(entry);
            MainGrid.GetVisualContainer().ScrollOwner.ScrollToEnd();
            MainGrid.SelectedItem = entry;
            _dataChanged          = true;
        }
        public virtual async Task<EntryModel> Get()
        {
            EntryModel model = null;
            await Task.Run(() =>
                {
                    model = new EntryModel();
                });

            model.Links.Add(new Link() { Rel = "self", Href = this.Url.Route(EntryRouteName, new { }) });
            foreach (var link in SalutationsController.FindLinks(this.Url))
            {
                model.Links.Add(link);
            }

            return model;
        }
 public PartialViewResult Entry(string widgetName, Include include)
 {
   var i = new IdInclude(include);
   Id entryId = EntryId;
   if (i.Id != null) entryId = i.Id;
   if (entryId == null) throw new ArgumentException("Unable to determine entry based on include or context.");
   EntryModel model = new EntryModel();
   try
   {
     model.Entry = AtomPubService.GetEntry(entryId);
   }
   catch (ResourceNotFoundException ex)
   {
     LogService.Error(ex);
   }
   return PartialView(widgetName, model);
 }
Exemple #35
0
        /*
        /// <summary>
        /// Gibt einen Trainingsplan zurück
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<ScheduleModel> GetScheduleByIdAsync(int id)
        {
            if (Online)
            {
                try
                {
                    ScheduleModel schedule = await mgnService.GetScheduleByIdAsync(id);
                    return schedule;
                }
                catch (ServerException ex)
                {
                    System.Console.WriteLine("Fehler beim Online-Abrufen eines Trainingsplans: " + ex.StackTrace);
                    throw;
                }
            }
            else
            {
                try
                {
                    Schedule schedule = db.GetScheduleById(id);
                    ScheduleModel result = new ScheduleModel();
                    result.Id = schedule.Id;
                    result.Name = schedule.Name;
                    result.Url = schedule.Url;
                    result.UserId = schedule.UserId;
                    List<EntryModel<int>> temp = new List<EntryModel<int>>();
                    foreach (var item in db.GetAllExercisesBySchedule(result.Id))
                    {
                        EntryModel<int> e = new EntryModel<int>();
                        e.Id = item;
                        temp.Add(e);
                    }
                    result.Exercises = temp;
                    return result;
                }
                catch (Exception exc)
                {
                    System.Console.WriteLine("Fehler beim lokalen Abrufen eines Trainingsplans: " + exc.StackTrace);
                    return null;
                }
            }
        }*/

        /// <summary>
        /// Gibt die Übungen eines Trainingsplans zurück
        /// </summary>
        /// <param name="scheduleId"></param>
        /// <returns></returns>
        public async Task<List<ExerciseModel>> GetExercisesForSchedule(int scheduleId)
        {
            if (Online)
            {
                try
                {
                    ScheduleModel schedule = await mgnService.GetScheduleByIdAsync(scheduleId);
                    IEnumerable<EntryModel<int>> scheduleExercises = schedule.Exercises;
                    List<ExerciseModel> result = new List<ExerciseModel>();
                    foreach (var exercise in scheduleExercises)
                    {
                        //Für jede zugewiesene Id die Exercise raussuchen und der IEnumerable hinzufügen
                        ExerciseModel temp = await mgnService.GetExerciseByIdAsync(exercise.Id);
                        result.Add(temp);
                    }
                    //Übernehmen der Exercises in die lokale DB
                    foreach (var item in result)
                    {
                        Exercise e = new Exercise();
                        e.Description = item.Description;
                        e.Id = item.Id;
                        e.Name = item.Name;
                        e.Url = item.Url;
                        e.WasOffline = false;
                        db.insertUpdateExercise(e);
                        //db.InsertScheduleHasExercises(scheduleId, e.Id, false);
                    }
                    return result;
                }
                catch (ServerException ex)
                {
                    System.Console.WriteLine("Fehler beim Online-Abrufen der Übungen eines Trainingsplans: " + ex.StackTrace);
                    throw;
                }
            }
            else
            {
                try
                {
                    List<ExerciseModel> result = new List<ExerciseModel>();
                    //Anhand der scheduleId alle Exercises aus der ScheduleHasExercises-Tabelle holen
                    Schedule test = db.GetScheduleById(scheduleId);
                    List<Exercise> exercises = db.GetExercisesOfSchedule(scheduleId);
                    foreach (var item in exercises)
                    {
                        ExerciseModel e = new ExerciseModel();
                        e.Description = item.Description;
                        e.Name = item.Name;
                        e.Url = item.Name;
                        e.Id = item.Id;
                        List<EntryModel<int>> schedules = new List<EntryModel<int>>();
                        EntryModel<int> temp = new EntryModel<int>();
                        temp.Id = scheduleId;
                        schedules.Add(temp);
                        e.Schedules = schedules;
                        result.Add(e);
                    }
                    if(result.Count == 0)
                    {
                        Console.WriteLine("Keine Übungen zu dem Trainingsplan vorhanden");
                        return null;
                    }
                    return result;
                }
                catch (Exception exc)
                {
                    System.Console.WriteLine("Fehler beim lokalen Abrufen eines Trainingsplans: " + exc.StackTrace);
                    return null;
                }
            }
        }
Exemple #36
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="exerciseId"></param>
 /// <returns></returns>
 public async Task<ExerciseModel> GetExerciseByIdAsync(int exerciseId)
 {
     if (Online)
     {
         try
         {
             ExerciseModel exercise = await mgnService.GetExerciseByIdAsync(exerciseId);
             Exercise insert = new Exercise();
             insert.Id = exercise.Id;
             insert.Name = exercise.Name;
             insert.Url = exercise.Url;
             insert.Description = exercise.Description;
             db.insertUpdateExercise(insert);
             return exercise;
         }
         catch (ServerException ex)
         {
             System.Console.WriteLine("Fehler beim Abrufen einer Übung: " + ex.StackTrace);
             throw;
         }
     }
     else
     {
         try
         {
             Exercise exercise = db.GetExerciseById(exerciseId);
             ExerciseModel output = new ExerciseModel();
             output.Id = exercise.Id;
             output.Name = exercise.Name;
             output.Url = exercise.Url;
             output.Description = exercise.Description;
             List<EntryModel<int>> temp = new List<EntryModel<int>>();
             foreach (var item in db.GetAllSchedulesByExercise(output.Id))
             {
                 EntryModel<int> e = new EntryModel<int>();
                 e.Id = item;
                 temp.Add(e);
             }
             output.Schedules = temp;
             return output;
         }
         catch(Exception exc)
         {
             System.Console.WriteLine("Fehler beim lokalen Abrufen einer Übung: " + exc.StackTrace);
             return null;
         }
     }
 }