Exemple #1
0
            // ReSharper disable once UnusedMember.Local
            private static void MergeArchiveToZzz(ArchiveBase aw)
            {
                if (aw == null)
                {
                    return;
                }

                void Merge(Archive a)
                {
                    Log.WriteLine($"{nameof(Archive)}::{nameof(Init)}::{nameof(Merge)}\n\t{a} to {ZZZ_MAIN}");
                    string      fs    = a.FS;
                    ArchiveBase child = ArchiveWorker.Load(a);
                    FI          fi    = aw.ArchiveMap.FindString(ref fs, out int _);

                    aw.ArchiveMap.MergeMaps(child.ArchiveMap, fi.Offset);
                }

                Merge(A_BATTLE);
                Merge(A_FIELD);
                Merge(A_MAGIC);
                Merge(A_MAIN);
                Merge(A_MENU);
                Merge(A_WORLD);
                aw.GetListOfFiles(true);
                ArchiveBase.PurgeCache();
                A_BATTLE = ZZZ_MAIN;
                A_FIELD  = ZZZ_MAIN;
                A_MAGIC  = ZZZ_MAIN;
                A_MAIN   = ZZZ_MAIN;
                A_MENU   = ZZZ_MAIN;
                A_WORLD  = ZZZ_MAIN;
            }
Exemple #2
0
        public static void Main(string[] args)
        {
            object testFinance = CreateInstance("Finance");

            Console.WriteLine(testFinance.GetType().GetProperty("taxRate"));
            Finance testFinance2 = new Finance();

            foreach (FieldInfo FI in testFinance.GetType().GetFields())
            {
                if (FI.Name == "bankSide")
                {
                    dynamic     bankSide  = FI.GetValue(testFinance);
                    List <Bank> bankSide1 = bankSide;
                    foreach (FieldInfo BI in bankSide[0].GetType().GetFields())
                    {
                        if (BI.Name == "branchID")
                        {
                            dynamic    branchID  = BI.GetValue(bankSide1[0]);
                            List <int> branchID1 = branchID;
                            foreach (int i in branchID1)
                            {
                                Console.WriteLine(i);
                            }
                        }
                    }
                    // Console.WriteLine(test);
                }
            }
            //Console.WriteLine(myPropInfo.GetValue(testFinance2, null));

            Console.ReadKey();
        }
        public static void SetIdentifiers(FI fi, IdentifierType identifierType, string[] identifiers, SymmetryEntities dc)
        {
          IList<FIIdentifier> list = null;
          {
            var currentIDs = fi.FIIdentifiers.Where(x => x.IdentifierType == identifierType);
            if (currentIDs != null && currentIDs.Any())
              list = currentIDs.ToList();
          }

          foreach (var identifier in identifiers)
          {
            if (string.IsNullOrEmpty(identifier)) continue;

            if (list == null)
            {
              fi.FIIdentifiers.Add(new FIIdentifier { IdentifierType = identifierType, Identifier = identifier });
            }
            else if (list.Any(x => string.Compare(x.Identifier, identifier, true) == 0))  // already exists
            {
              list.Remove(list.First(x => string.Compare(x.Identifier, identifier, true) == 0));  // remove from the list of existing
            }
            else
            {
              fi.FIIdentifiers.Add(new FIIdentifier { IdentifierType = identifierType, Identifier = identifier });
            }
          }

          // if we have any left in the original list, then remove them all
          if (list != null && list.Any())
            foreach (var v in list)
              dc.Entry(v).State = EntityState.Deleted;
        }
Exemple #4
0
        static ColorAttribute()
        {
            stringToColor = new Dictionary <string, SKColor>();
            rgbaToName    = new Dictionary <string, string>();

            Type T = typeof(SKColors);

            foreach (PropertyInfo PI in T.GetRuntimeProperties())
            {
                if (PI.PropertyType == typeof(SKColor))
                {
                    SKColor Color = (SKColor)PI.GetValue(null);
                    stringToColor[PI.Name]    = Color;
                    rgbaToName[ToRGBA(Color)] = PI.Name;
                }
            }

            foreach (FieldInfo FI in T.GetRuntimeFields())
            {
                if (FI.FieldType == typeof(SKColor))
                {
                    SKColor Color = (SKColor)FI.GetValue(null);
                    stringToColor[FI.Name]    = Color;
                    rgbaToName[ToRGBA(Color)] = FI.Name;
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// Evaluates the node, using the variables provided in the <paramref name="Variables"/> collection.
        /// </summary>
        /// <param name="Variables">Variables collection.</param>
        /// <returns>Result.</returns>
        public override IElement Evaluate(Variables Variables)
        {
            IElement        E        = this.Argument.Evaluate(Variables);
            object          Obj      = E.AssociatedObjectValue;
            List <IElement> Elements = new List <IElement>();

            if (Obj is Type T)
            {
                foreach (FieldInfo FI in T.GetRuntimeFields())
                {
                    Elements.Add(new StringValue(FI.Name));
                }

                return(new ObjectVector(Elements));
            }
            else
            {
                T = Obj.GetType();

                foreach (FieldInfo FI in T.GetRuntimeFields())
                {
                    Elements.Add(new StringValue(FI.Name));
                    Elements.Add(Expression.Encapsulate(FI.GetValue(Obj)));
                }

                ObjectMatrix M = new ObjectMatrix(Elements.Count / 2, 2, Elements)
                {
                    ColumnNames = new string[] { "Name", "Value" }
                };

                return(M);
            }
        }
        public Controller(FI.BusinessObjects.OlapReport Report , System.Web.UI.Page Page)
        {
            if(Report==null)
                throw new NullReferenceException();

            _report=Report;
            _page=Page;
        }
Exemple #7
0
    static void CopyAssetsToProject()
    {
        FI.TargetPlatform = "android";
        FI.copyToProject();

        FI.TargetPlatform = "ios";
        FI.copyToProject();
    }
        public static int _CreateRootTabs(FI.UI.Web.Controls.Tabs.TabView tv, string UserName, bool UserLoggedIn, bool NavigationEnabled, RootTabsEnum ActiveTab)
        {
            int tabId=0;
            int activeTabId=0;
            string activeLabelStr=ActiveTab.ToString().Replace("_", " ");

            if(UserLoggedIn)
            {
                tv.EnableLogoutButton=true;
                tv.LogoutHref="~/Default.aspx?action=Logout";
                tv.WelcomeNote=FI.Common.AppConfig.AppName + "-[" + UserName + "]";
            }
            else
            {
                tv.EnableLogoutButton=false;
                tv.WelcomeNote=FI.Common.AppConfig.AppName;
            }

            string label="";
            string href="";

            label=RootTabsEnum.Home.ToString();
            href=(NavigationEnabled? "~/Default.aspx?action=Home" : "");
            tabId=tv.AddTab(0 , label , href , (activeLabelStr==label) , false);
            activeTabId=(activeLabelStr==label?tabId:activeTabId);

            label=RootTabsEnum.Olap_Reports.ToString().Replace("_", " ");
            href=(NavigationEnabled? "~/ReportList.aspx?content=List&rpttype=0" : "");
            tabId=tv.AddTab(0 , label , href , (activeLabelStr==label) , false);
            activeTabId=(activeLabelStr==label?tabId:activeTabId);

            if(!FI.Common.AppConfig.HideCustomReports)
            {
                label=RootTabsEnum.Custom_SQL_Reports.ToString().Replace("_", " ");
                href=(NavigationEnabled? "~/ReportList.aspx?content=List&rpttype=2" : "");
                tabId=tv.AddTab(0 , label , href , (activeLabelStr==label) , false);
                activeTabId=(activeLabelStr==label?tabId:activeTabId);

                label=RootTabsEnum.Custom_MDX_Reports.ToString().Replace("_", " ");
                href=(NavigationEnabled? "~/ReportList.aspx?content=List&rpttype=3" : "");
                tabId=tv.AddTab(0 , label , href , (activeLabelStr==label) , false);
                activeTabId=(activeLabelStr==label?tabId:activeTabId);

                label=RootTabsEnum.Storecheck_Reports.ToString().Replace("_", " ");
                href=(NavigationEnabled? "~/ReportList.aspx?content=List&rpttype=1" : "");
                tabId=tv.AddTab(0 , label , href , (activeLabelStr==label) , false);
                activeTabId=(activeLabelStr==label?tabId:activeTabId);
            }

            label=RootTabsEnum.Administrative_Tools.ToString().Replace("_", " ");
            href=(NavigationEnabled? "~/UserList.aspx" : "");
            tabId=tv.AddTab(0 , label , href , (activeLabelStr==label) , false);
            activeTabId=(activeLabelStr==label?tabId:activeTabId);

            return activeTabId;
        }
        /// <summary>
        /// This method is used to set the DirtyStatus to NoChange to item and it's child items
        /// </summary>
        public void SetDirtyStatusToNoChange()
        {
            DirtyStatus = eDirtyStatus.NoChange;

            // Properties
            foreach (PropertyInfo PI in this.GetType().GetProperties())
            {
                var token = PI.GetCustomAttribute(typeof(IsSerializedForLocalRepositoryAttribute));
                if (token == null)
                {
                    continue;
                }

                if (typeof(IObservableList).IsAssignableFrom(PI.PropertyType))
                {
                    IObservableList obj = (IObservableList)PI.GetValue(this);
                    if (obj == null)
                    {
                        continue;
                    }
                    foreach (object o in obj)
                    {
                        if (o is RepositoryItemBase)
                        {
                            ((RepositoryItemBase)o).SetDirtyStatusToNoChange();
                        }
                    }
                }
            }

            // Fields
            foreach (FieldInfo FI in this.GetType().GetFields())
            {
                var token = FI.GetCustomAttribute(typeof(IsSerializedForLocalRepositoryAttribute));
                if (token == null)
                {
                    continue;
                }
                if (typeof(IObservableList).IsAssignableFrom(FI.FieldType))
                {
                    IObservableList obj = (IObservableList)FI.GetValue(this);
                    if (obj == null)
                    {
                        return;
                    }
                    foreach (object o in obj)
                    {
                        if (o is RepositoryItemBase)
                        {
                            ((RepositoryItemBase)o).SetDirtyStatusToNoChange();
                        }
                    }
                }
            }
        }
Exemple #10
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            FI fi = (FI)lstDev.SelectedItem;

            if (fi == null)
            {
                return;
            }
            videoSource  = new VideoCaptureDevice(fi.fi.MonikerString);
            DialogResult = DialogResult.OK;
        }
Exemple #11
0
        public override string ToString()
        {
            string FieldNames = string.Empty;          // = "Name=" + Name +"\n";

            FieldInfo[] ProtocolFields = ProtocolProvider.GetProtocolParametersFields(this);
            foreach (FieldInfo FI in ProtocolFields)
            {
                FieldNames += string.Format("{0}={1}\n", FI.Name, FI.GetValue(this).ToString());
            }
            return(FieldNames);
        }
Exemple #12
0
 public static int Compare(FI a, FI b)
 {
     if (a.pr == b.pr)
     {
         return(0);
     }
     if (a.pr < b.pr)
     {
         return(1);
     }
     return(-1);
 }
Exemple #13
0
        static IEnumerable <Sprite> getSprites(Holdable e)
        {
            Type type = e.GetType();

            List <FieldInfo> fields;

            if (!SpriteFields.TryGetValue(type, out fields))
            {
                SpriteFields.Add(type, fields = type.GetFields(flags).Where(field => typeof(Sprite).IsAssignableFrom(field.FieldType)).ToList());
            }

            return(fields.Select(FI => (Sprite)FI.GetValue(e)));
        }
    public static string GetListDataFromField <From>(From obj, string Delim = "_")
    {
        FieldInfo[]   FS = obj.GetType().GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
        StringBuilder s  = new StringBuilder(100);

        foreach (FieldInfo FI in FS)
        {
            s.Append(FI.Name); s.Append(":"); s.Append(FI.GetValue(obj).ToString()); s.Append(Delim);
        }
        string S = s.ToString();

        return(S.Substring(0, S.Length - Delim.Length));
    }
 public static void DeleteAllFiles(this DirectoryInfo DI)
 {
     foreach (FileInfo FI in DI.GetFiles())
     {
         try
         {
             FI.Delete();
         }
         catch
         {
         }
     }
 }
Exemple #16
0
        public static NamedEnum[] GetAll(Type T)
        {
            if (!T.IsEnum)
            {
                return(null);
            }
            ArrayList Values = new ArrayList();

            foreach (FieldInfo FI in T.GetFields(BindingFlags.Public | BindingFlags.Static))
            {
                Values.Add(new NamedEnum(FI.GetValue(null)));
            }
            return((NamedEnum[])Values.ToArray(typeof(NamedEnum)));
        }
Exemple #17
0
        public FI[] GetFI()
        {
            FI[]   FileIndex = new FI[FileList.Length];
            string flPath    = $"{Path.GetDirectoryName(_path)}\\{Path.GetFileNameWithoutExtension(_path)}.fi";

            using (FileStream fs = new FileStream(flPath, FileMode.Open, FileAccess.Read))
                using (BinaryReader br = new BinaryReader(fs))
                    for (int i = 0; i <= FileIndex.Length - 1; i++)
                    {
                        FileIndex[i].LengthOfUnpackedFile = br.ReadUInt32();
                        FileIndex[i].LocationInFS         = br.ReadUInt32();
                        FileIndex[i].LZSS = br.ReadUInt32();
                    }
            return(FileIndex);
        }
Exemple #18
0
    public override int run(string[] args)
    {
        communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
        Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
        Ice.Object        d       = new DI();
        adapter.add(d, Ice.Util.stringToIdentity("d"));
        adapter.addFacet(d, Ice.Util.stringToIdentity("d"), "facetABCD");
        Ice.Object f = new FI();
        adapter.addFacet(f, Ice.Util.stringToIdentity("d"), "facetEF");
        Ice.Object h = new HI(communicator());
        adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH");

        AllTests.allTests(this);

        return(0);
    }
Exemple #19
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        Ice.Object d = new DI();
        adapter.add(d, communicator.stringToIdentity("d"));
        adapter.addFacet(d, communicator.stringToIdentity("d"), "facetABCD");
        Ice.Object f = new FI();
        adapter.addFacet(f, communicator.stringToIdentity("d"), "facetEF");
        Ice.Object h = new HI(communicator);
        adapter.addFacet(h, communicator.stringToIdentity("d"), "facetGH");

        AllTests.allTests(communicator);

        return 0;
    }
Exemple #20
0
 public override void run(string[] args)
 {
     using (var communicator = initialize(ref args))
     {
         communicator.Properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
         Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
         var d = new DI();
         adapter.Add(d, "d");
         adapter.Add(d, "d", "facetABCD");
         var f = new FI();
         adapter.Add(f, "d", "facetEF");
         var h = new HI(communicator);
         adapter.Add(h, "d", "facetGH");
         AllTests.allTests(this);
     }
 }
Exemple #21
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        Ice.Object        d       = new DI();
        adapter.add(d, communicator.stringToIdentity("d"));
        adapter.addFacet(d, communicator.stringToIdentity("d"), "facetABCD");
        Ice.Object f = new FI();
        adapter.addFacet(f, communicator.stringToIdentity("d"), "facetEF");
        Ice.Object h = new HI(communicator);
        adapter.addFacet(h, communicator.stringToIdentity("d"), "facetGH");

        AllTests.allTests(communicator);

        return(0);
    }
Exemple #22
0
 public override void run(string[] args)
 {
     using (var communicator = initialize(ref args))
     {
         communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
         Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
         Ice.Object        d       = new DI();
         adapter.add(d, Ice.Util.stringToIdentity("d"));
         adapter.addFacet(d, Ice.Util.stringToIdentity("d"), "facetABCD");
         Ice.Object f = new FI();
         adapter.addFacet(f, Ice.Util.stringToIdentity("d"), "facetEF");
         Ice.Object h = new HI(communicator);
         adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH");
         AllTests.allTests(this);
     }
 }
Exemple #23
0
        public string ToJson <T>(Type Instance)
        {
            int i = 0;

            string[] paramNames  = new string[typeof(T).GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).Length];
            string[] paramValues = new string[typeof(T).GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).Length];
            // {"type":"analog", "table":"norm", "column":"diFlourHopper_Mass", "decimal":3, "color":#88FF00, "coef":0.001 }
            string json = "{";

            switch (Instance.GetType().FullName)
    #pragma warning disable CS1522 // Empty switch block
            {
    #pragma warning restore CS1522 // Empty switch block
            }
            foreach (FieldInfo FI in typeof(T).GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance))
            {
                string param      = FI.Name.ToLower();
                object obj        = FI.GetValue(this);
                string paramValue = obj.ToString();
                paramNames[i]  = param;
                paramValues[i] = paramValue;
                json          += "\"" + paramNames[i] + "\":";
                switch (FI.FieldType.Name)
                {
                case "String":
                    json += "\"" + paramValues[i] + "\", ";
                    break;

                case "Color":
                    Color color = (Color)FI.GetValue(this);
                    if (color != null)
                    {
                        json += ColorTranslator.ToHtml(color).ToString() + ", ";
                    }
                    break;

                default:
                    json += paramValues[i] + ", ";
                    break;
                }
                i++;
            }
            json  = json.Remove(json.LastIndexOf(", "), 2);
            json += "}";

            return(json);
        }
Exemple #24
0
        private static List <string[]> ObserveVariables()
        {
            // Get a list of all the variables that are being observed and their contents

            var ReflectionTest = typeof(User_Program).GetFields(BindingFlags.NonPublic |
                                                                BindingFlags.Public |
                                                                BindingFlags.Static);

            var Stringses = new List <string[]>();

            foreach (var FI in ReflectionTest)
            {
                Stringses.Add(new[] { FI.Name, (FI.GetValue(null) ?? "null").ToString(), FI.FieldType.Name });
            }

            return(Stringses);
        }
Exemple #25
0
        public ItemFairy SelectFairyForEnchance()
        {
            if (GetEquiped().id > 0)
            {
                int IP = CHR.GetClass <Inventory>().GetFirstFreePlace();
                if (IP > 0)
                {
                    ItemInventory.Equip(CHR.HNDL, IP, 0x17);
                }
            }
            Thread.Sleep(2000);
            LoadFairiesFromInventory();
            ItemFairy BEST  = new ItemFairy(CHR);
            ItemFairy WORST = new ItemFairy(CHR);

            BEST.P1  = 0;
            BEST.P2  = 1;
            WORST.P1 = 1;
            WORST.P2 = 1;
            int count = 0;

            foreach (ItemFairy FI in FL)
            {
                if (FI.IsGood())
                {
                    if (FI.lvl < 10)
                    {
                        ItemInventory.Equip(CHR.HNDL, FI.place, 0x17);
                        return(FI);
                    }
                    BEST  = ((double)FI.P1 / (double)FI.P2 >= (double)BEST.P1 / (double)BEST.P2) ? FI : BEST;
                    WORST = ((double)FI.P1 / (double)FI.P2 < (double)WORST.P1 / (double)WORST.P2) ? FI : WORST;
                    count++;
                }
            }
            if (count == 0)
            {
                return(new ItemFairy(CHR));
            }
            BEST = BEST.id == 0 ? WORST : BEST;
            Boolean RA = RAS.Analize();

            (RA ? WORST : BEST).Equip(0x17);
            return(RA ? WORST : BEST);
        }
Exemple #26
0
        private void ApplyRetainPolicy(DirectoryInfo directory)
        {
            FileInfo FI;

            try
            {
                List <FileInfo> FileList = directory.GetFiles("*.log", SearchOption.TopDirectoryOnly).OrderBy(fi => fi.CreationTime).ToList();
                while (FileList.Count >= 30)
                {
                    FI = FileList.First();
                    FI.Delete();
                    FileList.Remove(FI);
                }
            }
            catch
            {
            }
        }
Exemple #27
0
        public byte[] GetFile(string filename)
        {
            FI myFI = FSarch[filename.ToLower()];


            if (myFI.LZSS == 1)
            {
                byte[] fileBuffer = new byte[FsFileLength[(int)myFI.Entry]];
                Array.Copy(fsBuffer, myFI.LocationInFS, fileBuffer, 0, fileBuffer.Length);
                return(LZSS.DecompressAll(fileBuffer, (uint)fileBuffer.Length, (int)myFI.LengthOfUnpackedFile));
            }
            else
            {
                byte[] fileBuffer = new byte[myFI.LengthOfUnpackedFile];
                Array.Copy(fsBuffer, myFI.LocationInFS, fileBuffer, 0, fileBuffer.Length);
                return(fileBuffer);
            }
        }
Exemple #28
0
 public override void run(string[] args)
 {
     using (var communicator = initialize(ref args))
     {
         communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
         Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
         var d = new DI();
         adapter.Add(d, "d");
         adapter.Add(d, "d", "facetABCD");
         var f = new FI();
         adapter.Add(f, "d", "facetEF");
         var h = new HI(communicator);
         adapter.Add(h, "d", "facetGH");
         adapter.Activate();
         serverReady();
         communicator.waitForShutdown();
     }
 }
 public static void SetOrUpdateIdentifier(FI fi, IdentifierType identifierType, string identifier, SymmetryEntities dc)
 {
     if (!string.IsNullOrWhiteSpace(identifier))
     {
         var id = fi.FIIdentifiers.SingleOrDefault(i => i.IdentifierType == identifierType);
         if (id == null)
         {
             fi.FIIdentifiers.Add(new FIIdentifier { IdentifierType = identifierType, Identifier = identifier });
         }
         else
         {
             if (id.Identifier != identifier)
             {
                 id.Identifier = identifier;
                 FIChangeTracking.SetModified(id, dc);
             }
         }
     }
 }
Exemple #30
0
        void HandleRename()
        {
            log.Write("Перемещение: ");
            FileInfo      FI   = null;
            DirectoryInfo DI   = null;
            String        path = CNB.Br.ReadString();

            path = "ServerData/" + path;
            log.Write(path);
            string answer = "$$$";
            string To     = CNB.Br.ReadString();

            log.Write(" " + To);
            if (path.Contains('.'))
            {
                FI = new FileInfo(path);
            }
            else
            {
                DI = new DirectoryInfo(path);
            }
            if (FI != null)
            {
                try
                {
                    FI.MoveTo($"{(FI.DirectoryName == "ServerData" ? "" : FI.DirectoryName)}/{To}");
                    answer = "Файл успешно переименован";
                }
                catch (Exception E) { answer = $"Не удалось переименовать файл - {E.Message}"; }
            }
            else
            {
                try
                {
                    DI.MoveTo($"{DI.Parent.Name}/{To}");
                    answer = "Директория успешно переименована";
                }
                catch (Exception E) { answer = $"Не удалось переименовать директорию - {E.Message}"; }
            }
            CNB.Bw.Write(answer);
            cs.Send(CNB.Ms_Buf);
            log.WriteLine("!");
        }
Exemple #31
0
        void HandleDelete()
        {
            log.Write("Удаление: ");
            FileInfo      FI   = null;
            DirectoryInfo DI   = null;
            String        path = CNB.Br.ReadString();

            path = "ServerData/" + path;
            log.Write(path);
            string answer = "@@@";

            if (path.Contains('.'))
            {
                FI = new FileInfo(path);
            }
            else
            {
                DI = new DirectoryInfo(path);
            }
            if (FI != null)
            {
                try
                {
                    FI.Delete();
                    answer = "Файл успешно удалён";
                }
                catch (Exception E) { answer = $"Не удалось переместить файл - {E.Message}"; }
            }
            else
            {
                try
                {
                    DI.Delete();
                    answer = "Директория успешно удалена";
                }
                catch (Exception E) { answer = $"Не удалось переместить директорию - {E.Message}"; }
            }
            log.Write(answer);
            CNB.Bw.Write(answer);
            cs.Send(CNB.Ms_Buf);
            log.WriteLine("!");
        }
        private void AddMemRow(FI.BusinessObjects.Olap.Object mem)
        {
            //if aggregate, show children instead of agg itself
            FI.BusinessObjects.Olap.CalculatedMemberTemplates.MembersAggregate aggMem=mem as FI.BusinessObjects.Olap.CalculatedMemberTemplates.MembersAggregate;
            if(aggMem!=null)
            {
                foreach(FI.BusinessObjects.Olap.Object childMem in aggMem.Members)
                    this.AddMemRow(childMem); //recursion

                return;
            }

            TableRow tr2=new TableRow();
            TableCell td2= new TableCell();
            td2.Text=mem.Name;
            td2.CssClass="tbl1_C2";
            td2.Wrap=false;
            tr2.Cells.Add(td2);
            tblSlice.Rows.Add(tr2);
        }
Exemple #33
0
            public override void run(string[] args)
            {
                var properties = createTestProperties(ref args);

                properties.setProperty("Ice.Package.Test", "Ice.facets");
                using (var communicator = initialize(properties))
                {
                    communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
                    Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
                    Ice.Object        d       = new DI();
                    adapter.add(d, Ice.Util.stringToIdentity("d"));
                    adapter.addFacet(d, Ice.Util.stringToIdentity("d"), "facetABCD");
                    Ice.Object f = new FI();
                    adapter.addFacet(f, Ice.Util.stringToIdentity("d"), "facetEF");
                    Ice.Object h = new HI(communicator);
                    adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH");
                    adapter.activate();
                    serverReady();
                    communicator.waitForShutdown();
                }
            }
Exemple #34
0
        void ApplyRetainPolicy()
        {
            FileInfo FI;

            try
            {
                List <FileInfo> FileList = new DirectoryInfo(Settings.Folder)
                                           .GetFiles("*.log", SearchOption.TopDirectoryOnly)
                                           .OrderBy(fi => fi.CreationTime)
                                           .ToList();

                while (FileList.Count >= Settings.RetainPolicyFileCount)
                {
                    FI = FileList.First();
                    FI.Delete();
                    FileList.Remove(FI);
                }
            }
            catch
            {
            }
        }
        public void CreateReportTabs(FI.UI.Web.Controls.Tabs.TabView tv, string contentType)
        {
            int reportTabId=0;
            int rootTabId=this.CreateRootTabs(tv , _user.Name , _user.IsLoggedIn , true , PageBase.RootTabsEnum.Storecheck_Reports);

            tv.AddTab(rootTabId , "  List  " , Request.ApplicationPath + "/ReportList.aspx?content=List&rpttype=" + _report.GetTypeCode().ToString() , false , false);

            FI.Common.Data.FIDataTable rptTable=_user.ReportSystem.GetReportHeaders(_report.GetType());
            foreach(System.Data.DataRow row in rptTable.Rows)
            {
                decimal rptId=decimal.Parse(row["id"].ToString());
                bool rptSelected=(bool)row["is_selected"];
                bool rptOpen=(_report!=null && rptId==_report.ID?true:false);
                string rptName=(string)row["name"];
                FI.BusinessObjects.Report.SharingEnum rptSharingStatus=(FI.BusinessObjects.Report.SharingEnum)int.Parse(row["sharing_status"].ToString());
                FI.BusinessObjects.Report.SharingEnum rptMaxSubscriberSharingStatus=(FI.BusinessObjects.Report.SharingEnum)int.Parse(row["max_subscriber_sharing_status"].ToString());

                if(rptSelected)
                {
                    int reportType=_report.GetTypeCode();
                    reportTabId=tv.AddTab(rootTabId , rptName , Request.ApplicationPath + "/ReportList.aspx?content=Load&action=Open&rptid=" + rptId + "&rpttype=" + reportType.ToString() , rptOpen , false);

                    if(rptSharingStatus==FI.BusinessObjects.Report.SharingEnum.SnapshotSubscriber)
                        tv.AddImage(reportTabId,"images/share.gif");
                    else if(rptSharingStatus==FI.BusinessObjects.Report.SharingEnum.InheriteSubscriber)
                        tv.AddImage(reportTabId,"images/share_change.gif");
                    else if(rptMaxSubscriberSharingStatus==FI.BusinessObjects.Report.SharingEnum.SnapshotSubscriber)
                        tv.AddImage(reportTabId,"images/distr.gif");
                    else if(rptMaxSubscriberSharingStatus==FI.BusinessObjects.Report.SharingEnum.InheriteSubscriber)
                        tv.AddImage(reportTabId,"images/distr_change.gif");
                }
            }

            this.AddNotDeliveredTab(tv, reportTabId, (contentType=="NotDelivered"?true:false));
            this.AddNeverDeliveredTab(tv, reportTabId, (contentType=="NeverDelivered"?true:false));
            this.AddDeliveredTab(tv, reportTabId, (contentType=="Delivered"?true:false));
            this.AddDesignTab(tv, reportTabId, (contentType=="" || contentType==null?true:false));
        }
        // TODO: excise the sink specific methods below to an appropriate interface.

        #region Sink specific methods

        /// <summary>Applies the log file retains policy according to options</summary>
        private void ApplyRetainPolicy()
        {
            FileInfo FI;

            try
            {
                List <FileInfo> FileList = new DirectoryInfo(LoggerOptions.Folder)
                                           .GetFiles("*.log", SearchOption.TopDirectoryOnly)
                                           .OrderBy(fi => fi.CreationTime)
                                           .ToList();

                while (FileList.Count >= LoggerOptions.RetainPolicyFileCount)
                {
                    FI = FileList.First();
                    FI.Delete();
                    FileList.Remove(FI);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message); // TODO: consider how to handle low level logging failures e.g. IOExceptions
            }
        }
        /// <summary>
        /// <see cref="IDisposable.Dispose"/>
        /// </summary>
        public override void Dispose()
        {
            if (!(this.w is null))
            {
                this.w.Flush();
                this.output.Flush();

                if (this.cs != null && this.blockSize > 1)
                {
                    Type      T = typeof(CryptoStream);
                    int       i;
                    FieldInfo FI = null;

                    PropertyInfo PI = T.GetProperty("_inputBufferIndex", BindingFlags.Instance | BindingFlags.NonPublic);
                    if (PI is null)
                    {
                        FI = T.GetField("_inputBufferIndex", BindingFlags.Instance | BindingFlags.NonPublic);
                        if (FI is null)
                        {
                            PI = T.GetProperty("_InputBufferIndex", BindingFlags.Instance | BindingFlags.NonPublic);
                            if (PI is null)
                            {
                                FI = T.GetField("_InputBufferIndex", BindingFlags.Instance | BindingFlags.NonPublic);
                            }
                        }
                    }

                    do
                    {
                        if (!(PI is null))
                        {
                            i = (int)PI.GetValue(this.cs);
                        }
                        else if (!(FI is null))
                        {
                            i = (int)FI.GetValue(this.cs);
                        }
 public static Dictionary<string, int> LookupSwaps(FI fixing, List<string> swapTenors, SymmetryEntities dc)
 {
     var result = new Dictionary<string, int>();
     if (swapTenors != null && swapTenors.Count > 0)
     {
         SortedSet<string> normalizedTenors = new SortedSet<string>(swapTenors.Select(t => (Tenor.FromString(t)).ToString()));
         foreach (var swap in FIHelpers.GetDerivativeInstruments(fixing, InstrumentType.IRSwap, dc))
         {
             try
             {
                 string swapTenorString = (Tenor.FromString(swap.Tenor)).ToString(); // normalize
                 if (normalizedTenors.Contains(swapTenorString))
                 {
                     result.Add(swapTenorString, swap.FIID);
                 }
             }
             catch (Exception)
             {
                 SLog.log.WarnFormat("Ignoring instrument {0} as unable to parse tenor {1}", swap.SymmetryCode, swap.Tenor);
             }
         }
     }
     return result;
 }
Exemple #39
0
    public InitialI(Ice.ObjectAdapter adapter)
    {
        _adapter = adapter;
        _b1 = new BI();
        _b2 = new BI();
        _c = new CI();
        _d = new DI();
        _e = new EI();
        _f = new FI(_e);

        _b1.theA = _b2; // Cyclic reference to another B
        _b1.theB = _b1; // Self reference.
        _b1.theC = null; // Null reference.

        _b2.theA = _b2; // Self reference, using base.
        _b2.theB = _b1; // Cyclic reference to another B
        _b2.theC = _c; // Cyclic reference to a C.

        _c.theB = _b2; // Cyclic reference to a B.

        _d.theA = _b1; // Reference to a B.
        _d.theB = _b2; // Reference to a B.
        _d.theC = null; // Reference to a C.
    }
Exemple #40
0
 public static List<FI> GetDerivativeInstruments(FI underlying, InstrumentType instrumentType, SymmetryEntities dc, ThrowBehavior behavior = ThrowBehavior.Throw)
   {
       try
       {
           return dc.FIs.Where(f => f.UnderlyingFIID == underlying.FIID && f.InstrumentType == instrumentType).ToList();
       }
       catch (Exception ex)
       {
           Exceptions.Rethrow("GetDerivativeInstrument", behavior, ex);
       }
       return null;            
   }
Exemple #41
0
 public static Dictionary<IdentifierType, string> GetAllIdentifiers(FI fi, SymmetryEntities dc, ThrowBehavior behavior = ThrowBehavior.Throw)
 {
     try
     {
         return dc.FIIdentifiers.Where(i => i.FIID == fi.FIID).ToList().GroupBy(i => i.IdentifierType, i => i)
             .ToDictionary(i => i.Key, i => i.First().Identifier); // return first id if many found
     }
     catch (Exception ex)
     {
         Exceptions.Rethrow("GetAllIdentifiers", behavior, ex);
     }
     return null;
 }
    protected override void processResponsesFromDataScope(Data.SymmetryEntities dc_, Data.MarketSnap saveToThisSnap_, string marketSnapCode_)
    {
      OutputToCSV(m_resultsFromDataScope);

      if (m_resultsFromDataScope == null) return;

      var config = BondDiscoveryConfig.GetInstance();

      foreach (var response in m_resultsFromDataScope)
      {
        foreach (var row in response.Rows)
        {
          try
          {
            var isin = GetValueFromObjectArray<string>((int)FieldsToReturn.InstrumentID, row, ThrowBehavior.Throw);
            var ric = GetValueFromObjectArray<string>((int)FieldsToReturn.TradewebRIC, row, ThrowBehavior.DontThrow);
            var maturity = GetValueFromObjectArray<DateTime>((int)FieldsToReturn.Maturity, row, ThrowBehavior.Throw);
            var description = GetValueFromObjectArray<string>((int)FieldsToReturn.Description, row, ThrowBehavior.Throw);
            var currency = GetValueFromObjectArray<string>((int)FieldsToReturn.Currency, row, ThrowBehavior.DontThrow);
            var coupon = GetValueFromObjectArray<double>((int)FieldsToReturn.Coupon, row, ThrowBehavior.Throw);
            var auctionDate = GetValueFromObjectArray<DateTime?>((int)FieldsToReturn.AuctionDate, row, ThrowBehavior.DontThrow);
            var effectiveDate = GetValueFromObjectArray<DateTime?>((int)FieldsToReturn.EffectiveDate, row, ThrowBehavior.DontThrow);
            var firstCouponDate = GetValueFromObjectArray<DateTime?>((int)FieldsToReturn.FirstCouponDate, row, ThrowBehavior.DontThrow);
            var issueDate = GetValueFromObjectArray<DateTime?>((int)FieldsToReturn.IssueDate, row, ThrowBehavior.DontThrow);
            var series = GetValueFromObjectArray<string>((int)FieldsToReturn.Series, row, ThrowBehavior.DontThrow);
            var term = GetValueFromObjectArray<int?>((int)FieldsToReturn.Term, row, ThrowBehavior.DontThrow);
            var assetSubType = GetValueFromObjectArray<string>((int)FieldsToReturn.AssetSubType,row,ThrowBehavior.DontThrow);
            var couponClass = GetValueFromObjectArray<string>((int) FieldsToReturn.CouponClassCode, row, ThrowBehavior.DontThrow);
            var countryCode = GetValueFromObjectArray<string>((int) FieldsToReturn.CountryCode, row, ThrowBehavior.DontThrow);
            var inflationFlag = GetValueFromObjectArray<string>((int)FieldsToReturn.InflationProtectedFlag,row,ThrowBehavior.DontThrow);
            var floaterFlag = GetValueFromObjectArray<string>((int)FieldsToReturn.FloaterFlag,row,ThrowBehavior.DontThrow);

            FIChangeTracking.DisableChangeTracking(ref dc_);

            try
            {
              SLog.log.DebugFormat("Adding new bond to database with ISIN={0}", isin);

              // create instrument
              var fi = new FI
              {
                InstrumentType = InstrumentType.Bond,
                Currency = currency,
                DisplayName = description,
                Maturity = maturity,
                SymmetryCode = isin
              };
              dc_.FIs.Add(fi);

              dc_.SaveChanges();

              FIBondHelpers.SetOrUpdateIdentifier(fi, IdentifierType.ISIN, isin, dc_);
              FIBondHelpers.SetOrUpdateIdentifier(fi, IdentifierType.RIC, ric, dc_);
              FIBondHelpers.SetOrUpdateIdentifier(fi, IdentifierType.Bloomberg, string.Format("{0} Govt", isin), dc_);
              dc_.SaveChanges();

              // create bond
              var fiBond = new FIBond
              {
                FIID = fi.FIID,
                Coupon = Convert.ToDecimal(coupon),
                EffectiveDate = effectiveDate,
                FirstCouponDate = firstCouponDate,
                AuctionDate = auctionDate,
                IssueDate = issueDate,
                Series = series,
                Term = term,
                Market = config == null ? assetSubType : config.GetMarket(countryCode, assetSubType),
                IsFloater=floaterFlag!=null && String.Compare("Y", floaterFlag, StringComparison.OrdinalIgnoreCase)==0 ? 1 : 0,
                IsInflationLinked = inflationFlag!=null && String.Compare("Y", inflationFlag, StringComparison.OrdinalIgnoreCase)==0 ? 1 : 0,
              };
              dc_.FIBonds.Add(fiBond);
              dc_.SaveChanges();
            }
            finally
            {
              FIChangeTracking.EnableChangeTracking(ref dc_);
            }

          }
          catch
          {
            continue; // a required value wasn't found
          }



        } // end inner for
      } // end first for

    }
        private void LoadEditControl(FI.UI.Web.Controls.FIDataEdit.ModeEnum Mode)
        {
            //hide control buttons
            this.cellControls.Visible=false;

            //loading edit control
            _ed = (FI.UI.Web.Controls.FIDataEdit)Page.LoadControl("Controls/FIDataEdit.ascx");
            _ed.Mode=Mode;
            _ed.CurrentObject=Session[_sessionItemCurrentObject];
            _ed.PropertiesArray=new string[] {"Logon" , "Password" , "Name" , "Email" , "IsAdmin"};
            _ed.CaptionsArray=new string[] {"Logon" , "Password" , "Name" , "Email" , "IsAdmin"};

            FI.UI.Web.Controls.FieldEditControl logonEdit=(FI.UI.Web.Controls.FieldEditControl)Page.LoadControl("Controls/FieldEditControl.ascx");
            logonEdit.ControlType=FI.UI.Web.Controls.FieldEditControl.ControlTypeEnum.TextBox;
            logonEdit.Width=Unit.Pixel(200);

            FI.UI.Web.Controls.FieldEditControl pwdEdit=(FI.UI.Web.Controls.FieldEditControl)Page.LoadControl("Controls/FieldEditControl.ascx");
            pwdEdit.ControlType=FI.UI.Web.Controls.FieldEditControl.ControlTypeEnum.Password;
            pwdEdit.Width=Unit.Pixel(200);

            FI.UI.Web.Controls.FieldEditControl nameEdit=(FI.UI.Web.Controls.FieldEditControl)Page.LoadControl("Controls/FieldEditControl.ascx");
            nameEdit.ControlType=FI.UI.Web.Controls.FieldEditControl.ControlTypeEnum.TextBox;
            nameEdit.Width=Unit.Pixel(200);

            FI.UI.Web.Controls.FieldEditControl emailEdit=(FI.UI.Web.Controls.FieldEditControl)Page.LoadControl("Controls/FieldEditControl.ascx");
            emailEdit.ControlType=FI.UI.Web.Controls.FieldEditControl.ControlTypeEnum.TextBox;
            emailEdit.Width=Unit.Pixel(300);

            FI.UI.Web.Controls.FieldEditControl adminEdit=(FI.UI.Web.Controls.FieldEditControl)Page.LoadControl("Controls/FieldEditControl.ascx");
            adminEdit.ControlType=FI.UI.Web.Controls.FieldEditControl.ControlTypeEnum.DropDownList;
            ListItem item1=new ListItem("False" , "False");
            ListItem item2=new ListItem("True" , "True");
            adminEdit.ListItems=new ListItem[]{item1, item2};
            adminEdit.Width=Unit.Pixel(200);

            _ed.ControlsArray=new FI.UI.Web.Controls.FieldEditControl[]{logonEdit , pwdEdit , nameEdit , emailEdit , adminEdit};

            _ed.LabelsWidth=150;

            if(Mode==FI.UI.Web.Controls.FIDataEdit.ModeEnum.Insert)
                _ed.InsertButtonClick += new System.Web.UI.WebControls.CommandEventHandler(this.FIDataEdit_InsertButtonClick);
            else if(Mode==FI.UI.Web.Controls.FIDataEdit.ModeEnum.Edit)
                _ed.UpdateButtonClick += new System.Web.UI.WebControls.CommandEventHandler(this.FIDataEdit_UpdateButtonClick);
            else if(Mode==FI.UI.Web.Controls.FIDataEdit.ModeEnum.Delete)
                _ed.DeleteButtonClick += new System.Web.UI.WebControls.CommandEventHandler(this.FIDataEdit_DeleteButtonClick);

            _ed.CancelButtonClick += new System.Web.UI.WebControls.CommandEventHandler(this.FIDataEdit_CancelButtonClick);

            ControlPanel.Controls.Add(_ed);

            //end loading edit control
        }
        public static FI GetOrCreateMLPBond(MLPBondInstrument instrument, SymmetryEntities dc, ThrowBehavior behavior = ThrowBehavior.Throw)
        {
            if(string.IsNullOrWhiteSpace(instrument.ISIN))
            {
                return null;
            }
            FIChangeTracking.DisableChangeTracking(ref dc);
            FI fi = null;
            try
            {
                // create instrument
                fi = FIHelpers.GetFIBySymmetryCode(instrument.ISIN, dc, behavior);
                if (fi == null)
                {
                    fi = new FI
                    {
                        InstrumentType = InstrumentType.Bond,
                        Currency = null,
                        DisplayName = instrument.MlpTicker,
                        Maturity = DateTime.FromOADate(instrument.Maturity),
                        SymmetryCode = instrument.ISIN
                    };
                    dc.FIs.Add(fi);
                }
                else
                {
                    var newCcy = GetBondCurrencyForBbTicker(instrument.BbTicker);
                    if (!string.IsNullOrEmpty(newCcy) && fi.Currency != newCcy)
                    {
                        fi.Currency = newCcy;
                        FIChangeTracking.SetModified(fi, dc);
                    }
                }
                dc.SaveChanges();

                // set identifiers
                SetOrUpdateIdentifier(fi, IdentifierType.ISIN, instrument.ISIN, dc);
                SetOrUpdateIdentifier(fi, IdentifierType.CUSIP, instrument.CUSIP, dc);
                SetOrUpdateIdentifier(fi, IdentifierType.MLPCode, instrument.MlpTicker, dc);
                SetOrUpdateIdentifier(fi, IdentifierType.RIC, instrument.RIC, dc);
                SetOrUpdateIdentifier(fi, IdentifierType.Bloomberg, instrument.ISIN + " Govt", dc);
                dc.SaveChanges();

                // create bond
                var fiBond = dc.FIBonds.SingleOrDefault(b => b.FIID == fi.FIID);
                if (fiBond == null)
                {
                    fiBond = new FIBond
                    {
                        FIID = fi.FIID,
                        Market = instrument.GetMarket(),
                        Coupon = instrument.Coupon.HasValue ? instrument.Coupon.Value : 0,
                        EffectiveDate = DateTime.FromOADate(instrument.EffectiveDate),
                        FirstCouponDate = DateTime.FromOADate(instrument.FirstCouponDate),
                        IssueDate = DateTime.FromOADate(instrument.IssueDate),
                        Series = instrument.Series,
                        Term = instrument.Term
                    };
                    dc.FIBonds.Add(fiBond);
                }
                else
                {
                    var coupon = instrument.Coupon.HasValue ? instrument.Coupon.Value : 0;
                    var effectiveDate = DateTime.FromOADate(instrument.EffectiveDate);
                    var firstCouponDate = DateTime.FromOADate(instrument.FirstCouponDate);
                    var issueDate = DateTime.FromOADate(instrument.IssueDate);

                    if (fiBond.Market != instrument.GetMarket() ||
                        fiBond.Coupon != coupon ||
                        fiBond.EffectiveDate != effectiveDate ||
                        fiBond.FirstCouponDate != firstCouponDate ||
                        fiBond.IssueDate != issueDate ||
                        fiBond.Series != instrument.Series ||
                        fiBond.Term != instrument.Term)
                    {
                        fiBond.Market = instrument.GetMarket();
                        fiBond.Coupon = coupon;
                        fiBond.EffectiveDate = effectiveDate;
                        fiBond.FirstCouponDate = firstCouponDate;
                        fiBond.IssueDate = issueDate;
                        fiBond.Series = instrument.Series;
                        fiBond.Term = instrument.Term;
                        FIChangeTracking.SetModified(fiBond, dc);
                    }                   
                }
                dc.SaveChanges();
            }
            catch (Exception ex)
            {
                Exceptions.Rethrow("GetOrCreateMLPBond", behavior, ex);
            }
            finally
            {
                FIChangeTracking.EnableChangeTracking(ref dc);
            }
            return fi;
        }
        private void ConvertEnums(ref FI.Common.Data.FIDataTable dt)
        {
            if(dt==null)
                return;

            System.Data.DataColumn col=dt.Columns["Format"];
            if(col==null)
                return;

            // set data
            System.Data.DataColumn newCol=dt.Columns.Add("_" + col.ColumnName, typeof(string));
            foreach(System.Data.DataRow dr in dt.Rows)
                if(dr[col]!=DBNull.Value)
                    dr[newCol]=Enum.GetName(typeof(Report.ExportFormat), dr[col]);

            // replace cols
            dt.Columns.Remove(col);
            newCol.ColumnName=col.ColumnName;
        }
Exemple #46
0
        private void LoadData(FI.Common.Data.FIDataTable table)
        {
            System.Data.DataRow row=table.Rows[0];
            if(table.Rows.Count==0)
                throw new Exception("Cannot load data");

            this._logon=(string)row["Logon"];
            this._password=(string)row["Password"];
            this._passwordTimestamp=(DateTime)row["PasswordTimestamp"];
            this._name=(string)row["Name"];
            this._email=(string)row["Email"];
            this._ipAddress=(string)row["ConnectionAddress"];
            this._sessionId=(string)row["SessionId"];
            this._companyId=(decimal)row["CompanyId"];
            this._isLoggedIn=(bool)row["IsLoggedIn"];
            this._companyNameShort=(string)row["CompanyNameShort"];
            this._companyNameLong=(string)row["CompanyNameLong"];
            this._isAdmin=(bool)row["IsAdmin"];
            this._oltpDatabase=(string)row["OltpDatabase"];
            //this._oltpDatabase=(string)row["OltpDatabase"];
            this.CssStyle=(byte)(row["CssStyle"]==DBNull.Value ? (byte)0 : row["CssStyle"]);

            this._isAdminAudit=this._isAdmin;
        }
Exemple #47
0
        public static FI GetOrCreateFiViaIdentifier(string identifier, InstrumentType insttype, string currency, DateTime maturity, SymmetryEntities dc, ThrowBehavior behavior = ThrowBehavior.Throw)
        {
            if (string.IsNullOrWhiteSpace(identifier))
            {
                return null;
            }
            FIChangeTracking.DisableChangeTracking(ref dc);
            FI fi = null;
            try
            {
                // create instrument
                fi = GetFIBySymmetryCode(identifier, dc, behavior);
                if (fi == null)
                {
                    fi = new FI
                    {
                        InstrumentType = insttype,
                        Currency = currency,
                        DisplayName = identifier,
                        Maturity = maturity,
                        SymmetryCode = identifier
                    };
                    dc.FIs.Add(fi);
                }

                dc.SaveChanges();
            }
            catch (Exception ex)
            {
                Exceptions.Rethrow("GetOrCreateFiViaIdentifier", behavior, ex);
            }
            finally
            {
                FIChangeTracking.EnableChangeTracking(ref dc);
            }
            return fi;
        }
        private void LoadEditControl(FI.UI.Web.Controls.FIDataEdit.ModeEnum Mode)
        {
            //hide control buttons
            this.cellControls.Visible=false;

            //loading edit control
            _ed = (FI.UI.Web.Controls.FIDataEdit)Page.LoadControl("Controls/FIDataEdit.ascx");
            _ed.Mode=Mode;
            _ed.CurrentObject=Session[_sessionItemCurrentObject];
            _ed.PropertiesArray=new string[] {"Name" , "EMail" , "DistributionFormat"};
            _ed.CaptionsArray=new string[] {"Contact Name" , "Contact EMail" , "Distribution Format"};

            FI.UI.Web.Controls.FieldEditControl nameEdit=(FI.UI.Web.Controls.FieldEditControl)Page.LoadControl("Controls/FieldEditControl.ascx");
            nameEdit.ControlType=FI.UI.Web.Controls.FieldEditControl.ControlTypeEnum.TextBox;
            nameEdit.Width=Unit.Pixel(200);

            FI.UI.Web.Controls.FieldEditControl emailEdit=(FI.UI.Web.Controls.FieldEditControl)Page.LoadControl("Controls/FieldEditControl.ascx");
            emailEdit.ControlType=FI.UI.Web.Controls.FieldEditControl.ControlTypeEnum.TextBox;
            emailEdit.Width=Unit.Pixel(400);

            FI.UI.Web.Controls.FieldEditControl distrEdit=(FI.UI.Web.Controls.FieldEditControl)Page.LoadControl("Controls/FieldEditControl.ascx");
            distrEdit.ControlType=FI.UI.Web.Controls.FieldEditControl.ControlTypeEnum.DropDownList;
            ListItem item1=new ListItem(FI.BusinessObjects.Contact.DistributionFormatEnum.MessageBody.ToString(),FI.BusinessObjects.Contact.DistributionFormatEnum.MessageBody.ToString());
            ListItem item2=new ListItem(FI.BusinessObjects.Contact.DistributionFormatEnum.Attachment.ToString(),FI.BusinessObjects.Contact.DistributionFormatEnum.Attachment.ToString());
            ListItem item3=new ListItem(FI.BusinessObjects.Contact.DistributionFormatEnum.Body_And_Attachment.ToString(),FI.BusinessObjects.Contact.DistributionFormatEnum.Body_And_Attachment.ToString());
            distrEdit.ListItems=new ListItem[]{item1, item2 , item3};
            distrEdit.Width=Unit.Pixel(200);

            _ed.ControlsArray=new FI.UI.Web.Controls.FieldEditControl[]{nameEdit , emailEdit , distrEdit};

            _ed.LabelsWidth=150;

            if(Mode==FI.UI.Web.Controls.FIDataEdit.ModeEnum.Insert)
                _ed.InsertButtonClick += new System.Web.UI.WebControls.CommandEventHandler(this.FIDataEdit_InsertButtonClick);
            else if(Mode==FI.UI.Web.Controls.FIDataEdit.ModeEnum.Edit)
                _ed.UpdateButtonClick += new System.Web.UI.WebControls.CommandEventHandler(this.FIDataEdit_UpdateButtonClick);
            else if(Mode==FI.UI.Web.Controls.FIDataEdit.ModeEnum.Delete)
                _ed.DeleteButtonClick += new System.Web.UI.WebControls.CommandEventHandler(this.FIDataEdit_DeleteButtonClick);

            _ed.CancelButtonClick += new System.Web.UI.WebControls.CommandEventHandler(this.FIDataEdit_CancelButtonClick);

            ControlPanel.Controls.Add(_ed);

            //end loading edit control
        }
			public EDItem(FI databaseObject_, SymmetryEntities dc_, MarketSnap snap_, QuoteSource source_)
			{
				Underlying = databaseObject_;
				Snap = snap_;


				var px = QuoteHelpers.GetQuoteValue(snap_.MarketSnapID, source_.QuoteSourceID, databaseObject_.FIID, QuoteValueType.Price, dc_, ThrowBehavior.DontThrow);

				if (px.HasValue)
				{
					ClosePrice = Convert.ToDouble(px.Value);

					SLog.log.DebugFormat("{0} px = {1}", databaseObject_.SymmetryCode, ClosePrice);

					var opt1Strike = ClosePrice - (ClosePrice % 0.125);
					OptionBelowPrice = new EDOptionItem(databaseObject_, opt1Strike, ClosePrice, Underlying, snap_.ValueDate);

					SLog.log.DebugFormat("{0} belowStrikeToQueryFor = {1}", databaseObject_.SymmetryCode, opt1Strike);

					var opt2Strike = opt1Strike + 0.125;
					OptionAbovePrice = new EDOptionItem(databaseObject_, opt2Strike, ClosePrice, Underlying, snap_.ValueDate);

					SLog.log.DebugFormat("{0} aboveStrikeToQueryFor = {1}", databaseObject_.SymmetryCode, opt2Strike);
				}
				else
				{
					SLog.log.ErrorFormat("No price saved for {0} for marketSnapID = {1}", databaseObject_.SymmetryCode,
						snap_.MarketSnapID);
				}
			}
        private int AddDeliveredTab(FI.UI.Web.Controls.Tabs.TabView tv, int parentId, bool isActive)
        {
            string capt=null;
            if(_report.DataSource==FI.BusinessObjects.StorecheckReport.DataSourceEnum.Deliveries)
                capt="  Delivered Within " + _report.Days + " Days ";
            else if(_report.DataSource==FI.BusinessObjects.StorecheckReport.DataSourceEnum.Sales)
                capt="  Sold Within " + _report.Days + " Days ";
            else
                capt="  Transactions Within " + _report.Days + " Days ";

            return tv.AddTab(parentId , capt , Request.ApplicationPath + "/StorecheckReport/Table.aspx?content=Delivered", isActive , false);
        }
			public EDOptionItem(FI security_, double strikePrice_, double futurePrice_, FI future_, DateTime markdate_)
			{
				Match m = regex.Match(security_.SymmetryCode);
				FuturePrice = futurePrice_;
				Future = future_;
				MarkDate = markdate_;

				if (!m.Success)
					return;

				Strike = strikePrice_;
				Proportion = 1 - (Math.Abs(strikePrice_ - futurePrice_) / 0.125);

				var monthS = m.Groups["MonthCode"].Value;
				var yearS = m.Groups["YearCode"].Value;

				var month = (MonthCode)Enum.Parse(typeof(MonthCode), monthS);
				var year = int.Parse(yearS);
				var callMonth = (MonthCodeCall)((int)month);

				ReutersTicker = string.Format("2ED{0}{1}{2}",
					strikePrice_.ToString("####.####").Replace(".", string.Empty),
					callMonth.ToString(),
					year.ToString());
			}
 public FI[] GetFI()
 {
     FI[] FileIndex = new FI[FileList.Length];
     string flPath = $"{System.IO.Path.GetDirectoryName(_path)}\\{System.IO.Path.GetFileNameWithoutExtension(_path)}.fi";
     using (FileStream fs = new FileStream(flPath, FileMode.Open, FileAccess.Read))
         using (BinaryReader br = new BinaryReader(fs))
             for (int i = 0; i <= FileIndex.Length-1; i++)
             {
                 FileIndex[i].LengthOfUnpackedFile = br.ReadUInt32();
                 FileIndex[i].LocationInFS = br.ReadUInt32();
                 FileIndex[i].LZSS = br.ReadUInt32();
             }
     return FileIndex;
 }
 protected int CreateRootTabs(FI.UI.Web.Controls.Tabs.TabView tv, string UserName, bool UserLoggedIn, bool NavigationEnabled, RootTabsEnum ActiveTab)
 {
     int ret=_CreateRootTabs(tv, UserName, UserLoggedIn, NavigationEnabled, ActiveTab);
     tv.CssStyleNum=_user.CssStyle;
     return ret;
 }