public void AddLog(UserOparatesPlaceNames operatingPlaceCode, UserOparatesNames operatingCode, string code, string description) { using (Model.Common.ArchiveCommonDataClassesDataContext dc = new Model.Common.ArchiveCommonDataClassesDataContext(Setting.Sql.ThisProgram.DatabaseConnection.ConnectionString)) { AddLog(dc, operatingPlaceCode, operatingCode, code, description); } }
public void AddLog(Model.Common.ArchiveCommonDataClassesDataContext dc, UserOparatesPlaceNames operatingPlaceCode, UserOparatesNames operatingCode, string code, string description) { int userCode = Setting.User.ThisProgram.GetCurrentUser <Model.Common.User>().Code; var des = GetUserLogCryptoService(userCode); string code_encrypted = ((code == null) ? null : des.EncryptToBase64(code)); string operatingPlaceCode_encrypted = ((operatingPlaceCode == UserOparatesPlaceNames.None) ? null : des.EncryptToBase64(((short)operatingPlaceCode).ToString())); string operatingCode_encrypted = des.EncryptToBase64(((short)operatingCode).ToString()); string sysdate_encrypted = des.EncryptToBase64(DataAccess.CommonDataAccess.GetNewInstance().Connection.GetServerPersianDate()); string systime_encrypted = des.EncryptToBase64(DataAccess.CommonDataAccess.GetNewInstance().Connection.GetServerTime()); string description_encrypted = ((description == null) ? null : des.EncryptToBase64(description)); Model.Common.UserLog userlog = Model.Common.UserLog.GetNewInstance(userCode, operatingPlaceCode_encrypted, operatingCode_encrypted, code_encrypted, description_encrypted, sysdate_encrypted, systime_encrypted, Setting.Archive.ThisProgram.SelectedArchiveTree == null ? null : (int?)Setting.Archive.ThisProgram.SelectedArchiveTree.Archive.ID, Setting.Program.GetMacAddress().ToString()); Model.Common.UserLog.Insert(dc, userlog); dc.SubmitChanges(); ProgramEvents.OnUserLogsChanged(); }