Exemple #1
0
        private void btnCreateLogin_Click(object sender, EventArgs e)
        {
            if (int.Parse(txtEmpDelStatus.Text) == 1)
            {
                XtraMessageBox.Show(Cons.ErrorSwitchEmployeeAlready, Cons.CaptionError,
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            int employeeId = int.Parse(txtEmpId.EditValue.ToString());

            using (SqlConnection connection = new SqlConnection(UtilDB.ConnectionString))
            {
                connection.Open();
                using (SqlCommand command = new SqlCommand(MyConfig.SpKiemTraNVCoTaiKhoan, connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@manv", employeeId);
                    try
                    {
                        command.ExecuteNonQuery();
                        FlyoutAction flyoutAction = new FlyoutAction()
                        {
                            Caption = Cons.CaptionCreateLogin,
                        };
                        CustomFlyoutDialog.ShowForm(this, flyoutAction, new frmRegister(employeeId));
                    }
                    catch (Exception ex)
                    {
                        if (ex is SqlException exAsSqlEx && exAsSqlEx.Number == MyConfig.ErrorMsgNumEmployeeHaveLogin)
                        {
                            XtraMessageBox.Show(exAsSqlEx.Message, Cons.CaptionError,
                                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
Exemple #2
0
 private void btnRegister_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (!UtilDB.CurrentGroup.Equals(MyConfig.UserGroupName))
     {
         FlyoutAction flyoutAction = new FlyoutAction()
         {
             Caption = Cons.CaptionCreateLogin,
         };
         CustomFlyoutDialog.ShowForm(this, flyoutAction, new frmRegister());
     }
     else
     {
         XtraMessageBox.Show(Cons.WarningUserCreateTK, Cons.CaptionWarning,
                             MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Exemple #3
0
        public static DialogResult ShowForm(Form owner, FlyoutAction action, Control userControlToShow)
        {
            CustomFlyoutDialog flyoutDialog = new CustomFlyoutDialog(owner, action, userControlToShow);

            return(flyoutDialog.ShowDialog());
        }