public CashSelectForm(Form parent, CashList list)
            : base(true, parent, list)
        {
            InitializeComponent();
            _view_mode = molView.Select;

            _action_result = DialogResult.Cancel;
        }
        public override void UpdateList()
        {
            switch (_current_action)
            {
            case molAction.Add:
                if (_entity == null)
                {
                    return;
                }
                List.AddItem(_entity.GetInfo(false));
                if (FilterType == IFilterType.Filter)
                {
                    CashList listA = CashList.GetList(_filter_results);
                    listA.AddItem(_entity.GetInfo(false));
                    _filter_results = listA.GetSortedList();
                }
                break;

            case molAction.Edit:
            case molAction.Lock:
            case molAction.Unlock:
                if (_entity == null)
                {
                    return;
                }
                ActiveItem.CopyFrom(_entity);
                break;

            case molAction.Delete:
                if (ActiveItem == null)
                {
                    return;
                }
                List.RemoveItem(ActiveOID);
                if (FilterType == IFilterType.Filter)
                {
                    CashList listD = CashList.GetList(_filter_results);
                    listD.RemoveItem(ActiveOID);
                    _filter_results = listD.GetSortedList();
                }
                break;
            }

            RefreshSources();
            if (_entity != null)
            {
                Select(_entity.Oid);
            }
            _entity = null;
        }
        public CashMngForm(bool isModal, Form parent, CashList list)
            : base(isModal, parent, list)
        {
            InitializeComponent();

            SetView(molView.Normal);

            // Parche para poder abrir el formulario en modo diseño y no perder la configuracion de columnas
            DatosLocal_BS    = Datos;
            Tabla.DataSource = DatosLocal_BS;

            SetMainDataGridView(Tabla);
            Datos.DataSource = CashList.NewList().GetSortedList();
            SortProperty     = Codigo.DataPropertyName;
        }
        protected override void RefreshMainData()
        {
            PgMng.Grow(string.Empty, "Caja");

            _selectedOid = ActiveOID;

            switch (DataType)
            {
            case EntityMngFormTypeData.Default:
                List = CashList.GetList(false);
                break;

            case EntityMngFormTypeData.ByParameter:
                _sorted_list = List.GetSortedList();
                break;
            }
            PgMng.Grow(string.Empty, "Lista de Cajas");
        }
        protected override void SetCajaAction()
        {
            CashList       list = CashList.GetList(false);
            CashSelectForm form = new CashSelectForm(this, list);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                CashInfo caja = form.Selected as CashInfo;

                if (_caja != null)
                {
                    _caja.CloseSession();
                }

                _caja = Cash.Get(caja.Oid, false);

                UpdateSaldo();
            }
        }
Пример #6
0
        public Dictionary <string, BsonValue> RetrieveDict()
        {
            //name of my collection
            var documents  = MongoCollection.Find(new BsonDocument()).ToList();
            var dictionary = new Dictionary <string, BsonValue>();

            List <Dictionary <string, BsonValue> > dictList = new List <Dictionary <string, BsonValue> >();

            foreach (BsonDocument bsons in documents)
            {
                var internalDict = new Dictionary <string, BsonValue>();
                Recurse(bsons, internalDict);
                dictList.Add(internalDict);
            }

            //var valTest = dictList[3]["readResults"][0]["lines"][0]["text"].RawValue;
            int  i     = 0;
            bool total = false;

            foreach (Dictionary <string, BsonValue> keyValuePairs in dictList)
            {
                List <string> simplifiedDict     = new List <string>();
                List <string> simplifiedCashDict = new List <string>();
                while (true)
                {
                    try
                    {
                        if (i == 0)
                        {
                            var dateTime = keyValuePairs["createdDateTime"].RawValue;
                            simplifiedDict.Add((string)dateTime);
                            simplifiedCashDict.Add((string)dateTime);
                            total = false;
                        }
                        var valTest = keyValuePairs["readResults"][0]["lines"][i++]["text"].RawValue;
                        simplifiedDict.Add((string)valTest);
                        string simpVal = valTest.ToString();
                        if (simpVal.Contains("$"))
                        {
                            simplifiedCashDict.Add(RemoveSpecialCharacters((string)valTest));
                            total = false;
                        }
                        else if (simpVal.Contains("TOTAL") || simpVal.Contains("Total"))
                        {
                            total = true;
                        }
                        else if (total)
                        {
                            simplifiedCashDict.Add(RemoveSpecialCharacters((string)valTest));
                            total = false;
                        }
                    }
                    catch (Exception e)
                    {
                        TextsList.Add(simplifiedDict);
                        if (simplifiedCashDict.Count > 1)
                        {
                            CashList.Add(simplifiedCashDict);
                        }
                        i = 0;
                        break;
                    }
                }
            }



            //Console.WriteLine("The list of databases are:");

            //foreach (BsonDocument doc in documents)
            //{
            //    Console.WriteLine(doc.ToString());
            //}
            return(dictionary = dictList.ElementAt <Dictionary <string, BsonValue> >(0));
        }