Beispiel #1
0
        private void UpdBtn_Click(object sender, EventArgs e)
        {
            if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_USER_MANAGEMENT))
            {
                return;
            }
            string func_code = FuncCodeTBx.Text.Trim();
            string func_name = FuncNameTBx.Text.Trim();

            if (!checkInputData())
            {
                return;
            }

            Boolean updSuccess =
                bcApp.SCApplication.UserBLL.updateFunctionCodeByCode(func_code, func_name);

            if (updSuccess)
            {
                //MessageBox.Show(this, BCApplication.getMessageString("UPDATE_SUCCESS"));
                BCUtility.showMsgBox_Info(this, BCApplication.getMessageString("UPDATE_SUCCESS"));
                Refresh();
            }
            else
            {
                //MessageBox.Show(this, BCApplication.getMessageString("UPDATE_FAILED"));
                BCUtility.showMsgBox_Info(this, BCApplication.getMessageString("UPDATE_FAILED"));
            }
        }
        private void AddBtn_Click(object sender, EventArgs e)
        {
            if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_USER_MANAGEMENT))
            {
                return;
            }
            string user_group = this.UserGroupTbx.Text.Trim();

            if (!checkInputData())
            {
                return;
            }

            Boolean createSuccess = bcApp.SCApplication.UserBLL.addUserGroup(user_group);

            if (createSuccess)
            {
                //MessageBox.Show(this, BCApplication.getMessageString("CREATE_SUCCESS"));
                BCUtility.showMsgBox_Info(this, BCApplication.getMessageString("CREATE_SUCCESS"));
                Refresh();
            }
            else
            {
                //MessageBox.Show(this, BCApplication.getMessageString("CREATE_FAILED"));
                BCUtility.showMsgBox_Info(this, BCApplication.getMessageString("CREATE_FAILED"));
            }
        }
Beispiel #3
0
        /// <summary>
        /// Handles the FormClosing event of the BCMainForm control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="FormClosingEventArgs"/> instance containing the event data.</param>
        private void BCMainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            //TODO 確認Authority
            //if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_CLOSE_MASTER_PC))
            //{
            //    //e.Cancel = true;
            //    //return;
            //}
            DialogResult confirmResult = MessageBox.Show(this, "Do you want to close OHTC?",
                                                         BCApplication.getMessageString("CONFIRM"), MessageBoxButtons.YesNo);

            if (confirmResult != System.Windows.Forms.DialogResult.Yes)
            {
                e.Cancel = true;
            }
            if (e.Cancel == false)
            {
                try
                {
                    ProgressBarDialog progress = new ProgressBarDialog(bcApp);
                    System.Threading.ThreadPool.QueueUserWorkItem(
                        new System.Threading.WaitCallback(doStopConnection), progress);
                    if (progress != null && !progress.IsDisposed)
                    {
                        progress.ShowDialog();
                    }
                }
                catch (Exception ex)
                {
                    logger.Error(ex, "Exception");
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// Handles the Click event of the stopConnectionToolStripMenuItem1 control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void stopConnectionToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_CONNECTION_MANAGEMENT))
            {
                return;
            }
            try
            {
                DialogResult confirmResult = MessageBox.Show(this, BCApplication.getMessageString("Confirm_STOP_CONNECTING"),
                                                             BCApplication.getMessageString("CONFIRM"), MessageBoxButtons.YesNo);
                if (confirmResult != System.Windows.Forms.DialogResult.Yes)
                {
                    return;
                }

                ProgressBarDialog progress = new ProgressBarDialog(bcApp);
                System.Threading.ThreadPool.QueueUserWorkItem(
                    new System.Threading.WaitCallback(doStopConnection), progress);
                if (progress != null && !progress.IsDisposed)
                {
                    progress.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception:");
            }
        }
 public static void showMsgBox_Info(IWin32Window _from, string txt)
 {
     MessageBox.Show(_from, txt
                     , BCApplication.getMessageString("INFO")
                     , MessageBoxButtons.OK
                     , MessageBoxIcon.Information);
 }
Beispiel #6
0
        /// <summary>
        /// Does the start connection.
        /// </summary>
        /// <param name="status">The status.</param>
        private void doStartConnection(object status)
        {
            ProgressBarDialog progress = status as ProgressBarDialog;

            progress.Begin();
            progress.SetText(BCApplication.getMessageString("START_CONNECTING"));
            bcApp.startProcess();

            //Do something...

            progress.End();
        }
        /// <summary>
        /// Does the login.
        /// </summary>
        /// <param name="window">The window.</param>
        /// <param name="bcApp">The bc application.</param>
        /// <param name="function_code">The function_code.</param>
        /// <param name="isForceChack">if set to <c>true</c> [is force chack].</param>
        /// <returns>Boolean.</returns>
        public static Boolean doLogin(System.Windows.Forms.IWin32Window window, BCApplication bcApp, string function_code, bool isForceChack)//A0.01
        {
            //return true;
            string  loginUserID = bcApp.LoginUserID;
            Boolean hasAuth     = false;

            if (!isForceChack && !SCUtility.isEmpty(loginUserID))
            {
                hasAuth = bcApp.SCApplication.UserBLL.checkUserAuthority(loginUserID, function_code);
            }

            if (hasAuth)
            {
                return(true);
            }

            //            LoginPopupForm loginForm = new LoginPopupForm(function_code);
            //如果已經有人登入了,就必須已切換帳號的方式再次登入
            LoginPopupForm loginForm = new LoginPopupForm(function_code, isForceChack ? false : BCUtility.isLogin(bcApp));

            System.Windows.Forms.DialogResult result = loginForm.ShowDialog(window);
            loginUserID = loginForm.getLoginUserID();
            string loginPassword = loginForm.getLoginPassword();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                loginForm.Dispose();
            }
            else
            {
                loginForm.Dispose();
                return(false);
            }
            Boolean loginSuccess = false;

            if (!SCUtility.isEmpty(loginUserID))
            {
                loginSuccess = bcApp.SCApplication.UserBLL.checkUserPassword(loginUserID, loginPassword);
            }
            if (loginSuccess)
            {
                bcApp.login(loginUserID);
                hasAuth = bcApp.SCApplication.UserBLL.checkUserAuthority(loginUserID, function_code);
            }

            if (!hasAuth)
            {
                MessageBox.Show(window, BCApplication.getMessageString("NO_AUTHORITY"),
                                BCApplication.getMessageString("WARNING"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            return(hasAuth);
        }
        private async void button2_Click(object sender, EventArgs e)
        {
            DialogResult confirmResult = MessageBox.Show(this, "Do you want to reset current reserve section?",
                                                         BCApplication.getMessageString("CONFIRM"), MessageBoxButtons.YesNo);

            if (confirmResult != System.Windows.Forms.DialogResult.Yes)
            {
                return;
            }
            await Task.Run(() => bcApp.SCApplication.ReserveBLL.RemoveAllReservedSections());

            bcf.App.BCFApplication.onInfoMsg("Fource release current vehicle reserve status success");
        }
        private Boolean checkInputData()
        {
            string user_group = this.UserGroupTbx.Text.Trim();

            if (SCUtility.isEmpty(user_group))
            {
                MessageBox.Show(this, BCApplication.getMessageString("USER_GROUP_CANNOT_BE_BLANK"),
                                BCApplication.getMessageString("WARNING"),
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
            return(true);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="LoginPopupForm"/> class.
 /// </summary>
 /// <param name="function_code">The function_code.</param>
 /// <param name="withDifferentAccount">The with different account.</param>
 public LoginPopupForm(string function_code, Boolean withDifferentAccount)
 {
     InitializeComponent();
     this.function_code = function_code;
     bcApp = BCApplication.getInstance();
     if (withDifferentAccount)
     {
         this.Text = BCApplication.getMessageString("Login_With_Other_Account");
     }
     else
     {
         this.Text = BCApplication.getMessageString("Login");
     }
 }
        private async void btn_resetReservedSectionByVh_Click(object sender, EventArgs e)
        {
            string       vh_id         = cmb_vh_ids.Text;
            DialogResult confirmResult = MessageBox.Show(this, $"Do you want to reset vh:{vh_id} current reserved section?",
                                                         BCApplication.getMessageString("CONFIRM"), MessageBoxButtons.YesNo);

            if (confirmResult != System.Windows.Forms.DialogResult.Yes)
            {
                return;
            }
            await Task.Run(() => bcApp.SCApplication.ReserveBLL.RemoveAllReservedSectionsByVehicleID(vh_id));

            bcf.App.BCFApplication.onInfoMsg($"Fource release current vehicle:{vh_id} reserved status success");
        }
Beispiel #12
0
        private Boolean checkInputData()
        {
            string func_code = FuncCodeTBx.Text.Trim();
            string func_name = FuncNameTBx.Text.Trim();

            if (SCUtility.isEmpty(func_code) || SCUtility.isEmpty(func_name))
            {
                MessageBox.Show(this, BCApplication.getMessageString("FUNCTION_CODE_NAME_CANNOT_BE_BLANK"),
                                BCApplication.getMessageString("WARNING"),
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
            return(true);
        }
Beispiel #13
0
        /// <summary>
        /// Handles the FormClosing event of the BCMainForm control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="FormClosingEventArgs"/> instance containing the event data.</param>
        private void BCMainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            //TODO 確認Authority
            //if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_CLOSE_MASTER_PC))
            //{
            //    //e.Cancel = true;
            //    //return;
            //}

            //1.初步詢問是否要關閉OHBC
            DialogResult confirmResult = MessageBox.Show(this, "Do you want to close OHTC?",
                                                         BCApplication.getMessageString("CONFIRM"), MessageBoxButtons.YesNo);

            recordAction("Do you want to close OHTC?", confirmResult.ToString());
            if (confirmResult != System.Windows.Forms.DialogResult.Yes)
            {
                e.Cancel = true;
                return;
            }

            if (!SCUtility.isMatche(bcApp.SCApplication.BC_ID, "ASE_LOOP"))
            {
                if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_CLOSE_SYSTEM, true))
                {
                    e.Cancel = true;
                    recordAction("Close Master PC, Authority Check...", "Failed !!");
                    return;
                }
            }
            recordAction("Close Master PC, Authority Check...", "Success !!");

            if (e.Cancel == false)
            {
                try
                {
                    ProgressBarDialog progress = new ProgressBarDialog(bcApp);
                    System.Threading.ThreadPool.QueueUserWorkItem(
                        new System.Threading.WaitCallback(doStopConnection), progress);
                    if (progress != null && !progress.IsDisposed)
                    {
                        progress.ShowDialog();
                    }
                }
                catch (Exception ex)
                {
                    logger.Error(ex, "Exception");
                }
            }
        }
        private void registerFunction()
        {
            if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_USER_MANAGEMENT))
            {
                return;
            }
            UASUSRGRP selectUserGroup = getSelectedRowToTextBox();

            if (selectUserGroup == null)
            {
                return;
            }

            FuncCodePopupForm funcCodePopupForm = new FuncCodePopupForm();

            funcCodePopupForm.setUserGroup(selectUserGroup.USER_GRP);
            DialogResult  result             = funcCodePopupForm.ShowDialog(this);
            List <UASFNC> selectFuncCodeList = new List <UASFNC>();

            if (result == DialogResult.OK)
            {
                selectFuncCodeList = funcCodePopupForm.getSelectFunctionCodeList();
                funcCodePopupForm.Dispose();
            }
            else
            {
                funcCodePopupForm.Dispose();
                return;
            }
            if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_USER_MANAGEMENT))
            {
                return;
            }

            List <string> funcCodes       = selectFuncCodeList.Select(o => o.FUNC_CODE.Trim()).ToList();
            Boolean       registerSuccess = bcApp.SCApplication.UserBLL.registerUserFunc(selectUserGroup.USER_GRP, funcCodes);

            if (registerSuccess)
            {
                //MessageBox.Show(this, BCApplication.getMessageString("REGISTER_SUCCESS"));
                BCUtility.showMsgBox_Info(this, BCApplication.getMessageString("REGISTER_SUCCESS"));
                Refresh();
            }
            else
            {
                //MessageBox.Show(this, BCApplication.getMessageString("REGISTER_FAILED"));
                BCUtility.showMsgBox_Info(this, BCApplication.getMessageString("REGISTER_FAILED"));
            }
        }
Beispiel #15
0
        private Boolean checkInputDataForAdd()
        {
            string user_id   = this.UserIDTbx.Text.Trim();
            string user_name = this.UserNameTbx.Text.Trim();
            string passwd    = this.PswdTbx.Text.Trim();

            if (SCUtility.isEmpty(user_id) || SCUtility.isEmpty(user_name) || SCUtility.isEmpty(passwd))
            {
                MessageBox.Show(this, BCApplication.getMessageString("USER_ID_NAME_PWD_CANNOT_BE_BLANK"),
                                BCApplication.getMessageString("WARNING"),
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
            return(true);
        }
Beispiel #16
0
 private void logOutToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         BCUtility.doLogout(bcApp);
         MessageBox.Show(this, BCApplication.getMessageString("LOGOUT_SUCCESS")
                         , BCApplication.getMessageString("INFO")
                         , MessageBoxButtons.OK
                         , MessageBoxIcon.Information);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Exception:");
     }
 }
Beispiel #17
0
        private Boolean checkInputDataForUpdate()
        {
            string user_id   = this.UserIDTbx.Text.Trim();
            string user_name = this.UserNameTbx.Text.Trim();
            string user_grp  = this.userGrpCbx.Text.Trim(); //A0.01

            //A0.01 if (SCUtility.isEmpty(user_id) || SCUtility.isEmpty(user_name))
            if (SCUtility.isEmpty(user_id) || SCUtility.isEmpty(user_name) || SCUtility.isEmpty(user_grp))  //A0.01
            {
                MessageBox.Show(this, BCApplication.getMessageString("USER_ID_NAME_CANNOT_BE_BLANK"),
                                BCApplication.getMessageString("WARNING"),
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
            return(true);
        }
        /// <summary>
        /// 單純進行Login動作
        /// </summary>
        /// <param name="window">The window.</param>
        /// <param name="bcApp">The bc application.</param>
        /// <returns>Boolean.</returns>
        public static Boolean doLogin(System.Windows.Forms.IWin32Window window, BCApplication bcApp)
        {
            string  loginUserID = bcApp.LoginUserID;
            Boolean hasAuth     = false;

            if (!SCUtility.isEmpty(loginUserID))
            {
                MessageBox.Show(window, BCApplication.getMessageString("Already_Login"),
                                BCApplication.getMessageString("INFO"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            LoginPopupForm loginForm = new LoginPopupForm(BCAppConstants.FUNC_LOGIN);

            System.Windows.Forms.DialogResult result = loginForm.ShowDialog(window);
            loginUserID = loginForm.getLoginUserID();
            string loginPassword = loginForm.getLoginPassword();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                loginForm.Dispose();
            }
            else
            {
                loginForm.Dispose();
                return(false);
            }
            Boolean loginSuccess = false;

            if (!SCUtility.isEmpty(loginUserID))
            {
                loginSuccess = bcApp.SCApplication.UserBLL.checkUserPassword(loginUserID, loginPassword);
            }
            if (loginSuccess)
            {
                bcApp.login(loginUserID);
                hasAuth = bcApp.SCApplication.UserBLL.checkUserAuthority(loginUserID, BCAppConstants.FUNC_LOGIN);
                MessageBox.Show(window, BCApplication.getMessageString("Log in success."),
                                BCApplication.getMessageString("INFO"), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            if (!hasAuth)
            {
                MessageBox.Show(window, BCApplication.getMessageString("NO_AUTHORITY"),
                                BCApplication.getMessageString("WARNING"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            return(hasAuth);
        }
Beispiel #19
0
        private void DeleteBtn_Click(object sender, EventArgs e)
        {
            if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_USER_MANAGEMENT))
            {
                return;
            }
            UASFNC selectFuncCode = getSelectedRowToTextBox();

            if (selectFuncCode == null)
            {
                return;
            }
            if (BCFUtility.isMatche(BCAppConstants.FUNC_USER_MANAGEMENT, selectFuncCode.FUNC_CODE))
            {
                return;
            }
            var confirmResult = MessageBox.Show(this, "Are you sure to delete this item ?",
                                                "Confirm Delete!",
                                                MessageBoxButtons.YesNo);

            if (confirmResult != DialogResult.Yes)
            {
                return;
            }

            Boolean deleteSuccess =
                bcApp.SCApplication.UserBLL.deleteFunctionCodeByCode(selectFuncCode.FUNC_CODE);

            if (deleteSuccess)
            {
                //MessageBox.Show(this, BCApplication.getMessageString("DELETE_SUCCESS"));
                BCUtility.showMsgBox_Info(this, BCApplication.getMessageString("DELETE_SUCCESS"));
                Refresh();
            }
            else
            {
                //MessageBox.Show(this, BCApplication.getMessageString("DELETE_FAILED"));
                BCUtility.showMsgBox_Info(this, BCApplication.getMessageString("DELETE_FAILED"));
            }
        }
Beispiel #20
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_USER_MANAGEMENT))
            {
                return;
            }
            string user_id   = this.UserIDTbx.Text.Trim();
            string user_name = this.UserNameTbx.Text.Trim();
            string passwd    = this.PswdTbx.Text.Trim();
            string userGrp   = this.userGrpCbx.Text.Trim(); //A0.01
            //A0.03 Boolean isDisable = this.Disable_Y_RBtn.Checked;
            //A0.03 Boolean isPowerUser = this.Power_Y_RBtn.Checked;
            Boolean isDisable = false;   //A0.03

#pragma warning disable CS0219           // 已指派變數 'isPowerUser',但是從未使用過它的值。
            Boolean isPowerUser = false; //A0.03
#pragma warning restore CS0219           // 已指派變數 'isPowerUser',但是從未使用過它的值。

            if (!checkInputDataForAdd())
            {
                return;
            }

            Boolean createSuccess =
                bcApp.SCApplication.UserBLL.createUser(user_id, user_name, passwd, isDisable, userGrp, null, null);  //A0.01
            //A0.01    bcApp.SCApplication.UserBLL.createUser(user_id, user_name, passwd, isDisable, isPowerUser);
            if (createSuccess)
            {
                //MessageBox.Show(this, BCApplication.getMessageString("CREATE_SUCCESS"));
                BCUtility.showMsgBox_Info(this, BCApplication.getMessageString("CREATE_SUCCESS"));
                Refresh();
            }
            else
            {
                //MessageBox.Show(this, BCApplication.getMessageString("CREATE_FAILED"));
                BCUtility.showMsgBox_Info(this, BCApplication.getMessageString("CREATE_FAILED"));
            }
        }
        //private void m_updateBtn_Click(object sender, EventArgs e)
        private void updateBtn()
        {
            string oldpasswd = SCUtility.Trim(m_oldPwdTxb.Text);
            string passwd    = SCUtility.Trim(m_newPwdTxb.Text);
            string verPasswd = SCUtility.Trim(m_newPwdVerTxb.Text);

            if (!bcApp.SCApplication.UserBLL.checkUserPassword(bcApp.LoginUserID, oldpasswd))                              //A0.01
            {                                                                                                              //A0.01
                MessageBox.Show(this, BCApplication.getMessageString("Please_Check_Old_Password"),                         //A0.01
                                BCApplication.getMessageString("INFO"), MessageBoxButtons.OK, MessageBoxIcon.Information); //A0.01
                return;                                                                                                    //A0.01
            }                                                                                                              //A0.01

            if (SCUtility.isEmpty(passwd) || SCUtility.isEmpty(verPasswd))
            {
                MessageBox.Show(this, BCApplication.getMessageString("Please_Input_New_Password"),
                                BCApplication.getMessageString("INFO"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (!SCUtility.isMatche(passwd, verPasswd))
            {
                MessageBox.Show(this, BCApplication.getMessageString("Please_Check_New_Password"),
                                BCApplication.getMessageString("INFO"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            Boolean updSuccess = bcApp.SCApplication.UserBLL.updatePassword(bcApp.LoginUserID, passwd);

            if (updSuccess)
            {
                //MessageBox.Show(this, BCApplication.getMessageString("UPDATE_SUCCESS"));
                BCUtility.showMsgBox_Info(this, BCApplication.getMessageString("UPDATE_SUCCESS"));
            }
            else
            {
                //MessageBox.Show(this, BCApplication.getMessageString("UPDATE_FAILED"));
                BCUtility.showMsgBox_Info(this, BCApplication.getMessageString("UPDATE_FAILED"));
            }
        }
Beispiel #22
0
        private void UpdBtn_Click(object sender, EventArgs e)
        {
            if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_USER_MANAGEMENT))
            {
                return;
            }

            string  user_id     = this.UserIDTbx.Text.Trim();
            string  user_name   = this.UserNameTbx.Text.Trim();
            string  passwd      = this.PswdTbx.Text.Trim();
            string  user_grp    = this.userGrpCbx.Text.Trim(); //A0.01
            Boolean isDisable   = this.Disable_Y_RBtn.Checked;
            Boolean isPowerUser = this.Power_Y_RBtn.Checked;

            if (!checkInputDataForUpdate())
            {
                return;
            }

            Boolean updateSuccess =
                bcApp.SCApplication.UserBLL.updateUser(user_id, user_name, passwd, isDisable, user_grp, null, null);  //A0.01

            //A0.01     bcApp.SCApplication.UserBLL.updateUser(user_id, user_name, passwd, isDisable, isPowerUser);

            if (updateSuccess)
            {
                //MessageBox.Show(this, BCApplication.getMessageString("UPDATE_SUCCESS"));
                BCUtility.showMsgBox_Info(this, BCApplication.getMessageString("UPDATE_SUCCESS"));
                Refresh();
            }
            else
            {
                //MessageBox.Show(this, BCApplication.getMessageString("UPDATE_FAILED"));
                BCUtility.showMsgBox_Info(this, BCApplication.getMessageString("UPDATE_FAILED"));
            }
        }