예제 #1
0
        private void MN_FIRMA_DEGISTIR_Click(object sender, EventArgs e)
        {
            DialogResult c = MessageBox.Show("Faturayı farklı bir firmaya aktrmak istediğinize eminmisiniz.", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (c == DialogResult.Yes)
            {
                string OLD_FIRMA = _GLOBAL_PARAMETERS._SIRKET_KODU.ToString();
                LOGIN  frm       = new LOGIN();
                frm.ShowDialog();

                if (frm.BTN_SELECT != "VAZGEC")
                {
                    FIRMAYA_AKTAR(OLD_FIRMA, _GLOBAL_PARAMETERS._SIRKET_KODU.ToString());
                    BTM_FIRMA_ID.Caption   = _GLOBAL_PARAMETERS._SIRKET_NO;
                    BTM_FIRMA_NAME.Caption = _GLOBAL_PARAMETERS._SIRKET_ADI;
                    BTM_FIRMA_KODU.Caption = _GLOBAL_PARAMETERS._SIRKET_KODU;
                    for (int i = this.MdiChildren.Length - 1; 0 <= i; i--)
                    {
                        this.MdiChildren[i].Close();
                    }

                    //int a=((Form)this.MdiParent).Controls["ribbonControl"].Controls.Count;
                    //Masters.BTM_USER_NAME.Caption = Masters._username;
                    //((Masters)this.Owner).Controls["BTM_FIRMA_KODU"].Text = Masters._username;
                    //((Masters)this.Owner).BTM_FIRMA_KODU.Caption = Masters._firmNo;
                    //((Masters)this.Owner).BTM_FIRMA_NAME.Caption = Masters._firName;
                    //this.Show();
                    //Masters._CONTROL.Controls.Clear();
                    //Sales.Inbox Inbx = new Sales.Inbox();
                    //Inbx.Dock = DockStyle.Fill;
                    //Inbx.Text = " Purchase / Inbox ( Satınalma ) - " + 10;
                    //Masters._CONTROL.Controls.Add(Inbx);
                    //Inbx.Show();
                    //BTM_USER_NAME.Caption = Masters._username;
                    //BTM_FIRMA_KODU.Caption = Masters._firmNo;
                    //BTM_FIRMA_NAME.Caption = Masters._firName;
                }
                BR_SELECT_ROW_FATURA_NO.Caption = "";
                DATA_LOAD_BEKLEMEDE();
                STLINE("0", "00000000-0000-0000-0000-000000000000", "0");
            }
        }
예제 #2
0
        void StartupMain(object sender, StartupEventArgs e)
        {
            try
            {
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                this.DispatcherUnhandledException          += App_DispatcherUnhandledException;

                //自分自身のAssemblyを取得
                System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
                System.Version             ver = asm.GetName().Version;;

                this.ShutdownMode = ShutdownMode.OnExplicitShutdown;

                bool IsNeedLicenseCheck = true;
                var  plist = (NameValueCollection)ConfigurationManager.GetSection("serviceSettings");
                if (plist != null)
                {
                    if (plist["mode"] == CommonConst.WithoutLicenceDBMode)
                    {
                        IsNeedLicenseCheck = false;
                    }
                }
                while (true)
                {
                    AppCommonData appcmn = null;
                    if (IsNeedLicenseCheck)
                    {
                        // ログインできたら今までと同様スタートアップ画面を表示する。
                        LicenseLogin licLogin = new LicenseLogin();
                        this.applog = licLogin.appLog;
                        licLogin.viewsCommData.WithLicenseDB = true;
                        licLogin.viewsCommData.AppData       = new AppCommonData();
                        licLogin.ShowDialog();
                        if (licLogin.IsLoginCompleted)
                        {
                            appcmn = new AppCommonData()
                            {
                                CommonDB_CustomerCd         = (licLogin.viewsCommData.AppData as AppCommonData).CommonDB_CustomerCd,
                                UserDB_DBId                 = (licLogin.viewsCommData.AppData as AppCommonData).UserDB_DBId,
                                UserDB_DBName               = (licLogin.viewsCommData.AppData as AppCommonData).UserDB_DBName,
                                UserDB_DBPass               = (licLogin.viewsCommData.AppData as AppCommonData).UserDB_DBPass,
                                UserDB_DBServer             = (licLogin.viewsCommData.AppData as AppCommonData).UserDB_DBServer,
                                CommonDB_LastAccessDateTime = (licLogin.viewsCommData.AppData as AppCommonData).CommonDB_LastAccessDateTime,
                                CommonDB_LimitDate          = (licLogin.viewsCommData.AppData as AppCommonData).CommonDB_LimitDate,
                                CommonDB_LoginFlg           = (licLogin.viewsCommData.AppData as AppCommonData).CommonDB_LoginFlg,
                                CommonDB_RegDate            = (licLogin.viewsCommData.AppData as AppCommonData).CommonDB_RegDate,
                                CommonDB_StartDate          = (licLogin.viewsCommData.AppData as AppCommonData).CommonDB_StartDate,
                                CommonDB_UserId             = (licLogin.viewsCommData.AppData as AppCommonData).CommonDB_UserId,
                            };
                        }
                        else
                        {
                            Application.Current.Shutdown(0);
                        }
                    }
                    else
                    {
                        SqlConnectionStringBuilder sqlBuilder = new SqlConnectionStringBuilder();
                        sqlBuilder = AppCommon.MakeSqlConnectString();
                        if (sqlBuilder == null)
                        {
                            // 接続文字列が設定されていない場合
                            DBSetup dbform = new DBSetup();
                            if (dbform.ShowDialog() == true)
                            {
                                sqlBuilder = dbform.sqlBuilder;
                            }
                            else
                            {
                                Environment.Exit(0);
                                return;
                            }
                        }
                        appcmn = new AppCommonData()
                        {
                            UserDB_DBServer = Utility.Encrypt(sqlBuilder.DataSource),
                            UserDB_DBName   = Utility.Encrypt(sqlBuilder.InitialCatalog),
                            UserDB_DBId     = Utility.Encrypt(sqlBuilder.UserID),
                            UserDB_DBPass   = Utility.Encrypt(sqlBuilder.Password),
                        };
                    }
                    {
                        LOGIN login = new LOGIN();
                        this.applog = login.appLog;
                        login.viewsCommData.WithLicenseDB = IsNeedLicenseCheck;
                        login.viewsCommData.AppData       = appcmn;
                        login.SetupConnectStringuserDB(appcmn.UserDB_DBServer, appcmn.UserDB_DBName, appcmn.UserDB_DBId, appcmn.UserDB_DBPass);
                        login.appLog.Info("START Ver.{0}", ver);

                        StartupWindow start = new StartupWindow();
                        start.viewsCommData.WithLicenseDB = IsNeedLicenseCheck;
                        start.viewsCommData = login.viewsCommData;
                        start.ConnString    = login.ConnString;
                        // スタートアップ画面起動
                        start.ShowDialog();
                        login.viewsCommData = start.viewsCommData;

                        if (start.IsConnected)
                        {
                            // ログイン画面起動
                            login.ShowDialog();
                            if (login.IsLoggedIn)
                            {
                                WindowControler menu = new WindowControler();
                                this.applog  = menu.appLog;
                                menu.Closed += menu_Closed;
                                menu.viewsCommData.WithLicenseDB = IsNeedLicenseCheck;
                                //menu.Topmost = true;
                                menu.Show(login);
                                //menu.Topmost = false;
                            }
                            else
                            {
                                if (login.IsReload)
                                {
                                    continue;
                                }
                            }
                        }
                        else
                        {
                            login.Close();
                            if (start.IsReload)
                            {
                                continue;
                            }
                        }
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                if (this.applog != null)
                {
                    applog.Error("画面で取得できなかった例外発生", ex);
                }
                MessageBox.Show(string.Format("例外が発生しました。\r\nエラーメッセージ:{0}", ex.Message), "例外発生");
                //Environment.Exit(1);
            }
        }