Example #1
0
        private void OnAddUserLogon()
        {
            dlgAddUserLogon dlg = new dlgAddUserLogon();

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                DataTable dt = dgLogon.DataSource as DataTable;
                if (dt == null)
                {
                    return;
                }
                DataRow newRow = dt.NewRow();
                newRow["Checked"]      = false;
                newRow["LogonGUID"]    = dlg.Logon.LogonGUID.ToString();
                newRow["DocStaffGUID"] = dlg.Logon.DocStaffGUID.ToString();
                newRow["Password"]     = dlg.Logon.Password;
                newRow["StaffTypeStr"] = dlg.StaffTypeStr;
                newRow["FullName"]     = dlg.FullName;

                if (dlg.Logon.CreatedDate.HasValue)
                {
                    newRow["CreatedDate"] = dlg.Logon.CreatedDate;
                }

                if (dlg.Logon.CreatedBy.HasValue)
                {
                    newRow["CreatedBy"] = dlg.Logon.CreatedBy.ToString();
                }

                if (dlg.Logon.UpdatedDate.HasValue)
                {
                    newRow["UpdatedDate"] = dlg.Logon.UpdatedDate;
                }

                if (dlg.Logon.UpdatedBy.HasValue)
                {
                    newRow["UpdatedBy"] = dlg.Logon.UpdatedBy.ToString();
                }

                if (dlg.Logon.DeletedDate.HasValue)
                {
                    newRow["DeletedDate"] = dlg.Logon.DeletedDate;
                }

                if (dlg.Logon.DeletedBy.HasValue)
                {
                    newRow["DeletedBy"] = dlg.Logon.DeletedBy.ToString();
                }

                newRow["Status"] = dlg.Logon.Status;
                dt.Rows.Add(newRow);
                //SelectLastedRow();
            }
        }
Example #2
0
        private void OnEditUserLogon()
        {
            if (dgLogon.SelectedRows == null || dgLogon.SelectedRows.Count <= 0)
            {
                MsgBox.Show(Application.ProductName, "Vui lòng chọn 1 người sử dụng.", IconType.Information);
                return;
            }

            DataRow         drLogon = (dgLogon.SelectedRows[0].DataBoundItem as DataRowView).Row;
            dlgAddUserLogon dlg     = new dlgAddUserLogon(drLogon);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                drLogon["DocStaffGUID"] = dlg.Logon.DocStaffGUID.ToString();
                drLogon["Password"]     = dlg.Logon.Password;
                drLogon["StaffTypeStr"] = dlg.StaffTypeStr;
                drLogon["FullName"]     = dlg.FullName;

                if (dlg.Logon.CreatedDate.HasValue)
                {
                    drLogon["CreatedDate"] = dlg.Logon.CreatedDate;
                }

                if (dlg.Logon.CreatedBy.HasValue)
                {
                    drLogon["CreatedBy"] = dlg.Logon.CreatedBy.ToString();
                }

                if (dlg.Logon.UpdatedDate.HasValue)
                {
                    drLogon["UpdatedDate"] = dlg.Logon.UpdatedDate;
                }

                if (dlg.Logon.UpdatedBy.HasValue)
                {
                    drLogon["UpdatedBy"] = dlg.Logon.UpdatedBy.ToString();
                }

                if (dlg.Logon.DeletedDate.HasValue)
                {
                    drLogon["DeletedDate"] = dlg.Logon.DeletedDate;
                }

                if (dlg.Logon.DeletedBy.HasValue)
                {
                    drLogon["DeletedBy"] = dlg.Logon.DeletedBy.ToString();
                }

                drLogon["Status"] = dlg.Logon.Status;
            }
        }