Ejemplo n.º 1
0
        public MainFR()
        {
            //For Testing DB BUILD
            Properties.Settings.Default.DBTabelsBuilded = false;
            Properties.Settings.Default.Save();

            Program.SaveDocumentsPDF = Properties.Settings.Default.SaveToPDF;

            Opacity = 0;                            //first the opacity is 0

            t1.Interval = 10;                       //we'll increase the opacity every 10ms
            t1.Tick    += new EventHandler(fadeIn); //this calls the function that changes opacity
            t1.Start();
            ///

            InitializeComponent();
            // 1 - admin
            // 2 - superuser
            if (WorkingUser.AdminRights.ToString().Contains("1"))
            {
                this.linkLabel1.Enabled  = true;
                this.linkLabel2.Enabled  = true;
                this.linkLabel7.Enabled  = true;
                this.linkLabel9.Enabled  = true;
                this.linkLabel11.Enabled = true;
                this.linkLabel14.Enabled = true;
                this.linkLabel15.Enabled = true;
                this.linkLabel16.Enabled = true;
                this.linkLabel20.Enabled = true;
                this.linkLabel23.Enabled = true;
                this.llNarudzbe.Enabled  = true;
            }
            else
            {
                this.linkLabel1.Enabled  = false;
                this.linkLabel2.Enabled  = false;
                this.linkLabel7.Enabled  = false;
                this.linkLabel9.Enabled  = false;
                this.linkLabel11.Enabled = false;
                this.linkLabel14.Enabled = false;
                this.linkLabel15.Enabled = false;
                this.linkLabel16.Enabled = false;
                this.linkLabel20.Enabled = false;
                this.linkLabel23.Enabled = false;
                this.llNarudzbe.Enabled  = false;
            }

            if (WorkingUser.AdminRights.ToString().Contains("2") || WorkingUser.AdminRights.ToString().Contains("1"))
            {
                this.linkLabel9.Enabled  = true;
                this.linkLabel16.Enabled = true;
                this.linkLabel20.Enabled = true;
            }
            else
            {
                this.linkLabel9.Enabled  = false;
                this.linkLabel16.Enabled = false;
                this.linkLabel20.Enabled = false;
            }

            if (Properties.Settings.Default.DBTabelsBuilded)
            {
                linkLabel11.Enabled = false;
            }

            this.label16.Text = DateTime.Now.ToString("dd.MM.yyyy.");

            QueryCommands    qc        = new QueryCommands();
            ConnectionHelper cn        = new ConnectionHelper();
            List <String>    resultArr = new List <string>();

            try
            {
                resultArr         = qc.CurrentExchangeRate();
                this.label15.Text = resultArr[2] + " kn";
                this.label12.Text = resultArr[3] + " kn";
                this.label11.Text = resultArr[4] + " kn";
                this.label35.Text = resultArr[1];

                try
                {
                    resultArr.Clear();
                    resultArr = qc.GetAllRegions();

                    if (resultArr[0] != "nok")
                    {
                        Properties.Settings.Default.Remember          = true;
                        Properties.Settings.Default.ServisIDRegion    = int.Parse(resultArr[0].ToString());
                        Properties.Settings.Default.TransportIDRegion = int.Parse(resultArr[3].ToString());
                        Properties.Settings.Default.OstaliIDRegion    = int.Parse(resultArr[6].ToString());
                        //Properties.Settings.Default.MainCompanyCode = "00";
                        Properties.Settings.Default.Save();
                    }
                }
                catch (Exception ex)
                {
                    new LogWriter(ex);
                    MessageBox.Show(ex.Message);
                }
            }
            catch (Exception e1)
            {
                new LogWriter(e1);
                this.label15.Text = DateTime.Now.ToString("Error");
                this.label12.Text = DateTime.Now.ToString("Error");
                this.label11.Text = DateTime.Now.ToString("Error");
            }

            this.label16.Font = new Font(label16.Font.FontFamily, label16.Font.SizeInPoints, FontStyle.Bold);
            this.label15.Font = new Font(label15.Font.FontFamily, label15.Font.SizeInPoints, FontStyle.Bold);
            this.label12.Font = new Font(label12.Font.FontFamily, label12.Font.SizeInPoints, FontStyle.Bold);
            this.label11.Font = new Font(label11.Font.FontFamily, label11.Font.SizeInPoints, FontStyle.Bold);
            this.label17.Font = new Font(label17.Font.FontFamily, label17.Font.SizeInPoints, FontStyle.Bold);

            adresa.Text   = Properties.Settings.Default.CmpAddress;
            oib.Text      = Properties.Settings.Default.CmpVAT;
            www.Text      = Properties.Settings.Default.CmpWWW;
            tel.Text      = Properties.Settings.Default.CmpPhone;
            infomail.Text = Properties.Settings.Default.CmpEmail;

            //// Jezik ////
            setText();

            CLogo logoImage = new CLogo();

            img = logoImage.GetImage();
            pictureBox3.Image = img;
        }
Ejemplo n.º 2
0
        private void CompanyInfo_Load(object sender, EventArgs e)
        {
            comboBox1.Text    = Properties.Settings.Default.CmpName;
            CmpAddressTB.Text = Properties.Settings.Default.CmpAddress;
            CmpOIBTB.Text     = Properties.Settings.Default.CmpVAT;
            CmpWWWTB.Text     = Properties.Settings.Default.CmpWWW;
            CmpPhoneTB.Text   = Properties.Settings.Default.CmpPhone;
            CmpEmail.Text     = Properties.Settings.Default.CmpEmail;
            SupportEmail.Text = Properties.Settings.Default.SupportEmail;

            CmpIBAN.Text  = Properties.Settings.Default.CmpIBAN;
            CmpSwift.Text = Properties.Settings.Default.CmpSWIFT;
            CmpMB.Text    = Properties.Settings.Default.CmpMB;


            CmpCityTB.Text    = Properties.Settings.Default.CmpCity;
            CmpPBTB.Text      = Properties.Settings.Default.CmpPB;
            CmpContactTB.Text = Properties.Settings.Default.CmpContact;
            CmpKNTB.Text      = Properties.Settings.Default.CmpKN.ToString();
            CmpEURTB.Text     = Properties.Settings.Default.CmpEUR.ToString();
            cmpCode.Text      = Properties.Settings.Default.CmpCode;
            CmpCountryTB.Text = Properties.Settings.Default.CmpCountry;

            LogoSize.Value = Properties.Settings.Default.LogoSize;

            try
            {
                CLogo logoImage = new CLogo();
                img = logoImage.GetImage();
                pictureBox1.Image = img;

                cnt = qc.CountMainCmp();
                if (cnt != 0)
                {
                    label8.Text = "Last Code - " + cnt;
                }
                else
                {
                    label8.Text = "Last Code - " + cnt;
                }

                MainCmp temCmp = new MainCmp();
                cmpList    = temCmp.GetAllMainCmpInfoSortByName();
                regionsArr = qc.GetAllRegions();
                if (cmpList.Count != 0)
                {
                    for (int i = 0; i < temCmp.Count; i++)
                    {
                        this.comboBox1.Items.Add(cmpList[i].Name);
                    }
                }
                regionsArr = qc.GetAllRegions();

                if (regionsArr.Count != 0)
                {
                    for (int i = 0; i < regionsArr.Count; i = i + 3)
                    {
                        if (long.Parse(regionsArr[i]) > 3)
                        {
                            this.comboBox2.Items.Add(regionsArr[i]);
                        }
                    }
                }

                comboBox2.Text = Properties.Settings.Default.CmpRegionID.ToString();

                this.Focus();
            }
            catch (Exception e1)
            {
                Program.LoadStop();
                this.Focus();

                new LogWriter(e1);
            }
            Program.LoadStop();
            this.Focus();
        }