Пример #1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Constructs an ItemisedClass from an existing class </summary>
        /// <remarks>   The existing class must already contain an "items" property</remarks>
        /// <param name="source">  The class from which the ItemisedClass is constructed </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        public ItemisedClass(ConfigClass source)
            : base(source.Name, source.ParentName) {
            _items = this["items"] as IntProperty;
            foreach (ConfigProperty e in source)
                base.Add(e);
            RenumberItems();
        }
Пример #2
0
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>   Visit configuration class. </summary>
 /// <remarks>   Neil MacMullen, 18/02/2011. </remarks>
 /// <param name="node"> The node. </param>
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 protected override void VisitConfigClass(ConfigClass node) {
     var className = new StringBuilder("class " + node.Name);
     if (node.ParentName.Length != 0)
         className.Append(":" + node.ParentName);
     AppendLineIndented(className.ToString());
     AppendLineIndented("{");
     _indentLevel++;
     base.VisitConfigClass(node);
     _indentLevel--;
     AppendLineIndented("};");
 }
Пример #3
0
        private void Initializer(ConfigClass conf)
        {
            TimeOutLogEmpty = Convert.ToInt32(conf.GetValue("TimeOutLogEmpty"));
            String addr = "http://" + conf.GetValue("ServiceHost") + ":" + conf.GetValue("ServicePort") + "/" + conf.GetValue("ServiceAddress");
            Uri    uri  = new Uri(addr);
            var    rt   = new FastReportDLL.WCF.FastReportWCF(conf);

            serviceHost = new ServiceHost(rt, uri);
            //serviceHost = new ServiceHost(typeof(FastReportDLL.WCF.FastReportWCF), uri);
            BasicHttpBinding binding = new BasicHttpBinding();

            binding.MessageEncoding = WSMessageEncoding.Mtom;
            TimeSpan times = new TimeSpan(0, 5, 0);

            binding.CloseTimeout           = times;
            binding.OpenTimeout            = times;
            binding.ReceiveTimeout         = times;
            binding.SendTimeout            = times;
            binding.MaxReceivedMessageSize = int.MaxValue;
            binding.MaxBufferSize          = int.MaxValue;// 2147483647;
            serviceHost.CloseTimeout       = times;
            serviceHost.OpenTimeout        = times;

            serviceHost.AddServiceEndpoint(typeof(FastReportDLL.WCF.IFastService), binding, "");

            ServiceMetadataBehavior behavior = new ServiceMetadataBehavior();

            behavior.HttpGetEnabled = true;
            serviceHost.Description.Behaviors.Add(behavior);

            ServiceThrottlingBehavior stb = new ServiceThrottlingBehavior
            {
                MaxConcurrentSessions  = Convert.ToInt32(conf.GetValue("MaxConcurrentSessions")),
                MaxConcurrentCalls     = Convert.ToInt32(conf.GetValue("MaxConcurrentCalls")),
                MaxConcurrentInstances = Convert.ToInt32(conf.GetValue("MaxConcurrentInstances"))
            };

            serviceHost.Description.Behaviors.Add(stb);

            if (conf.GetValue("ServiceMEX_IS").Equals("Да"))
            {
                serviceHost.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(), "mex");
            }
        }
Пример #4
0
        private void SetNewColor(object sender, RoutedEventArgs e)
        {
            ConfigClass config = Config.GetConfig();

            // TODO: colorTile must be replaced

            /*if (colorTile.SelectedColor != null)
             * {
             *  System.Windows.Media.Color color = (System.Windows.Media.Color)colorTile.SelectedColor;
             *  System.Drawing.Color newColor = System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B);
             *  config.Color = Util.HexConverter(newColor);
             * }
             *
             * bool result = Config.SetConfig(config);
             * if (result == false)
             * {
             *  ErrorHandler.Error();
             * }*/
        }
Пример #5
0
 private void axWindowsMediaPlayer1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
 {
     if (isStop)
     {
         isStop = false;
         return;
     }
     if (e.newState == 2)
     {
         ConfigClass config = SqlLiteHelper.query("isMainClose")[0];
         config.FormalValue = "0";
         config.TestValue   = "0";
         SqlLiteHelper.update(config);
         Application.Exit();
     }
     if (e.newState == 3)
     {
         //播放
     }
 }
Пример #6
0
        /// <summary>

        public ConfigClass Get <ConfigClass>() where ConfigClass : IConfig, new()
        {
            ILog lg = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            if (!LoadExecuted)
            {
                Load();
            }
            ConfigClass akt = new ConfigClass();

            try {
                akt = this.GetObject <ConfigClass>();
                akt.IsCorrectlyLoaded = true;
                return(akt);
            } catch (Exception ex) {
                string ertx = string.Format("Config File '{0}' not loaded, error extracting settings.", this.FileSource);
                lg.Error(Functions.GetExceptionText(ex));
                throw new Exception(ertx, ex);
            }
        }
Пример #7
0
        /// <summary>
        /// 查询配置
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static List <ConfigClass> query(string name)
        {
            try
            {
                List <ConfigClass> list = new List <ConfigClass>();
                SQLiteConnection   conn = new SQLiteConnection();
                System.Data.SQLite.SQLiteConnectionStringBuilder connstr = new System.Data.SQLite.SQLiteConnectionStringBuilder();
                connstr.DataSource    = SqlLiteHelper.getSQLiteConn();
                connstr.Password      = "******";           //设置密码,SQLite ADO.NET实现了数据库密码保护
                conn.ConnectionString = connstr.ToString();
                SQLiteCommand cmd = new SQLiteCommand(); //是不是很熟悉呢?

                DateTime StartComputerTime = DateTime.Now;

                cmd.Connection = conn;

                if (name == null)
                {
                    cmd.CommandText = "select * from t_config order by id asc";
                }
                else
                {
                    cmd.CommandText = "select * from t_config where name='" + name + "' order by id asc";
                }
                conn.Close();
                conn.Open();
                SQLiteDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    ConfigClass config = new ConfigClass();
                    config.Id          = reader["id"].ToString();
                    config.Name        = reader["name"].ToString();
                    config.FormalValue = reader["formalValue"].ToString();
                    config.TestValue   = reader["testValue"].ToString();
                    config.Remark      = reader["remark"].ToString();
                    list.Add(config);
                }
                conn.Close();
                return(list);
            }catch (Exception ex) { return(new List <ConfigClass>()); }
        }
Пример #8
0
        public ModifyUser(string name, string fullname, string description, List <string> groupList, bool ChangePwNextLogon, bool PasswordCantBeChanged, bool PasswordNeverExpires, bool AccountDisabled, string password, CtrlHome ch, object[] comboBoxItems)
        {
            InitializeComponent();
            ConfigClass    _configClass    = new ConfigClass();
            ScriptHandling _scriptHandling = new ScriptHandling();
            int            indexForChecked = 0;

            foreach (string userGroupsString in _ctrlhome.localGroupMembers)
            {
                chkListBChangeGroups.Items.Add(userGroupsString);
                indexForChecked++;
                {
                    foreach (string checkedString in _ctrlhome.GroupsToBeChecked)
                    {
                        if (checkedString == userGroupsString)
                        {
                            chkListBChangeGroups.SetItemChecked(indexForChecked - 1, true);
                        }
                    }
                }
            }
            if (chkListBChangeGroups.CheckedItems.Count != 0)
            {
                foreach (string checkedItemsString in chkListBChangeGroups.CheckedItems)
                {
                    groupList.Add(checkedItemsString);
                }
            }
            lbUserName.Text                = name;
            tbUserFullName.Text            = fullname;
            tbUserDescription.Text         = description;
            tbNewPasword1.Text             = password;
            tbNewPasword2.Text             = password;
            cbChangePwNextLogon.Checked    = ChangePwNextLogon;
            cbPaswordCantBeChanged.Checked = PasswordCantBeChanged;
            cbPaswordNeverExpires.Checked  = PasswordNeverExpires;
            cbAccountDisabled.Checked      = AccountDisabled;
            _ctrlhome = ch;
        }
Пример #9
0
        // reads a class body
        ConfigClass ReadClassBody(string name, long bodyOffset)
        {
            // Class bodies are distributed separately from their definitions
            // so before we go looking we need to take note of where we started
            var currentOffset = _input.Position;

            //read the parent name
            _input.Seek(bodyOffset, SeekOrigin.Begin);
            var parentName = BinaryFile.ReadString(_input);
            var cfgClass   = new ConfigClass(name, parentName);

            //read all entries in the class body
            var entryCount = BinaryFile.ReadCompressedInteger(_input);

            for (var c = 0; c < entryCount; c++)
            {
                cfgClass.Add(ReadConfigEntry());
            }
            //ensure we haven't disturbed the seek position
            _input.Seek(currentOffset, SeekOrigin.Begin);
            return(cfgClass);
        }
Пример #10
0
 public static void MoveFile(FileSystemEventArgs e, ConfigClass conf)
 {
     for (int i = 0; i < 20000; i++)
     {
         try
         {
             string fileName   = e.Name;
             string sourcePath = conf.ThuMucQuet;
             string targetPath = conf.ThuMucChuyen;
             //Combine file và đường dẫn
             string sourceFile = System.IO.Path.Combine(sourcePath, fileName);
             string destFile   = System.IO.Path.Combine(targetPath, fileName);
             //Copy file từ file nguồn đến file đích
             System.IO.File.Copy(sourceFile, destFile, true);
             //ShowNotificationMessage(50, "Di chuyển file !!!", "Thành công", ToolTipIcon.None);
             break;
         }
         catch
         {
             //ShowNotificationMessage(50, "Error !!!", ex.Message, ToolTipIcon.Error);
         }
     }
 }
Пример #11
0
        /// <summary>
        /// 修改配置
        /// </summary>
        /// <param name="config"></param>
        /// <returns></returns>
        public static bool update(ConfigClass config)
        {
            try
            {
                SQLiteConnection conn = new SQLiteConnection();
                System.Data.SQLite.SQLiteConnectionStringBuilder connstr = new System.Data.SQLite.SQLiteConnectionStringBuilder();
                connstr.DataSource    = SqlLiteHelper.getSQLiteConn();
                connstr.Password      = "******";//设置密码,SQLite ADO.NET实现了数据库密码保护
                conn.ConnectionString = connstr.ToString();
                SQLiteCommand comm = new SQLiteCommand(conn);
                comm.CommandText = "update t_config set testValue='" + config.FormalValue + "',formalValue='" + config.FormalValue + "' where name='" + config.Name + "'";

                conn.Open();
                int result = comm.ExecuteNonQuery();
                if (result > 0)
                {
                    return(true);
                }
                conn.Close();
                return(false);
            }
            catch (Exception ex) { return(false); }
        }
Пример #12
0
        // Run the Query and Return the Result Database.
        public DataSet RunQueryEx(String paQuery, QueryClass.ConnectionMode paConnectionMode)
        {
            DataSet        lcDataSet;
            SqlCommand     lcCommand;
            SqlDataAdapter lcDataAdapter;
            SqlConnection  lcConnection;

            if (paConnectionMode != QueryClass.ConnectionMode.None)
            {
                lcConnection = new SqlConnection((paConnectionMode == QueryClass.ConnectionMode.EService) && (!String.IsNullOrEmpty(ConfigClass.GetInstance().EServiceRemoteConnectionStr)) ? ConfigClass.GetInstance().EServiceRemoteConnectionStr : ConfigClass.GetInstance().DefaultConnectionStr);

                lcCommand = new SqlCommand(paQuery, lcConnection);

                lcCommand.CommandTimeout = ConfigClass.GetInstance().CommandTimeOut;
                lcDataAdapter            = new SqlDataAdapter(lcCommand);
                lcDataSet = new DataSet();
                lcDataAdapter.Fill(lcDataSet);
                return(lcDataSet);
            }
            else
            {
                return(null);
            }
        }
Пример #13
0
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>   Constructs a ConfigFile from an existing ConfigClass</summary>
 /// <remarks>   All members of the existing class are copied across to a new ConfigFile </remarks>
 /// <param name="baseClass">    The base class. </param>
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 public ConfigFile(ConfigClass baseClass) : base("") {
     foreach (var e in baseClass)
         Add(e);
 }
Пример #14
0
    /// <summary>
    /// 处理一张表 Handle A table.
    /// </summary>
    /// <param name="result">Result.</param>
    public static bool HandleATable(DataTable result)
    {
        Debug.Log(result.TableName);

        //创建这个类
        Type t = Type.GetType(GetClassNameByName(result.TableName));

        if (t == null)
        {
            Debug.Log("the type is null  : " + result.TableName);
            return(false);
        }

        int columns = result.Columns.Count;
        int rows    = result.Rows.Count;

        //行数从0开始  第0行为注释
        int fieldsRow      = 1; //字段名所在行数
        int contentStarRow = 2; //内容起始行数

        //获取所有字段
        string[] tableFields = new string[columns];

        for (int j = 0; j < columns; j++)
        {
            tableFields[j] = result.Rows[fieldsRow][j].ToString();
            //Debuger.Log(tableFields[j]);
        }

        //存储表内容的字典
        List <ConfigClass> datalist = new List <ConfigClass>();

        //遍历所有内容
        for (int i = contentStarRow; i < rows; i++)
        {
            ConfigClass o = Activator.CreateInstance(t) as ConfigClass;

            for (int j = 0; j < columns; j++)
            {
                System.Reflection.FieldInfo info = o.GetType().GetField(tableFields[j]);

                if (info == null)
                {
                    continue;
                }

                string val = result.Rows[i][j].ToString();

                if (info.FieldType == typeof(int))
                {
                    info.SetValue(o, int.Parse(val));
                }
                else if (info.FieldType == typeof(float))
                {
                    info.SetValue(o, float.Parse(val));
                }
                else if (info.FieldType == typeof(double))
                {
                    info.SetValue(o, double.Parse(val));
                }
                else if (info.FieldType == typeof(bool))
                {
                    info.SetValue(o, bool.Parse(val));
                }
                else
                {
                    info.SetValue(o, val);
                }
                //Debuger.Log(val);
            }

            datalist.Add(o);
        }

        SaveTableData(datalist, result.TableName + ".json");
        return(true);
    }
Пример #15
0
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>   Replace all suitable classes in a hierarchy with ItemisedClasss. </summary>
 /// <remarks>
 ///     The Substitute function walks through a hierarchy of classes substitituting ItemisedClasss for any
 ///     class that looks like an ItemisedClass. This can be a useful shortcut if, for example, you have
 ///     loaded a standard ConfigFile from a file such as mission.sqm which contains classes that
 ///     could be interpreted as ItemisedClasses
 /// </remarks>
 /// <param name="root"> The root of the hierarchy to substitute. </param>
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 public static void Substitute(ConfigClass root) {
     _Substitute(root);
 }
Пример #16
0
 static ConfigClass _Substitute(ConfigClass c) {
     for (var i = 0; i < c.Count(); i++) {
         var cl = c[i] as ConfigClass;
         if (cl != null)
             c[i] = _Substitute(cl);
     }
     return TryAsItemisedClass(c);
 }
Пример #17
0
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>   Try to return a new ItemisedClass based on this class</summary>
 /// <remarks>
 ///     The class is considered to be an ItemisedClass if it contains a property called "items" -
 ///     more stringent checks may be added in future.
 /// </remarks>
 /// <param name="c">    The class from which the ItemisedClass is constructed. </param>
 /// <returns> A new ItemisedClass or else null if the supplied class doesn't appear to be a suitable base </returns>
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 static ItemisedClass TryAsItemisedClass(ConfigClass c) {
     var e = c["items"];
     if (e != null)
         return new ItemisedClass(c);
     return null;
 }
Пример #18
0
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>   Visit configuration class. </summary>
 /// <param name="node"> The node. </param>
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 protected virtual void VisitConfigClass(ConfigClass node) {
     foreach (var ce in node)
         Visit(ce);
 }
Пример #19
0
        // Execute the Query Return the Single Value result.
        public object ExecuteScalar(String paQuery, QueryClass.ConnectionMode paConnectionMode)
        {
            object        lcResult;
            SqlCommand    lcCommand;
            SqlConnection lcConnection;

            if (paConnectionMode != QueryClass.ConnectionMode.None)
            {
                lcConnection = new SqlConnection((paConnectionMode == QueryClass.ConnectionMode.EService) && (!String.IsNullOrEmpty(ConfigClass.GetInstance().EServiceRemoteConnectionStr)) ? ConfigClass.GetInstance().EServiceRemoteConnectionStr : ConfigClass.GetInstance().DefaultConnectionStr);

                lcCommand = new SqlCommand(paQuery, lcConnection);

                try
                {
                    lcConnection.Open();
                    lcResult = lcCommand.ExecuteScalar();
                    lcConnection.Close();

                    if ((lcResult == null) || (lcResult.GetType().ToString() == "System.DBNull"))
                    {
                        lcResult = null;
                    }
                }
                catch (Exception paException)
                {
                    lcConnection.Close();
                    throw new Exception("ExecuteScalar() : Query Execution Error", paException);
                }

                return(lcResult);
            }
            else
            {
                return(null);
            }
        }
Пример #20
0
 public FastReportWCF(ConfigClass _conf)
 {
     conf = _conf;
 }
Пример #21
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            ConfigClass config = Config.GetConfig();

            dmoveinfo.Text             = dmoveinfo.Text.Replace("{filepos}", Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Tiels\\temp");
            AutostartCB.IsChecked      = File.Exists(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "Tiels.lnk"));
            HideafterstartCB.IsChecked = config.HideAfterStart;
            EffectsCB.IsChecked        = config.SpecialEffects;

            TielsUILib.MainControl control  = ((TielsUILib.MainControl)((Microsoft.Toolkit.Wpf.UI.XamlHost.WindowsXamlHost)host).Child);
            SettingsPage           settings = control.GetSettingsPage();

            settings.autostart_tg.IsOn     = File.Exists(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "Tiels.lnk"));
            settings.autostart_tg.Toggled += (sender, args) =>
            {
                if (settings.autostart_tg.IsOn)
                {
                    CreateShortcut(System.Reflection.Assembly.GetEntryAssembly().Location);
                }
                else
                {
                    File.Delete(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "Tiels.lnk"));
                }
            };

            ManagePage manage = control.GetManagePage();

            MainWindow mw = Application.Current.Windows.OfType <MainWindow>().FirstOrDefault();

            foreach (var tile in mw.tilesw)
            {
                manage.AddTileToList(tile.name, tile.path);
            }

            // Add create tile event on "createTileBtn" button click
            manage.createTileBtn.Click += (sender, e) =>
            {
                string tileName = "tt";
                //"/[<>/\\*:\?\|]/g
                if (!Regex.IsMatch(tileName, @"\<|\>|\\|\/|\*|\?|\||:"))
                {
                    Directory.CreateDirectory(path + "\\" + tileName);
                    string dir = path + "\\" + tileName + "\\desktop.ini";
                    File.WriteAllText(dir,
                                      "[.ShellClassInfo]\r\n" +
                                      "IconResource=" + Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Tiels\\directoryicon.ico,0\r\n" +
                                      "[ViewState]\r\n" +
                                      "Mode =\r\n" +
                                      "Vid =\r\n" +
                                      "FolderType = Generic"
                                      );

                    File.SetAttributes(path + "\\" + tileName + "\\desktop.ini", FileAttributes.Hidden | FileAttributes.Archive | FileAttributes.System | FileAttributes.ReadOnly);
                    //RefreshIconCache();

                    MainWindow mw = Application.Current.Windows.OfType <MainWindow>().FirstOrDefault();
                    foreach (TileWindow tile in mw.tilesw)
                    {
                        tile.Close();
                    }
                    mw.tilesw.Clear();
                    tilelist.Items.Clear();
                    mw.Load();
                }
            };

            foreach (object item in manage.tileList.Items)
            {
                if (item is ListViewItem)
                {
                    // -> button
                    ((ListViewItem)item).Selected += (sender, e) =>
                    {
                        ListViewItem tmp_item = null;
                        foreach (ListViewItem item in tilelist.Items)
                        {
                            if (item.IsSelected)
                            {
                                string itempath = item.Tag + "\\" + item.Content;
                                if (File.Exists(itempath))
                                {
                                    string[] files = Directory.EnumerateFiles(itempath).ToArray();
                                    Directory.Move(itempath, Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Tiels\\temp\\" + item.Content);
                                    Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Tiels\\temp\\");
                                }
                                MainWindow mw = Application.Current.Windows.OfType <MainWindow>().FirstOrDefault();
                                foreach (var tile in mw.tilesw)
                                {
                                    if (tile.name == (string)item.Content)
                                    {
                                        tile.Close();
                                    }
                                }
                                tmp_item = item;
                            }
                        }
                        if (tmp_item != null)
                        {
                            tilelist.Items.Remove(tmp_item);
                        }
                    };
                }
            }
        }
Пример #22
0
        private void ThemeCombobox_Loaded(object sender, RoutedEventArgs e)
        {
            ConfigClass config = Config.GetConfig();

            ThemeCombobox.SelectedIndex = config.Theme;
        }
Пример #23
0
        // Execute the Query and Return the Number of Effected Rows.
        public int ExecuteNonQuery(String paQuery, QueryClass.ConnectionMode paConnectionMode)
        {
            int           lcResult;
            SqlCommand    lcCommand;
            SqlConnection lcConnection;
            SqlParameter  lcEffectedRowCount;

            if (paConnectionMode != QueryClass.ConnectionMode.None)
            {
                lcConnection = new SqlConnection((paConnectionMode == QueryClass.ConnectionMode.EService) && (!String.IsNullOrEmpty(ConfigClass.GetInstance().EServiceRemoteConnectionStr)) ? ConfigClass.GetInstance().EServiceRemoteConnectionStr : ConfigClass.GetInstance().DefaultConnectionStr);

                lcCommand          = new SqlCommand(paQuery, lcConnection);
                lcEffectedRowCount = new SqlParameter("@CSP_EffectedRowCount", SqlDbType.Int)
                {
                    Direction = ParameterDirection.Output
                };
                lcCommand.Parameters.Add(lcEffectedRowCount);

                try
                {
                    lcConnection.Open();
                    lcResult = lcCommand.ExecuteNonQuery();
                    lcConnection.Close();
                }
                catch (Exception paException)
                {
                    lcConnection.Close();
                    throw new Exception("ExecuteNonQuery() : Query Execution Error", paException);
                }

                if (lcEffectedRowCount.Value.GetType() != typeof(DBNull))
                {
                    return(General.ParseInt(lcEffectedRowCount.Value.ToString(), -1));
                }
                else
                {
                    return(lcResult);
                }
            }
            else
            {
                return(-1);
            }
        }
Пример #24
0
 public CobraPage()
 {
     ConfigClass.GetInstance().SetStandardUnit(true);
     ApplicationFrame.InitalizeInstance(this);
 }
Пример #25
0
 protected override void VisitConfigClass(ConfigClass node)
 {
     base.VisitConfigClass(node);
 }
Пример #26
0
        /// <summary>
        /// 构造要跳转的URL
        /// </summary>
        /// <param name="model"></param>
        /// <param name="sysModel"></param>
        /// <returns></returns>
        private Adpost.Ticket.Model.TicketQueryResult QueryURL(Adpost.Ticket.Model.TicketModel model, TicketSystemModel sysModel)
        {
            Adpost.Ticket.Model.TicketQueryResult result = new Adpost.Ticket.Model.TicketQueryResult();
            result.IsSuccess     = true;
            result.TicketGotoUrl = "";

            #region 表单验证
            if (String.IsNullOrEmpty(sysModel.TicketInterfaceUrl))
            {
                result.ErrorInfo.Append("请填写机票接口网址。\n");
                result.IsSuccess = false;
            }
            if (!result.IsSuccess)
            {
                return(result);
            }
            #endregion

            #region 构造URL
            StringBuilder str        = new StringBuilder();
            Hashtable     parameters = new Hashtable();

            if (FXUser.ContainsKey(model.User.UserName))
            {
                sysModel.cpcode = FXUser[model.User.UserName].ToString();
            }
            str.AppendFormat("&CompanyCode={0}", sysModel.CompanyCode);
            str.AppendFormat("&cpcode={0}", sysModel.cpcode);
            str.AppendFormat("&sysPath={0}", sysModel.sysPath);
            str.AppendFormat("&sign={0}", sysModel.Sign);

            if (!String.IsNullOrEmpty(model.User.UserName))
            {
                str.AppendFormat("&UserAccount={0}", HttpUtility.UrlEncodeUnicode(model.User.UserName));
                str.AppendFormat("&UserID={0}", HttpUtility.UrlEncodeUnicode(sysModel.cpcode + "." + model.User.UserName));
                str.AppendFormat("&UserName={0}", HttpUtility.UrlEncodeUnicode(model.User.UserName));
            }
            str.AppendFormat("&MobilePhone={0}", "15356126700");
            str.AppendFormat("&CompanyName={0}", HttpUtility.UrlEncodeUnicode(model.User.CorpName));
            str.AppendFormat("&Email={0}", "*****@*****.**");
            str.AppendFormat("&LinkMan={0}", HttpUtility.UrlEncodeUnicode("徐晟"));
            //parameters.Add("DoubleTrip", Convert.ToInt32(model.Flight.VoyageSet).ToString());

            model.Flight.FromCity    = "HGH";
            model.Flight.ToCity      = "PEK";
            model.Flight.TakeOffDate = DateTime.Now;

            //if (!String.IsNullOrEmpty(model.Flight.FromCity))
            //{
            //    parameters.Add("FromCityCode", model.Flight.FromCity);
            //}

            //if (!String.IsNullOrEmpty(model.Flight.ToCity))
            //{
            //    parameters.Add("DestCityCode", model.Flight.ToCity);
            //}

            //if (model.Flight.TakeOffDate.HasValue)
            //{
            //    parameters.Add("LeaveDate", model.Flight.TakeOffDate.Value.ToString("yyyy-MM-dd"));
            //}

            //if (model.Flight.ReturnDate.HasValue)
            //{
            //    parameters.Add("ReturnDate", model.Flight.ReturnDate.Value.ToString("yyyy-MM-dd"));
            //}
            //else
            //{
            //    parameters.Add("ReturnDate", string.Empty);
            //}
            if (string.IsNullOrEmpty(Request.QueryString["url"]))
            {
                str.AppendFormat("&action={0}", HttpUtility.UrlEncode(ConfigClass.GetConfigString("Ticket", "QueryURL") + "?" + Sign(parameters) + ""));
            }
            else
            {
                str.AppendFormat("&action={0}", HttpUtility.UrlEncode(Request.QueryString["url"] + "?" + Sign(parameters) + ""));
            }
            string strURL = str.ToString();
            if (strURL.StartsWith("&"))
            {
                strURL = strURL.Substring(1);
            }
            #endregion

            result.IsSuccess     = true;
            result.TicketGotoUrl = sysModel.TicketInterfaceUrl + "?" + strURL;
            return(result);
        }
Пример #27
0
        protected void AddFormStyle(ComponentController paComponentController)
        {
            String lcFormCSSClass;
            String lcCustomWallPaper;

            lcFormCSSClass = String.IsNullOrWhiteSpace(clFormInfoManager.ActiveRow.FormCSSClass) ? clFormInfoManager.ActiveRow.RenderMode : clFormInfoManager.ActiveRow.FormCSSClass;

            paComponentController.AddAttribute(HtmlAttribute.Class, ctCLSPanel + " " + lcFormCSSClass);
            paComponentController.AddElementType(ComponentController.ElementType.Form);

            if (ApplicationFrame.GetInstance().ActiveSubscription.IsDemoMode())
            {
                paComponentController.AddElementAttribute(ComponentController.ElementAttribute.ea_DemoMode, "true");
            }

            paComponentController.AddElementAttribute(ComponentController.ElementAttribute.ea_FormProtocolList, General.Base64Encode(clSettingManager.FormProtocolListStr));
            paComponentController.AddElementAttribute(ComponentController.ElementAttribute.ea_ServiceRequestToken, ApplicationFrame.GetInstance().ActiveServiceRequestToken);
            paComponentController.AddElementAttribute(ComponentController.ElementAttribute.ea_FormStack, ApplicationFrame.GetInstance().FormStack);
            paComponentController.AddElementAttribute(ComponentController.ElementAttribute.ea_FormName, clFormInfoManager.ActiveRow.FormName);
            paComponentController.AddElementAttribute(ComponentController.ElementAttribute.ea_EncodedFormName, clFormInfoManager.EncodedFormName);
            paComponentController.AddElementAttribute(ComponentController.ElementAttribute.ea_DataGroupName, clFormInfoManager.ActiveRow.DataGroup);
            paComponentController.AddElementAttribute(ComponentController.ElementAttribute.ea_LandingPage, General.Base64Encode(ApplicationFrame.GetInstance().ActiveSubscription.GetLandingPage()));
            paComponentController.AddElementAttribute(ComponentController.ElementAttribute.ea_Language, ApplicationFrame.GetInstance().ActiveSubscription.ActiveLanguage.ActiveRow.Language.ToLower());
            paComponentController.AddElementAttribute(ComponentController.ElementAttribute.ea_LocalNumberMode, ApplicationFrame.GetInstance().ActiveSubscription.ActiveSetting.LocalNumberMode.ToString().ToLower());
            paComponentController.AddElementAttribute(ComponentController.ElementAttribute.ea_LocalDigits, ApplicationFrame.GetInstance().ActiveSubscription.ActiveLanguage.LocalDigits);
            paComponentController.AddStyle(CSSStyle.Width, clFormInfoManager.ActiveRow.FormWidth.ToString() + ConfigClass.GetInstance().StandardXUnit);
            paComponentController.AddStyle(CSSStyle.Height, clFormInfoManager.ActiveRow.FormHeight.ToString() + ConfigClass.GetInstance().StandardYUnit);

            if ((lcCustomWallPaper = ApplicationFrame.GetInstance().ActiveSubscription.GetCustomWallPaper(clFormInfoManager.ActiveRow.FormName)) != null)
            {
                if (lcCustomWallPaper.ToLower().Contains(ctWallPaperPath))
                {
                    SetCustomBackground(paComponentController, lcCustomWallPaper);
                }
                else
                {
                    paComponentController.AddElementAttribute(ComponentController.ElementAttribute.ea_desktopbackgroundcss, lcCustomWallPaper);
                }
            }
        }
Пример #28
0
        private ApplicationFrame(Page paPage)
        {
            String lcFormName;

            HttpContext.Current.Items.Add(ctVARApplicationFrameInstance, this);

            clPage                  = paPage;
            clAjaxMode              = true;
            clClientScriptManager   = paPage.ClientScript;
            clWebStateBlock         = new WebStateBlock();
            clActiveGlobalMetaBlock = new GlobalMetaBlock();
            ConfigClass.GetInstance().ResetConfiguration();

            if (!String.IsNullOrEmpty(clServiceRequestToken = GetStateParameter(ctPRMServiceRequestToken)))
            {
                if ((clSubscriptionManager = SubscriptionManager.CreateInstance(clServiceRequestToken, GetParameter(ctPRMLanguage))) != null)
                {
                    if (clSubscriptionManager.Status == SubscriptionManager.SubscriptionStatus.Valid)
                    {
                        clServiceRequestLogManager = new ServiceRequestLogManager(clSubscriptionManager.ActiveRow.SubscriptionID);

                        clSessionController = new SessionController();

                        // if (clSubscriptionManager.Status == SubscriptionManager.SubscriptionStatus.Valid)
                        // {
                        /*    clSessionController.LogIn("AMT", "81DC9BDB52D04DC20036DBD8313ED055"); */

                        if (String.IsNullOrEmpty(lcFormName = GetParameter(ctPRMFormName)))
                        {
                            lcFormName = clSubscriptionManager.ActiveEService.GetEncodedPrimaryFormName();
                        }

                        clFormInfoManager = FormInfoManager.CreateInstance(lcFormName);

                        if (((clFormInfoManager == null) || (!clFormInfoManager.IsAttributeSet(FormInfoManager.FormAttribute.NoSession))) &&
                            (ActiveEservice.IsMandatorySession) && (ActiveSessionController.Status == SessionController.SessionStatus.NoSession))
                        {
                            clSessionController.LogOut();
                            lcFormName        = clSubscriptionManager.ActiveEService.GetEncodedLogInFormName();
                            clFormInfoManager = FormInfoManager.CreateInstance(lcFormName);
                        }
                        //if ((ActiveEservice.IsMandatorySession) && (ActiveSessionController.Status == SessionController.SessionStatus.NoSession))
                        //    lcFormName = clSubscriptionManager.ActiveEService.GetEncodedLogInFormName();
                        //else if (String.IsNullOrEmpty(lcFormName = GetParameter(ctPRMFormName)))
                        //        lcFormName = clSubscriptionManager.ActiveEService.GetEncodedPrimaryFormName();
                        // clFormInfoManager = FormInfoManager.CreateInstance(lcFormName);

                        clFormStack = GetFormStack();
                        ActiveGlobalMetaBlock.AddMetaDataElement(MetaDataElement.CreateMetaDataElement(ctMETAFormName, lcFormName));

                        if ((ApplicationFrame.GetInstance().ActiveSubscription.IsDemoMode()) && (ApplicationFrame.GetInstance().ActiveSubscription.IsDynamicDateMode()))
                        {
                            DynamicQueryManager.GetInstance().GetStringResult(DynamicQueryManager.ExecuteMode.NonQuery, ctDYQUpdateDemoDynamicDate, null);
                        }

                        clInitializationStatus = InitializationStatus.Success;
                    }

                    //else
                    //{
                    //    lcFormName = clSubscriptionManager.ActiveEService.GetEncodedLogInFormName();
                    //    clFormInfoManager = FormInfoManager.CreateInstance(lcFormName);
                    //    clFormStack = GetFormStack();
                    //    ActiveGlobalMetaBlock.AddMetaDataElement(MetaDataElement.CreateMetaDataElement(ctMETAFormName, lcFormName));
                    //}


                    return;
                }
            }
            else
            {
                clServiceRequestLogManager = new ServiceRequestLogManager(String.Empty);
            }

            clInitializationStatus = InitializationStatus.Fail;
        }
Пример #29
0
 public ConfigFile(IEnumerable<object> entries)
     : base("") {
     var cls = new ConfigClass("", "", entries);
     foreach (var e in cls)
         Add(e);
 }
Пример #30
0
 protected override void VisitConfigClass(ConfigClass node) {
     base.VisitConfigClass(node);
 }
Пример #31
0
        // Execute the Query and Fetch the Value from the Feedback Variable.
        public object ExecuteFeedBackQuery(String paQuery, String paFeedBackVar, QueryClass.ConnectionMode paConnectionMode)
        {
            object        lcResult;
            SqlCommand    lcCommand;
            SqlConnection lcConnection;

            lcResult = null;

            if (paConnectionMode != QueryClass.ConnectionMode.None)
            {
                lcConnection = new SqlConnection((paConnectionMode == QueryClass.ConnectionMode.EService) && (!String.IsNullOrEmpty(ConfigClass.GetInstance().EServiceRemoteConnectionStr)) ? ConfigClass.GetInstance().EServiceRemoteConnectionStr : ConfigClass.GetInstance().DefaultConnectionStr);
                lcCommand    = new SqlCommand(paQuery, lcConnection);

                try
                {
                    lcConnection.Open();
                    lcCommand.ExecuteNonQuery();

                    lcCommand.CommandText = "SELECT " + paFeedBackVar;
                    lcResult = lcCommand.ExecuteScalar();

                    lcConnection.Close();
                }
                catch (Exception paException)
                {
                    lcConnection.Close();
                    throw new Exception("ExecuteFeedBackQuery() : Query Execution Error", paException);
                }
            }

            return(lcResult);
        } // DatabaseInterface Class
Пример #32
0
        private ConfigClass ParseClass()
        {
            if (!Expect(BisTokenType.Term, @class))
            {
                return(null);
            }

            var name = ParseName();

            if (name == null)
            {
                return(null);
            }
            string baseName = null;

            if (!Next())
            {
                return(null);
            }
            if (t.Type == BisTokenType.Semicolon) //External
            {
                return(new ConfigClass(name));
            }

            if (t.Type == BisTokenType.Colon) //inheritance
            {
                baseName = ParseName();
                if (!Next())
                {
                    return(null);
                }
            }

            var c = new ConfigClass(name, baseName);


            if (!Expect(BisTokenType.LCurly, "{"))
            {
                return(null);
            }
            while (true)
            {
                if (!Next())
                {
                    return(null);
                }
                switch (t.Value.ToLower())
                {
                case "}": break;

                case @class:
                    var sc = ParseClass();
                    if (sc != null)
                    {
                        c.AddSubclass(sc);
                    }
                    break;

                case @delete:
                    var del = ParseName();
                    if (del == null)
                    {
                        continue;
                    }
                    c.AddDelete(del);
                    break;

                default:
                    var propName = ReadIdentifier();
                    if (propName == null)
                    {
                        continue;
                    }
                    if (!Next())
                    {
                        return(null);
                    }
                    if (t.Type == BisTokenType.LSquare)
                    {
                        if (!ExpectNext(BisTokenType.RSquare, "]"))
                        {
                            continue;
                        }
                        if (!Next())
                        {
                            return(null);
                        }
                        propName += "[]";
                    }
                    Expect(BisTokenType.Operator, "=");

                    var propValue = ParseConfigPropertyValue(propName);
                    if (propValue == null)
                    {
                        continue;
                    }
                    c.AddProperty(propValue);
                    break;
                }
                if (t.Type == BisTokenType.RCurly)
                {
                    break;
                }
            }
            if (!Expect(BisTokenType.RCurly, "}"))
            {
                return(null);
            }
            ExpectNext(BisTokenType.Semicolon, ";");
            return(c);
        }
Пример #33
0
 public UserService(IUserRepository userRepository, IProfileService profileService, IOptions <ConfigClass> cfg)
 {
     _userRepository = userRepository;
     _profileService = profileService;
     _cfg            = cfg.Value;
 }
Пример #34
0
 public ConfigFile(ConfigClass root, IDictionary <string, int> enums = null)
 {
     this.enums = new ReadOnlyDictionary <string, int>(enums);
     Root       = root;
 }
Пример #35
0
        protected void RenderElementContainer(ComponentController paComponentController)
        {
            WidgetRenderingManager lcWidgetRenderingManager;

            lcWidgetRenderingManager = new WidgetRenderingManager(this, clFormInfoManager, paComponentController);

            paComponentController.AddAttribute(HtmlAttribute.Class, ctCLSElementContainer);
            paComponentController.AddStyle(CSSStyle.Height, clFormInfoManager.ActiveRow.ContainerHeight.ToString() + ConfigClass.GetInstance().StandardYUnit);
            paComponentController.RenderBeginTag(HtmlTag.Div);
            lcWidgetRenderingManager.RenderWidget();
            paComponentController.RenderEndTag();
        }
Пример #36
0
 public void EndInit()
 {
     counter = ConfigClass.SomeStaticMethod();
 }
Пример #37
0
        // reads a class body 
        ConfigClass ReadClassBody(string name, long bodyOffset) {
            // Class bodies are distributed separately from their definitions
            // so before we go looking we need to take note of where we started
            var currentOffset = _input.Position;

            //read the parent name
            _input.Seek(bodyOffset, SeekOrigin.Begin);
            var parentName = BinaryFile.ReadString(_input);
            var cfgClass = new ConfigClass(name, parentName);

            //read all entries in the class body
            var entryCount = BinaryFile.ReadCompressedInteger(_input);
            for (var c = 0; c < entryCount; c++)
                cfgClass.Add(ReadConfigEntry());
            //ensure we haven't disturbed the seek position
            _input.Seek(currentOffset, SeekOrigin.Begin);
            return cfgClass;
        }