Exemplo n.º 1
0
        //получение строки соединения с базой данных из ini файла
        public static string GetConnectionString()
        {
            string DATABASE_INI = HttpContext.Current.Server.MapPath("~/CR/CR/database.ini");
            string INIT_INI     = HttpContext.Current.Server.MapPath("~/CR/CR/init.ini");

            AMS.Profile.Ini Init = new AMS.Profile.Ini(INIT_INI);
            string          db   = Init.GetValue("DATABASE", "db", "");

            AMS.Profile.Ini database = new AMS.Profile.Ini(DATABASE_INI);
            string          SID      = database.GetValue(db, "SID", "");
            string          USER     = database.GetValue(db, "USERNAME", "");
            string          PASSWORD = database.GetValue(db, "PASSWORD", "");

            string path = "Data Source=" + SID + "; User ID=" + USER + "; Password="******";Unicode=true";

            return(path);
        }
Exemplo n.º 2
0
        private void ReadLogFolderFromINI()
        {
            string iexServer = CmbGateway.Text.Split(' ')[1];

            try
            {
                AMS.Profile.Ini iniFile = new AMS.Profile.Ini("C:\\Program Files\\IEX\\Tests\\TestsINI\\IEX" + iexServer + "\\Environment.ini");
                logFolder = iniFile.GetValue("IEX" + iexServer, "LogDirectory").ToString();
            }
            catch
            {
                MessageBox.Show("Failed to Get Log Folder From IEX_" + iexServer + " Environment.ini", "ERROR");
            }
        }
Exemplo n.º 3
0
 public Document(AMS.Profile.Ini Init, string Path)
 {
     this.Path = Path;
     try
     {
         this.account   = Init.GetValue("ROSTELECOM", "account", this.account);
         this.phone     = Init.GetValue("ROSTELECOM", "phone", this.phone);
         this.inn       = Init.GetValue("ROSTELECOM", "inn", this.inn);
         this.korobka   = Init.GetValue("ROSTELECOM", "korobka", this.korobka);
         this.name      = Init.GetValue("ROSTELECOM", "name", this.name);
         this.typedoc   = Init.GetValue("ROSTELECOM", "typedoc", this.typedoc);
         this.pagecount = Init.GetValue("ROSTELECOM", "pagecount", this.pagecount);
     }
     catch
     {
     }
 }
Exemplo n.º 4
0
        public void IniRead()
        {
            string file = Path + "\\" + account + ".ini";

            if (File.Exists(file))
            {
                AMS.Profile.Ini Init = new AMS.Profile.Ini(file);
                try
                {
                    this.account   = Init.GetValue("ROSTELECOM", "account", this.account);
                    this.phone     = Init.GetValue("ROSTELECOM", "phone", this.phone);
                    this.inn       = Init.GetValue("ROSTELECOM", "inn", this.inn);
                    this.korobka   = Init.GetValue("ROSTELECOM", "korobka", this.korobka);
                    this.name      = Init.GetValue("ROSTELECOM", "name", this.name);
                    this.typedoc   = Init.GetValue("ROSTELECOM", "typedoc", this.typedoc);
                    this.pagecount = Init.GetValue("ROSTELECOM", "pagecount", this.pagecount);
                }
                catch
                {
                }
            }
        }
Exemplo n.º 5
0
        public void ReadIni()
        {
            string     file = Application.StartupPath + "\\" + "AbonentPacket.ini";
            FileStream ini;

            if (!File.Exists(file))
            {
                ini = File.Create(file);
                ini.Dispose();
            }

            AMS.Profile.Ini Init = new AMS.Profile.Ini(file);
            _FolderJpegFiles = Init.GetValue("FOLDERS", "JpegFiles", "");
            _FolderWorkFiles = Init.GetValue("FOLDERS", "WorkFiles", "");
            _UserID          = Init.GetValue("EARCHIVE", "UserID", this._UserID);
            _DepartID        = Init.GetValue("EARCHIVE", "DepartID", this._DepartID);
            _User            = Init.GetValue("EARCHIVE", "FormUser", this._User);
            _Korobka         = Init.GetValue("EARCHIVE", "Korobka", this._Korobka);
        }
Exemplo n.º 6
0
        void IExport.Run()
        {
            try
            {
                this.theLogger.Log("Export:Run");
                AMS.Profile.Ini Ini = new AMS.Profile.Ini(AppDomain.CurrentDomain.BaseDirectory + "AgkExportSettings.ini");
                if (!Ini.HasSection("COMMON"))
                {
                    Ini.SetValue("COMMON", "AgkDataFolder", "C:\\Данные_АГК");
                    Ini.SetValue("COMMON", "CountPrevMonth", "1");
                }

                string strAgkDataFolder = Ini.GetValue("COMMON", "AgkDataFolder", "C:\\Данные_АГК");
                int    countPrevMonth   = Ini.GetValue("COMMON", "CountPrevMonth", 1);

                strAgkDataFolder.TrimEnd(new char[] { '\\' });

                if (!Directory.Exists(strAgkDataFolder))
                {
                    Directory.CreateDirectory(strAgkDataFolder);
                }

                Hydro.HydroServiceClient theHydro = new Hydro.HydroServiceClient("BasicHttpBinding_IHydroService");
                const int TYPE_AGK = 6;
                foreach (var Site in theHydro.GetSiteList(TYPE_AGK))
                {
                    string strSiteFolder = strAgkDataFolder + "\\" + Site.SiteCode.ToString();
                    if (!Directory.Exists(strSiteFolder))
                    {
                        Directory.CreateDirectory(strSiteFolder);
                        theLogger.Log(strSiteFolder);
                    }

                    strSiteFolder = strSiteFolder + "\\уровни";
                    if (!Directory.Exists(strSiteFolder))
                    {
                        Directory.CreateDirectory(strSiteFolder);
                        theLogger.Log(strSiteFolder);
                    }
                    DateTime bgnDate = new DateTime(DateTime.Now.AddMonths(-countPrevMonth).Year,
                                                    DateTime.Now.AddMonths(-countPrevMonth).Month, countPrevMonth);
                    DateTime endDate = new DateTime(DateTime.Now.AddMonths(-countPrevMonth).Year,
                                                    DateTime.Now.AddMonths(-countPrevMonth).Month,
                                                    DateTime.DaysInMonth(DateTime.Now.AddMonths(-countPrevMonth).Year, DateTime.Now.AddMonths(-countPrevMonth).Month));
                    const int WATER_LEVEL = 2;

                    string strFileName = strSiteFolder + "\\" + Site.SiteCode.ToString() + "_" + bgnDate.ToString("yyyy_MM") + ".asc";
                    theLogger.Log(strFileName);
                    var fileHandle    = File.CreateText(strFileName);
                    var DataValueList = theHydro.GetDataValues(Site.SiteId, bgnDate, endDate, WATER_LEVEL, null, null, null);
                    if (DataValueList != null)
                    {
                        foreach (var item in DataValueList)
                        {
                            string line = item.Date.ToString("dd.MM.yyyy hh:mm:ss") + "\t" + item.Value.ToString() + "\tсм";
                            fileHandle.WriteLine(line);
                        }
                    }
                    fileHandle.Close();
                    //for (DateTime currDate = bgnDate; currDate <= endDate; currDate.AddDays(1))
                    //{
                    //    var DataValueList = theHydro.GetDataValues(Site.SiteId, TYPE_AGK, currDate, WATER_LEVEL, null, null);
                    //    foreach (var item in DataValueList)
                    //    {

                    //    }
                    //}
                }


                this.theLogger.Log(strAgkDataFolder);
            }
            catch (Exception ex)
            {
                this.theLogger.Error(ex.Message);
                this.theLogger.Error(ex.Source);
                this.theLogger.Error(ex.StackTrace);
            }
        }
Exemplo n.º 7
0
        public ActionResult Telephone(string telephone)
        {
            try
            {
                AMS.Profile.Ini Ini = new AMS.Profile.Ini(AppDomain.CurrentDomain.BaseDirectory + "\\Callback.ini");
                if (!Ini.HasSection("SMSC"))
                {
                    Ini.SetValue("SMSC", "login", "mgerasim");
                    Ini.SetValue("SMSC", "psw", "zaq12wsx");
                }


                string login = Ini.GetValue("SMSC", "login", "some-login");
                string psw   = Ini.GetValue("SMSC", "psw", "some-password");

                string code = this.RandomString(4);
                string url  = "http://smsc.ru/sys/send.php?login="******"&psw=" + psw + "&phones=" + telephone + "&mes=" + code;

                var request = (HttpWebRequest)WebRequest.Create(url);

                var response = (HttpWebResponse)request.GetResponse();

                var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();


                var serializer = new JavaScriptSerializer();

                // For simplicity just use Int32's max value.
                // You could always read the value from the config section mentioned above.
                serializer.MaxJsonLength = Int32.MaxValue;

                CallbackAspDotNetMvc.Models.User theUser = null;
                theUser = Models.User.GetByPhone(telephone);
                if (theUser == null)
                {
                    theUser           = new Models.User();
                    theUser.code      = code;
                    theUser.telephone = telephone;
                    theUser.result    = responseString;
                    theUser.Save();
                }
                else
                {
                    theUser.code   = code;
                    theUser.result = responseString;
                    theUser.Update();
                }

                var resultData = new { telephone = telephone, result = responseString };
                var result     = new ContentResult
                {
                    Content     = serializer.Serialize(resultData),
                    ContentType = "application/json"
                };
                return(result);
            }
            catch (Exception ex)
            {
                var serializer = new JavaScriptSerializer();

                // For simplicity just use Int32's max value.
                // You could always read the value from the config section mentioned above.
                serializer.MaxJsonLength = Int32.MaxValue;


                string err = ex.Message;
                if (ex.InnerException != null)
                {
                    err += ex.InnerException.Message;
                }

                var resultData = new { telephone = telephone, error = err };
                var result     = new ContentResult
                {
                    Content     = serializer.Serialize(resultData),
                    ContentType = "application/json"
                };
                return(result);
            }
            return(View());
        }