Esempio n. 1
0
        private void CheckCompanyInfo()
        {
            try
            {
                string BranchCode = inif.Read("BranchCode", "CompanyDetails");

                if (string.IsNullOrEmpty(BranchCode))
                {
                    Error2Close = true;
                    MessageBox.Show("Error: BranchCode not found \n(Please check your settings).", "BranchCode is Invalid", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Application.Exit();
                }
                else
                {
                    List <CompanyInfo> Ci = null;
                    if (cf.CheckCompanyInfo(BranchCode, tssTransaction.Text, ref Ci))
                    {
                        inif.Write("CompanyName", Ci[0].CompanyName, "CompanyDetails");
                        inif.Write("BranchCode", Ci[0].BranchCode, "CompanyDetails");
                        inif.Write("Address1", Ci[0].Address1, "CompanyDetails");
                        inif.Write("Address2", Ci[0].Address2, "CompanyDetails");
                        inif.Write("Address3", Ci[0].Address3, "CompanyDetails");
                        inif.Write("ContactNumber", Ci[0].ContactNumber, "CompanyDetails");
                        inif.Write("TIN", Ci[0].TIN, "CompanyDetails");
                    }
                    else
                    {
                        if (!isOnline && !isStandAlone)
                        {
                            Error2Close = true;
                            MessageBox.Show("Warning: System is OFFLINE. Please set it to Stand-alone.", "Stand-Alone :" + isStandAlone.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Application.Exit();
                        }
                        else if (!isStandAlone)
                        {
                            Error2Close = true;
                            MessageBox.Show("Error: BranchCode not found \n(Please check your settings).", "BranchCode is Invalid :" + BranchCode, MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Application.Exit();
                        }
                    }
                }
            }catch
            {
            }
        }