コード例 #1
0
ファイル: UserList.cs プロジェクト: eprasart/kBit.ERP
        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);
        }
コード例 #2
0
ファイル: Session.cs プロジェクト: eprasart/kBit.ERP
 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);
     }
 }
コード例 #3
0
ファイル: Session.cs プロジェクト: eprasart/kBit.ERP
 public static void Log(SessionLog log)
 {
     Save(log);
 }