Beispiel #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!IsValidated())
            {
                return;
            }
            Cursor = Cursors.WaitCursor;
            var m   = new User();
            var log = new SessionLog {
                Module = Module
            };

            m.Id        = Id;
            m.Username  = txtUsernane.Text.Trim();
            m.Full_Name = txtFullName.Text;
            m.Pwd       = txtPwd.Text;
            m.Phone     = txtPhone.Text;
            m.Email     = txtEmail.Text;
            m.Note      = txtNote.Text;
            if (dtpStart.Checked)
            {
                m.Start_On = dtpStart.Value;
            }
            if (dtpEnd.Checked)
            {
                m.End_On = dtpEnd.Value;
            }
            if (m.Id == 0)
            {
                log.Priority = Type.Priority_Information;
                log.Type     = Type.Log_Insert;
            }
            else
            {
                log.Priority = Type.Priority_Caution;
                log.Type     = Type.Log_Update;
            }
            ////m.Id = UserFacade.Save(m);
            if (dgvList.RowCount > 0)
            {
                rowIndex = dgvList.CurrentRow.Index;
            }
            RefreshGrid(m.Id);
            LockControls();
            Cursor      = Cursors.Default;
            log.Message = "Save successfull. Id=" + m.Id + " ,Username=" + txtUsernane.Text;
            SessionLogFacade.Log(log);
        }
Beispiel #2
0
 private static void Save(SessionLog m)
 {
     try
     {
         if (m.Id == 0)
         {
             var sql = "insert into sm_session_log (session_id, priority, module, type, message)\n" +
                       "values (:Session_Id, :Priority, :Module, :Type, :Message)";
             m.Session_Id = SYS.App.session.Id;
             SqlFacade.Connection.Execute(sql, m);
         }
         else
         {
             //SqlFacade.Connection.UpdateOnly(m, p => new { p.Username }, p => p.Id == m.Id);
         }
     }
     catch (Exception ex)
     {
         SYS.ErrorLogFacade.LogToFile(ex);
     }
 }
Beispiel #3
0
 public static void Log(SessionLog log)
 {
     Save(log);
 }