public void SaveAddon(Shtoda_addons item) { try { _db.SaveAddon(item); } catch (Exception ex) { _debug(ex, new object { }, ""); } }
public Shtoda_addons GetAddon(int id) { var res = new Shtoda_addons(); try { res = _db.GetAddons().FirstOrDefault(x => x.id == id); } catch (Exception ex) { _debug(ex, new { }, ""); } return(res); }
public bool EditAddonField(int id, string code, string value, out string msg, Shtoda_addons user) { bool res = false; var addon = new Shtoda_addons(); try { addon = GetAddon(id); if (addon.contagentID != user.id) { msg = "Нет прав для редактирования счета"; return(res); } if (addon != null) { switch (code) { case "number": addon.number = value; break; case "contractorID": addon.contagentID = RDL.Convert.StrToInt(value, 0); break; case "comment": addon.desc = value; break; case "addonStatus": addon.statusID = RDL.Convert.StrToInt(value, 0); break; } SaveAddon(addon); res = true; msg = "Успешно"; } else { msg = "Не удалось найти счет"; } } catch (Exception ex) { _debug(ex, new object { }, ""); msg = "Ошибка редатирования"; } return(res); }
public bool AddAddon(int number, Shtoda_addons user) { bool res = false; var addon = new Shtoda_addons(); try { addon = new Shtoda_addons { id = 0, number = number.ToString(), contagentID = user.id, date = DateTime.Now, }; Saveaddon(addon); } catch (Exception ex) { _debug(ex, new object { }, ""); } return(res); }