Ejemplo n.º 1
0
        private void Btn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                actManagerLoggerView.Text = "开始执行...";
                Logger.RestLogger();
                Logger.HookLogger(logCallback);

                string btnName             = (sender as Button).Name;
                FormAccountUserPopup popup = new FormAccountUserPopup();
                popup.FinanceMsgEvent = (msgType, paras) => {
                    bool bRet = false;
                    try
                    {
                        int iRet = CommondHandler.Process("usr." + btnName + " "
                                                          + paras["no"] + " "
                                                          + paras["name"] + " "
                                                          + paras["pwd1"] + " "
                                                          + paras["pwd2"] + " "
                                                          + "-f");
                        if (0 == iRet)
                        {
                            UserControl_Loaded(null, null);
                            bRet = true;
                        }
                    }
                    catch (Exception fex)
                    {
                        logCallback(LogLevel.LevError, fex.Message);
                    }
                    finally
                    {
                        Logger.RestLogger();
                    }
                    return(bRet);
                };
                popup.ShowDialog();
            }
            catch (Exception ex)
            {
                logCallback(LogLevel.LevError, ex.Message);
            }
            finally
            {
                Logger.RestLogger();
            }
        }
Ejemplo n.º 2
0
        private void operate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                actManagerLoggerView.Text = "开始执行...";
                Logger.RestLogger();
                Logger.HookLogger(logCallback);

                MenuItem menuItem = sender as MenuItem;
                TextBox  txtNo    = grid.FindName("txtNo_" + m_FocusRowIndex) as TextBox;
                string   usrNo    = txtNo.Text;
                if (menuItem.Name == "delete")
                {
                    CommondHandler.Process("usr." + menuItem.Name + " " + usrNo + " -f");
                    UserControl_Loaded(null, null);
                }
                else
                {
                    TextBox txtName            = grid.FindName("txtName_" + m_FocusRowIndex) as TextBox;
                    string  usrName            = txtName.Text;
                    FormAccountUserPopup popup = new FormAccountUserPopup();
                    popup.xNo                  = usrNo;
                    popup.xName                = usrName;
                    popup.txtBoxNo.Text        = usrNo;
                    popup.txtBoxName.Text      = usrName;
                    popup.txtBoxNo.IsEnabled   = false;
                    popup.txtBoxName.IsEnabled = false;
                    popup.FinanceMsgEvent      = (msgType, paras) => {
                        bool bRet = false;
                        try
                        {
                            int iRet = CommondHandler.Process("usr." + menuItem.Name + " "
                                                              + paras["no"] + " "
                                                              + paras["pwd1"] + " "
                                                              + paras["pwd2"] + " "
                                                              + "-f");
                            if (0 == iRet)
                            {
                                UserControl_Loaded(null, null);
                                bRet = true;
                            }
                        }
                        catch (Exception fex)
                        {
                            logCallback(LogLevel.LevError, fex.Message);
                        }
                        finally
                        {
                            Logger.RestLogger();
                        }
                        return(bRet);
                    };
                    popup.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                logCallback(LogLevel.LevError, ex.Message);
            }
            finally
            {
                Logger.RestLogger();
            }
        }