public bool EditActField(aspnet_Users userRol, int id, string code, string value, out string msg, Shtoda_acts user) { bool res = false; var document = new Shtoda_acts(); try { if (!_IsCanUserChange(userRol)) { msg = "Недостаточна прав для редактирования!"; } else { document = GetAct(id); if (document != null) { SaveAct(document); res = true; msg = "Успешно"; } else { msg = "Не удалось найти документ"; } } } catch (Exception ex) { _debug(ex, new { }, ""); msg = "Произошла ошибка, поле не изменено"; } return(res); }
public bool EditAct(aspnet_Users user, int id, string name, string value, out string msg) { var res = false; var item = new Shtoda_acts(); msg = ""; try { if (!_IsCanUserChange(user)) { msg = "Недостаточна прав для редактирования!"; } else { item = GetAct(id); if (item != null) { switch (name) { case "desc": item.desc = value; break; case "number": item.number = value; break; case "statusName": if (value != "") { item.statusID = RDL.Convert.StrToInt(value, 0); } break; case "contagentName": if (value != "") { item.contagentID = RDL.Convert.StrToInt(value, 0); } break; } SaveAct(item); res = true; msg = "Успешно"; } } } catch (Exception ex) { _debug(ex, new { id, name }, ""); msg = "Произошла ошибка, поле не изменено"; } return(res); }
public void SaveAct(Shtoda_acts item) { try { _db.SaveAct(item); } catch (Exception ex) { _debug(ex, new { item }, ""); } }
public Shtoda_acts GetAct(int id) { var res = new Shtoda_acts(); try { res = _db.GetActs().FirstOrDefault(x => x.id == id); } catch (Exception ex) { _debug(ex, new { id }, ""); } return(res); }
public bool CreateAct(string name) { var res = false; var act = new Shtoda_acts(); try { act = new Shtoda_acts { id = 0, desc = name }; SaveAct(act); res = true; } catch (Exception ex) { _debug(ex, new { name }, ""); } return(res); }