Exemple #1
0
        public bool Save()
        {
            try
            {
                XElement root = new XElement(RootName);

                // Настройки
                XElement xSettings = new XElement("Settings");

                xSettings.Add(new XElement("Server", Server));
                xSettings.Add(new XElement("Database", Database));
                xSettings.Add(new XElement("UserID", UserID));
                xSettings.Add(new XElement("Password", Password));

                if (xSettings.HasElements)
                {
                    root.Add(xSettings);
                }

                if (!File.Exists(Globals.GetPath(PathEnum.Bin) + "\\" + FileName))
                {
                    Directory.CreateDirectory(Globals.GetPath(PathEnum.Bin));
                    FileStream fs = File.Create(Globals.GetPath(PathEnum.Bin) + "\\" + FileName);
                    fs.Close();
                }
                root.Save(Globals.GetPath(PathEnum.Bin) + "\\" + FileName);
                return(true);
            }
            catch (Exception e)
            {
            }
            return(false);
        }
        public bool Load()
        {
            try
            {
                string fileName = Globals.GetPath(PathEnum.Bin) + "\\" + FileName;
                if (File.Exists(fileName))
                {
                    XElement root = XElement.Load(fileName);
                    if (root.Name != RootName)
                    {
                        return(false);
                    }

                    XElement xElement;

                    // Настройки драйверов
                    XElement xSettings = root.Element("Settings");

                    if (xSettings != null)
                    {
                        if ((xElement = xSettings.Element("firmsname")) != null)
                        {
                            Settings.firmsname = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("secondfirmsname")) != null)
                        {
                            Settings.secondfirmsname = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("PreviouslyService")) != null)
                        {
                            Settings.PreviouslyService = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("advert1")) != null)
                        {
                            Settings.advert1 = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("advert2")) != null)
                        {
                            Settings.advert2 = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("advert3")) != null)
                        {
                            Settings.advert3 = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("advert4")) != null)
                        {
                            Settings.advert4 = xElement.Value;
                        }
                    }

                    return(true);
                }
            }
            catch
            {
            }
            return(false);
        }
        public void LoadPictureBox(PictureBox pbx, string path)
        {
            string fname = Globals.GetPath(PathEnum.Image) + "\\" + path;

            if (!File.Exists(fname))
            {
                fname = Globals.GetPath(PathEnum.Image) + "\\" + defpicture;
            }
            try
            {
                pbx.Load(fname);
            }
            catch (Exception e)
            {
            }
        }
Exemple #4
0
        public bool Load()
        {
            try
            {
                string fileName = Globals.GetPath(PathEnum.Bin) + "\\" + FileName;
                if (File.Exists(fileName))
                {
                    XElement root = XElement.Load(fileName);
                    if (root.Name != RootName)
                    {
                        return(false);
                    }

                    XElement xElement;

                    // Настройки драйверов
                    XElement xSettings = root.Element("Settings");

                    if (xSettings != null)
                    {
                        if ((xElement = xSettings.Element("Server")) != null)
                        {
                            Server = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("Database")) != null)
                        {
                            Database = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("UserID")) != null)
                        {
                            UserID = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("Password")) != null)
                        {
                            Password = xElement.Value;
                        }
                    }

                    return(true);
                }
            }
            catch
            {
            }
            return(false);
        }
Exemple #5
0
        public bool Save()
        {
            try
            {
                return(false);

                XElement root = new XElement(RootName);

                // Настройки
                XElement xSettings = new XElement("Settings");

/*                xSettings.Add(new XElement("RetToMain", Settings.ButtonRetToMain));
 *              xSettings.Add(new XElement("ButtonFail", Settings.ButtonFail));
 *              xSettings.Add(new XElement("ButtonYes", Settings.ButtonYes));
 *              xSettings.Add(new XElement("ButtonUser", Settings.ButtonUser));
 *              xSettings.Add(new XElement("ButtonCheck", Settings.ButtonCheck));
 *              xSettings.Add(new XElement("ButtonMoney", Settings.ButtonMoney));
 *              xSettings.Add(new XElement("ButtonService", Settings.ButtonService));
 *              xSettings.Add(new XElement("ButtonServiceEmpty", Settings.ButtonServiceEmpty));
 *              xSettings.Add(new XElement("ButtonBack", Settings.ButtonBack));
 *              xSettings.Add(new XElement("ButtonForward", Settings.ButtonForward));
 *              xSettings.Add(new XElement("ButtonNoForward", Settings.ButtonNoForward));
 *              xSettings.Add(new XElement("ButtonEnterUserName", Settings.ButtonEnterUserName));
 *              xSettings.Add(new XElement("ButtonEnterUserPasw", Settings.ButtonEnterUserPasw));
 */

                if (xSettings.HasElements)
                {
                    root.Add(xSettings);
                }

                if (!File.Exists(Globals.GetPath(PathEnum.Bin) + "\\" + FileName))
                {
                    Directory.CreateDirectory(Globals.GetPath(PathEnum.Bin));
                    FileStream fs = File.Create(Globals.GetPath(PathEnum.Bin) + "\\" + FileName);
                    fs.Close();
                }
                root.Save(Globals.GetPath(PathEnum.Bin) + "\\" + FileName);
                return(true);
            }
            catch (Exception e)
            {
            }
            return(false);
        }
Exemple #6
0
        void Worker_Work(object sender, ThreadWorkEventArgs e)
        {
            while (!e.Cancel)
            {
                try
                {
                    DeleteOldFiles(Globals.GetPath(PathEnum.Logs), "*." + Globals.LogExtention, 30, SearchOption.TopDirectoryOnly);
                }
                catch
                {
                }

                // Период - 10 минут
                if (!e.Cancel)
                {
                    SaleThread.Sleep(600000);
                }
            }
        }
        public bool Save()
        {
            try
            {
                XElement root = new XElement(RootName);

                // Настройки
                XElement xSettings = new XElement("Settings");

                xSettings.Add(new XElement("firmsname", Settings.firmsname));
                xSettings.Add(new XElement("secondfirmsname", Settings.secondfirmsname));
                xSettings.Add(new XElement("PreviouslyService", Settings.PreviouslyService));
                xSettings.Add(new XElement("advert1", Settings.advert1));
                xSettings.Add(new XElement("advert2", Settings.advert2));
                xSettings.Add(new XElement("advert3", Settings.advert3));
                xSettings.Add(new XElement("advert4", Settings.advert4));

                if (xSettings.HasElements)
                {
                    root.Add(xSettings);
                }

                if (!File.Exists(Globals.GetPath(PathEnum.Bin) + "\\" + FileName))
                {
                    Directory.CreateDirectory(Globals.GetPath(PathEnum.Bin));
                    FileStream fs = File.Create(Globals.GetPath(PathEnum.Bin) + "\\" + FileName);
                    fs.Close();
                }
                root.Save(Globals.GetPath(PathEnum.Bin) + "\\" + FileName);
                return(true);
            }
            catch (Exception e)
            {
            }
            return(false);
        }
Exemple #8
0
        public bool Load()
        {
            try
            {
                string fileName = Globals.GetPath(PathEnum.Bin) + "\\" + FileName;
                if (File.Exists(fileName))
                {
                    XElement root = XElement.Load(fileName);
                    if (root.Name != RootName)
                    {
                        return(false);
                    }

                    XElement xElement;

                    // Настройки драйверов
                    XElement xSettings = root.Element("ImageNames");

                    if (xSettings != null)
                    {
                        if ((xElement = xSettings.Element("PanelBackGround")) != null)
                        {
                            Settings.PanelBackGround = xElement.Value;
                        }

                        if ((xElement = xSettings.Element("ButtonStartServices")) != null)
                        {
                            Settings.ButtonStartServices = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonHelp")) != null)
                        {
                            Settings.ButtonHelp = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonPhilosof")) != null)
                        {
                            Settings.ButtonPhilosof = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonInter")) != null)
                        {
                            Settings.ButtonInter = xElement.Value;
                        }

                        if ((xElement = xSettings.Element("ButtonService")) != null)
                        {
                            Settings.ButtonService = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonService1")) != null)
                        {
                            Settings.ButtonService1 = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonService2")) != null)
                        {
                            Settings.ButtonService2 = xElement.Value;
                        }

                        if ((xElement = xSettings.Element("ButtonService1_style1")) != null)
                        {
                            Settings.ButtonService1_style1 = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonService2_style1")) != null)
                        {
                            Settings.ButtonService2_style1 = xElement.Value;
                        }

                        if ((xElement = xSettings.Element("ButtonRetToMain")) != null)
                        {
                            Settings.ButtonRetToMain = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonWhatsDiff")) != null)
                        {
                            Settings.ButtonWhatsDiff = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("LogoService1")) != null)
                        {
                            Settings.LogoService1 = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("LogoService2")) != null)
                        {
                            Settings.LogoService2 = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("LogoService_style1")) != null)
                        {
                            Settings.LogoService_style1 = xElement.Value;
                        }

                        if ((xElement = xSettings.Element("ButtonGetOxigen")) != null)
                        {
                            Settings.ButtonGetOxigen = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonGetOxigen_style1")) != null)
                        {
                            Settings.ButtonGetOxigen_style1 = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonTakeAwayMoney")) != null)
                        {
                            Settings.ButtonTakeAwayMoney = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonreturnMoney")) != null)
                        {
                            Settings.ButtonreturnMoney = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonOK")) != null)
                        {
                            Settings.ButtonOK = xElement.Value;
                        }

                        if ((xElement = xSettings.Element("ButtonLogo")) != null)
                        {
                            Settings.ButtonLogo = xElement.Value;
                        }

                        if ((xElement = xSettings.Element("ButtonFail")) != null)
                        {
                            Settings.ButtonFail = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonYes")) != null)
                        {
                            Settings.ButtonYes = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonUser")) != null)
                        {
                            Settings.ButtonUser = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonCheck")) != null)
                        {
                            Settings.ButtonCheck = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonMoney")) != null)
                        {
                            Settings.ButtonMoney = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonMoneyToCheck")) != null)
                        {
                            Settings.ButtonMoneyToCheck = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonMoneyToAccount")) != null)
                        {
                            Settings.ButtonMoneyToAccount = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonServiceEmpty")) != null)
                        {
                            Settings.ButtonServiceEmpty = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonBack")) != null)
                        {
                            Settings.ButtonBack = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonForward")) != null)
                        {
                            Settings.ButtonForward = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonNoForward")) != null)
                        {
                            Settings.ButtonNoForward = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonEnterUserName")) != null)
                        {
                            Settings.ButtonEnterUserName = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonEnterUserPasw")) != null)
                        {
                            Settings.ButtonEnterUserPasw = xElement.Value;
                        }

                        if ((xElement = xSettings.Element("ButtonRegister")) != null)
                        {
                            Settings.ButtonRegister = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ButtonRemember")) != null)
                        {
                            Settings.ButtonRemember = xElement.Value;
                        }

                        if ((xElement = xSettings.Element("ScreenSaver")) != null)
                        {
                            Settings.ScreenSaver = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("ScreenSaverVideo")) != null)
                        {
                            Settings.ScreenSaverVideo = xElement.Value;
                        }
                    }

                    return(true);
                }
            }
            catch
            {
            }
            return(false);
        }
Exemple #9
0
 public Log()
 {
     Init(Globals.GetPath(PathEnum.Logs), Globals.GetProcessFileName(false), null);
 }
Exemple #10
0
        public bool Load()
        {
            try
            {
                string fileName = Globals.GetPath(PathEnum.Bin) + "\\" + FileName;
                if (File.Exists(fileName))
                {
                    XElement root = XElement.Load(fileName);
                    if (root.Name != RootName)
                    {
                        return(false);
                    }

                    XElement xElement;

                    // Настройки драйверов
                    XElement xSettings = root.Element("Settings");

                    if (xSettings != null)
                    {
                        if ((xElement = xSettings.Element("comPortScanner")) != null)
                        {
                            Settings.comPortScanner = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("adressBill")) != null)
                        {
                            Settings.adressBill = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("comPortBill")) != null)
                        {
                            Settings.comPortBill = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("comPortPrinter")) != null)
                        {
                            Settings.comPortPrinter = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("NamePrinter")) != null)
                        {
                            Settings.NamePrinter = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("comPortControl")) != null)
                        {
                            Settings.comPortControl = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("comPortModem")) != null)
                        {
                            Settings.comPortModem = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("comPortControlSpeed")) != null)
                        {
                            Settings.comPortControlSpeed = int.Parse(xElement.Value);
                        }
                        if ((xElement = xSettings.Element("comPortModemSpeed")) != null)
                        {
                            Settings.comPortModemSpeed = int.Parse(xElement.Value);
                        }

                        if ((xElement = xSettings.Element("numberTelephoneSMS")) != null)
                        {
                            Settings.numberTelephoneSMS = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("SMSMessageTimeEnd")) != null)
                        {
                            Settings.SMSMessageTimeEnd = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("SMSMessageNeedCollect")) != null)
                        {
                            Settings.SMSMessageNeedCollect = xElement.Value;
                        }

                        if ((xElement = xSettings.Element("TextStartService")) != null)
                        {
                            Settings.TextStartService = xElement.Value;
                        }
                        if ((xElement = xSettings.Element("TextEndService")) != null)
                        {
                            Settings.TextEndService = xElement.Value;
                        }

                        if ((xElement = xSettings.Element("offHardware")) != null)
                        {
                            Settings.offHardware = int.Parse(xElement.Value);
                        }
                        if ((xElement = xSettings.Element("offCheck")) != null)
                        {
                            Settings.offCheck = int.Parse(xElement.Value);
                        }
                        if ((xElement = xSettings.Element("offDataBase")) != null)
                        {
                            Settings.offDataBase = int.Parse(xElement.Value);
                        }
                        if ((xElement = xSettings.Element("offBill")) != null)
                        {
                            Settings.offBill = int.Parse(xElement.Value);
                        }
                        if ((xElement = xSettings.Element("offControl")) != null)
                        {
                            Settings.offControl = int.Parse(xElement.Value);
                        }
                        if ((xElement = xSettings.Element("offModem")) != null)
                        {
                            Settings.offModem = int.Parse(xElement.Value);
                        }

                        if ((xElement = xSettings.Element("NoPaperWork")) != null)
                        {
                            Settings.NoPaperWork = int.Parse(xElement.Value);
                        }

                        if ((xElement = xSettings.Element("changeOn")) != null)
                        {
                            Settings.changeOn = int.Parse(xElement.Value);
                        }
                        if ((xElement = xSettings.Element("timeout")) != null)
                        {
                            Settings.timeout = int.Parse(xElement.Value);
                        }

                        if ((xElement = xSettings.Element("changeToAccount")) != null)
                        {
                            Settings.changeToAccount = int.Parse(xElement.Value);
                        }
                        if ((xElement = xSettings.Element("changeToCheck")) != null)
                        {
                            Settings.changeToCheck = int.Parse(xElement.Value);
                        }

                        if ((xElement = xSettings.Element("MaxCountBankNote")) != null)
                        {
                            Settings.MaxCountBankNote = int.Parse(xElement.Value);
                        }
                        if ((xElement = xSettings.Element("limitServiceTime")) != null)
                        {
                            Settings.limitServiceTime = int.Parse(xElement.Value);
                        }

                        if ((xElement = xSettings.Element("style")) != null)
                        {
                            Settings.style = int.Parse(xElement.Value);
                        }
                        if ((xElement = xSettings.Element("ScreenServerType")) != null)
                        {
                            Settings.ScreenServerType = int.Parse(xElement.Value);
                        }

                        if ((xElement = xSettings.Element("nominals")) != null)
                        {
                            Settings.nominals = new int[24];
                            int i = 0;
                            foreach (XElement xItem in xElement.Elements("nominal"))
                            {
                                int tmp = int.Parse(xItem.Value);
                                Settings.nominals[i++] = tmp;
                            }
                        }

                        // настройки сервисов
                        if ((xElement = xSettings.Element("services")) != null)
                        {
                            Settings.services = new List <Service>();
                            int i = 1;
                            foreach (XElement xItem in xElement.Elements("Service"))
                            {
                                Service tmp = Service.FromXml(xItem);
                                if (tmp.id == 0)
                                {
                                    tmp.id = i;
                                }
                                Settings.services.Add(tmp);
                                i++;
                            }
                        }
                    }

                    return(true);
                }
            }
            catch (Exception e)
            {
                Debug.Print(e.Message);
            }
            return(false);
        }
Exemple #11
0
        public bool Save()
        {
            try
            {
                XElement root = new XElement(RootName);

                // Настройки
                XElement xSettings = new XElement("Settings");

                xSettings.Add(new XElement("comPortScanner", Settings.comPortScanner));
                xSettings.Add(new XElement("comPortBill", Settings.comPortBill));
                xSettings.Add(new XElement("adressBill", Settings.adressBill));
                xSettings.Add(new XElement("comPortPrinter", Settings.comPortPrinter));
                xSettings.Add(new XElement("NamePrinter", Settings.NamePrinter));
                xSettings.Add(new XElement("comPortControl", Settings.comPortControl));
                xSettings.Add(new XElement("comPortModem", Settings.comPortModem));
                xSettings.Add(new XElement("comPortControlSpeed", Settings.comPortControlSpeed.ToString()));
                xSettings.Add(new XElement("comPortModemSpeed", Settings.comPortModemSpeed.ToString()));

                xSettings.Add(new XElement("numberTelephoneSMS", Settings.numberTelephoneSMS));
                xSettings.Add(new XElement("SMSMessageTimeEnd", Settings.SMSMessageTimeEnd));
                xSettings.Add(new XElement("SMSMessageNeedCollect", Settings.SMSMessageNeedCollect));

                xSettings.Add(new XElement("TextStartService", Settings.TextStartService));
                xSettings.Add(new XElement("TextEndService", Settings.TextEndService));

                xSettings.Add(new XElement("offHardware", Settings.offHardware.ToString()));
                xSettings.Add(new XElement("offCheck", Settings.offCheck.ToString()));
                xSettings.Add(new XElement("offDataBase", Settings.offDataBase.ToString()));
                xSettings.Add(new XElement("offBill", Settings.offBill.ToString()));
                xSettings.Add(new XElement("offControl", Settings.offControl.ToString()));
                xSettings.Add(new XElement("offModem", Settings.offModem.ToString()));

                xSettings.Add(new XElement("NoPaperWork", Settings.NoPaperWork.ToString()));

                xSettings.Add(new XElement("changeOn", Settings.changeOn.ToString()));
                xSettings.Add(new XElement("timeout", Settings.timeout.ToString()));

                xSettings.Add(new XElement("changeToAccount", Settings.changeToAccount.ToString()));
                xSettings.Add(new XElement("changeToCheck", Settings.changeToCheck.ToString()));

                xSettings.Add(new XElement("MaxCountBankNote", Settings.MaxCountBankNote.ToString()));
                xSettings.Add(new XElement("limitServiceTime", Settings.limitServiceTime.ToString()));

                xSettings.Add(new XElement("style", Settings.style.ToString()));
                xSettings.Add(new XElement("ScreenServerType", Settings.ScreenServerType.ToString()));

                XElement element = new XElement("nominals");
                foreach (int nominal in Settings.nominals)
                {
                    XElement newservice = new XElement("nominal", nominal.ToString());
                    element.Add(newservice);
                }
                xSettings.Add(element);

                if (Settings.services.Count > 0)
                {
                    XElement services = new XElement("services");
                    foreach (Service service in Settings.services)
                    {
                        XElement newservice = service.ToXml();
                        services.Add(newservice);
                    }
                    xSettings.Add(services);
                }

                if (xSettings.HasElements)
                {
                    root.Add(xSettings);
                }

                if (!File.Exists(Globals.GetPath(PathEnum.Bin) + "\\" + FileName))
                {
                    Directory.CreateDirectory(Globals.GetPath(PathEnum.Bin));
                    FileStream fs = File.Create(Globals.GetPath(PathEnum.Bin) + "\\" + FileName);
                    fs.Close();
                }
                root.Save(Globals.GetPath(PathEnum.Bin) + "\\" + FileName);
                return(true);
            }
            catch (Exception e)
            {
            }
            return(false);
        }