Beispiel #1
0
        private molchanov_logDocStatuses _logDocStatusesChanges(aspnet_Users user, molchanov_docStatuses element, string notice)
        {
            var res = new molchanov_logDocStatuses {
                date = DateTime.Now, userName = user.UserName, notice = "{element.name}: " + notice, docStatusID = element.id
            };

            return(res);
        }
Beispiel #2
0
 public int SaveDocStatus(molchanov_docStatuses element, bool withSave = true)
 {
     if (element.id == 0)
     {
         db.molchanov_docStatuses.Add(element);
         if (withSave)
         {
             Save();
         }
     }
     else
     {
         db.Entry(element).State = EntityState.Modified;
         if (withSave)
         {
             Save();
         }
     }
     return(element.id);
 }
Beispiel #3
0
        public molchanov_docStatuses CreateDocStatus(Dictionary <string, string> parameters, out string msg, aspnet_Users user)
        {
            msg = "";
            molchanov_docStatuses res;

            try
            {
                if (!_canManageItem(user))
                {
                    msg = "Нет прав создавать элемента";
                    res = null;
                }
                else
                {
                    res = new molchanov_docStatuses();
                    foreach (var key in parameters.Keys)
                    {
                        if (key == "name")
                        {
                            res.name = parameters[key];
                        }
                        else if (key == "code")
                        {
                            res.code = parameters[key];
                        }
                    }
                    _db.SaveDocStatus(res);
                    _db.SaveDocStausesLog(_logDocStatusesChanges(user, res, "Статус документа создан"));
                }
            }
            catch (Exception e)
            {
                _debug(e, new { }, "Ошибка возникла при создании элемента");
                res = null;
            }
            return(res);
        }
Beispiel #4
0
 public int AddDocStatus(molchanov_docStatuses element)
 {
     _docStatusesList.Add(element);
     return(element.id);
 }