Пример #1
0
 public void SaveAddon(Shtoda_addons item)
 {
     try
     {
         _db.SaveAddon(item);
     }
     catch (Exception ex)
     {
         _debug(ex, new object { }, "");
     }
 }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }