Example #1
0
 private void SaveCompleted(ObservableCollection <TblStoreCommission> Result, Exception Error)
 {
     if (Error != null)
     {
         MessageBox.Show(Helper.GetInnerExceptionMessage(Error));
         Loading = false;
         return;
     }
     else
     {
         MessageBox.Show(strings.SavedMessage);
     }
     foreach (var item in Result)
     {
         TblStoreCommission savedRow = new TblStoreCommission();
         //if (outindex >= 0 && MainRowList.Count > outindex)
         //    savedRow = MainRowList.ElementAt(outindex);
         savedRow = MainRowList.FirstOrDefault(s => s.Tblstore == item.Tblstore);
         if (savedRow != null)
         {
             savedRow.InjectFrom(Result);
             savedRow.TblStore1 = StoreList.FirstOrDefault(b => b.iserial == savedRow.Tblstore);
         }
     }
     DeleteCommand.RaiseCanExecuteChanged();
     IsNewChanged();
     Loading = false;
 }
Example #2
0
        public static async Task Main(string[] args)
        {
            if (args.Length != 1 || string.IsNullOrWhiteSpace(args[0]) || !Regex.IsMatch(args[0], @"^\d+$"))
            {
                Console.WriteLine("Required: ZIP Code");
            }

            if (!Regex.IsMatch(args[0], @"^\d+$") && !Regex.IsMatch(args[0], @"^\d+-\d+$"))
            {
                Console.WriteLine("Required: ZIP Code");
            }

            var stores = await StoreList.Fetch(args[0]);

            if (stores == null || !stores.Any())
            {
                throw new InvalidOperationException($"No stores found for zip code {args[0]}");
            }

            var ad = await Welcome.Fetch(stores[0]);

            var subs = ad.Rollovers.Where(a => a.Title.Contains("Whole Sub")).ToList();

            Console.WriteLine($"Subs For Sale In {args[0]} From {ad.SaleStartDate.ToShortDateString()} To {ad.SaleEndDate.ToShortDateString()}");
            Console.WriteLine("--------------------------------------------------");
            foreach (var sub in subs)
            {
                Console.WriteLine($"{sub.Title} - {sub.Deal}");
            }
        }
    public void MyTest()
    {
        var characters = new List <IDebugPrints>();

        characters.Add(new Character());
        var sl = new StoreList(characters);
    }
Example #4
0
        public override IEnumerable <StoreDictionary> Get(string collection, StoreList columns, StoreDictionary where, int limit)
        {
            List <StoreDictionary> records = new List <StoreDictionary>();
            JSON names = GetRecords(collection);

            for (int i = 0; i < names.length; i++)
            {
                if (limit == 0)
                {
                    break;
                }
                string name = names[i].stringValue;
                if (IsRecordIncluded(collection, name, where))
                {
                    StoreDictionary record = new StoreDictionary();
                    foreach (string column in columns)
                    {
                        string value = Get("collections." + collection + "." + name + "." + column);
                        record.Add(column, value);
                    }
                    records.Add(record);
                    limit--;
                }
            }
            return(records);
        }
Example #5
0
        /// <summary>
        /// Asigna los datos a los origenes de datos secundarios
        /// </summary>
        public override void RefreshSecondaryData()
        {
            Datos_Almacen.DataSource = StoreList.GetList(false);
            Bar.Grow(string.Empty, "Almacenes");

            //Almacen_CB.SelectedItem = (Datos_Almacen.DataSource as StoreList).GetItem(EntityInfo.OidAlmacen);
        }
Example #6
0
        /// <summary>
        /// Sự kiện AfterEdit của GridPanel1, xảy ra khi người dùng thay đổi giá trị combobox trên Grid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void AfterEdit_Event(object sender, DirectEventArgs e)
        {
            JsonObject data = JSON.Deserialize <JsonObject>(e.ExtraParams["record"]);

            foreach (StoreDaTa store in StoreList)
            {
                StoreDaTa _s = StoreList.Where(p => p.ColumnID == store.MasterColumnID).FirstOrDefault();
                if (_s == null)
                {
                    continue;
                }
                if (!string.IsNullOrEmpty(store.WhereFilter))
                {
                    store.WhereFilter = string.Format(store.WhereFilter, "N'" + data[_s.ColumnName] + "'");
                }
                else
                {
                    store.WhereFilter = "1=1";
                }
                string sql = string.Format("select top 1 {0} from {1} where {2}", store.DisplayField, store.TableName,
                                           store.WhereFilter);
                DataTable Data = DataHandler.GetInstance().ExecuteDataTable(sql);
                if (Data.Rows.Count != 0)
                {
                    this.Store1.UpdateRecordField(e.ExtraParams["id"], store.ColumnName,
                                                  Data.Rows[0][store.DisplayField].ToString());
                }
            }
        }
Example #7
0
        public App(string filePath)
        {
            FilePath = filePath;
            InitializeComponent();
            StoreList storeList = new StoreList();

            MainPage = new TabbedMain();
        }
        public AlmacenSelectForm(Form parent, StoreList lista)
            : base(true, parent, lista)
        {
            InitializeComponent();
            _view_mode = molView.Select;

            _action_result = DialogResult.Cancel;
        }
Example #9
0
        public App()
        {
            InitializeComponent();
            StoreList storeList = new StoreList();

            MainPage = new TabbedMain();
            Device.SetFlags(new string[] { "Expander_Experimental", "Shapes_Experimental" });
        }
Example #10
0
 private Dictionary <string, int> cachedBalance = new Dictionary <string, int>();       //name -> balance
 public Countables32(string table) : base(table)
 {
     if (cachedBalance.Count <= 0)
     {
         StoreList columns = new StoreList(nameColumn, balanceColumn);
         IEnumerable <StoreDictionary> records = GetMultiple(columns, null, -1);
         Cache(records);
     }
 }
Example #11
0
 private Dictionary <string, int> cachedLevel = new Dictionary <string, int>();       //group -> level
 public Upgradables(string table) : base(table)
 {
     if (cachedLevel.Count <= 0)
     {
         StoreList columns = new StoreList(nameColumn, groupColumn, equippedColumn, levelColumn);
         IEnumerable <StoreDictionary> records = GetMultiple(columns, null, -1);
         Cache(records);
     }
 }
 private void SearchStoreMethod()
 {
     if (!string.IsNullOrWhiteSpace(SearchStore))
     {
         SearchStoreResultList = new ObservableCollection <StoresSet>(StoreList.Where(s => s.StoreName.ToLower().Contains(SearchStore.ToLower()) || s.StoreNumber.ToString().Contains(SearchStore)));
     }
     else
     {
         SearchStoreResultList.Clear();
     }
 }
Example #13
0
        public override bool CreateCollection(string name, StoreList columns)
        {
            if (CollectionExists(name))
            {
                return(false);
            }
            AddCollection(name);
            string columnsJSON = columns.ToJSON().ToString();

            Set("collections." + name, "[]");
            Set("meta.collections." + name, columnsJSON);
            return(true);
        }
Example #14
0
        public override void UpdateList()
        {
            switch (_current_action)
            {
            case molAction.Add:
            case molAction.Copy:
                if (_entity == null)
                {
                    return;
                }
                List.AddItem(_entity.GetInfo(false));
                if (FilterType == IFilterType.Filter)
                {
                    StoreList listA = StoreList.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)
                {
                    StoreList listD = StoreList.GetList(_filter_results);
                    listD.RemoveItem(ActiveOID);
                    _filter_results = listD.GetSortedList();
                }
                break;
            }

            RefreshSources();
            if (_entity != null)
            {
                Select(_entity.Oid);
            }
            _entity = null;
        }
Example #15
0
        public StoreSearch()
        {
            InitializeComponent();

            this.OneWayBind(ViewModel, x => x.IsLoading, x => x.Loading.IsRunning)
            .DisposeWith(PageDisposables);

            this.BindCommand(ViewModel, x => x.Search, x => x.Search, x => x.SearchText, nameof(Search.Clicked))
            .DisposeWith(PageDisposables);

            this.WhenAnyValue(x => x.ViewModel)
            .Where(x => x != null)
            .Select(x => Unit.Default)
            .InvokeCommand(this, x => x.ViewModel.InitializeData)
            .DisposeWith(PageDisposables);

            this.WhenAnyValue(x => x.ViewModel.Stores)
            .Where(x => x != null)
            .BindTo(this, x => x.StoreList.ItemsSource)
            .DisposeWith(PageDisposables);

            this.WhenAnyValue(x => x.ViewModel.StoreCategories)
            .Where(x => x != null)
            .BindTo(this, x => x.Categories.ItemsSource)
            .DisposeWith(PageDisposables);

            SearchBar
            .Events()
            .TextChanged
            .Throttle(TimeSpan.FromMilliseconds(250), RxApp.TaskpoolScheduler)
            .Where(x => x?.OldTextValue?.Length > 0 && x.NewTextValue?.Length == 0)
            .Select(x => x.NewTextValue)
            .ObserveOn(RxApp.MainThreadScheduler)
            .InvokeCommand(this, x => x.ViewModel.Search)
            .DisposeWith(PageDisposables);

            StoreList
            .Events()
            .ItemTapped
            .Select(x => x.Item)
            .Cast <StoreCardViewModel>()
            .InvokeCommand(this, x => x.ViewModel.Details)
            .DisposeWith(PageDisposables);

            StoreList
            .Events()
            .ItemSelected
            .Subscribe(item => StoreList.SelectedItem = null)
            .DisposeWith(PageDisposables);
        }
    protected override void DataBind(bool raiseOnDataBinding)
    {
        base.DataBind(raiseOnDataBinding);

        if (CustomerId == 0 || CustomerStoreId == 0)
        {
            this.Visible = false;
            return;
        }

        var stores = Store.GetStoreList();

        if (AppLogic.GlobalConfigBool("AllowCustomerFiltering") || stores.Count() < 2)
        {
            MultiStorePanel.Visible = false;
            SingleStoreLink.Visible = true;

            if (CustomerStoreId != AppLogic.StoreID())
            {
                SingleStoreLink.Attributes.Add("data-confirm", "admin.customer.ConfirmStoreImpersonateSwitch".StringResource());
            }

            SingleStoreLink.NavigateUrl = UrlHelper.AdminLinkForStore(
                adminPage: string.Format("impersonationhandler.axd?customerId={0}", CustomerId),
                storeId: CustomerStoreId);
        }
        else
        {
            MultiStorePanel.Visible = true;
            SingleStoreLink.Visible = false;
            StoreList.DataSource    = stores
                                      .Select(s => new
            {
                Name = string.Concat(
                    s.Name,
                    AppLogic.StoreID() == s.StoreID
                                                        ? " (Current)"
                                                        : ""),
                Url = UrlHelper.AdminLinkForStore(
                    adminPage: string.Format("impersonationhandler.axd?customerId={0}", CustomerId),
                    storeId: s.StoreID),
                CustomerStoreID = s.StoreID,
                Confirm         = AppLogic.StoreID() == s.StoreID
                                                ? ""
                                                : "admin.customer.ConfirmStoreImpersonateSwitch".StringResource()
            });

            StoreList.DataBind();
        }
    }
Example #17
0
        public AlmacenMngForm(bool isModal, Form parent, StoreList list)
            : base(isModal, parent, list)
        {
            InitializeComponent();
            SetView();

            // 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 = StoreList.NewList().GetSortedList();
            SortProperty     = Nombre.DataPropertyName;
        }
Example #18
0
        public StoreCommissionViewModel() : base(PermissionItemName.StoreCommission)
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                MainRowList = new ObservableCollection <TblStoreCommission>();

                BankDepositClient.GetLookUpStoreCompleted += (s, e) =>
                {
                    StoreList = e.Result;
                    foreach (var item in MainRowList)
                    {
                        item.TblStore1 = StoreList.FirstOrDefault(st => st.iserial == item.Tblstore);
                    }
                };

                GetComboData();
                BankDepositClient.GetStoreCommissionCompleted += (s, sv) =>
                {
                    MainRowList.Clear();
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblStoreCommission();

                        newrow.InjectFrom(row);
                        newrow.TblStore1 = StoreList.FirstOrDefault(st => st.iserial == row.Tblstore);
                        MainRowList.Add(newrow);
                    }
                    Loading = false;
                    if (SearchWindow != null)
                    {
                        SearchWindow.Loading = false;
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };
                BankDepositClient.UpdateOrInsertStoreCommissionCompleted += (s, x) => SaveCompleted(x.Result, x.Error);
                FilterCommand = new RelayCommand <FilterEvent>((e) => {
                    string filter;
                    Dictionary <string, object> valueObjecttemp;
                    GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
                    Filter        = filter;
                    ValuesObjects = valueObjecttemp;
                    GetMaindata();
                });
                GetMaindata();
                //AddNewMainRow(false);
            }
        }
Example #19
0
        public override IEnumerable <StoreDictionary> Get(string collection, StoreList columns, StoreDictionary where, int limit)
        {
            string columnsJSON  = columns.ToJSON().ToString();
            string whereJSON    = where != null ? where.ToJSON().ToString() : "";
            string recordsJSON  = native.CallStatic <string>("get", collection, columnsJSON, whereJSON, limit < 0 ? null : limit + "");
            JSON   recordsArray = JSON.Parse(recordsJSON);

            StoreDictionary[] records = new StoreDictionary[recordsArray.length];
            for (int i = 0; i < records.Length; i++)
            {
                records[i] = new StoreDictionary(recordsArray[i]);
            }
            return(records);
        }
Example #20
0
    static void Main(string[] args)
    {
        List <Character> characters = new List <Character>();

        characters.Add(new Character {
            Info = "Character 1"
        });
        characters.Add(new Character {
            Info = "Character 2"
        });
        // And I want to pass that list
        StoreList sl = new StoreList(characters);

        sl.ShowAllInfo();
        Console.ReadKey();
    }
Example #21
0
        public void syncwelFareStore()
        {
            var interfaceName      = "syncwelFareStore";
            var loggingSessionInfo = BaseService.GetLoggingSession();
            var storeService       = new StoreBLL(loggingSessionInfo);

            var dsStores = new DataSet();
            var stores   = new StoreList();

            stores.storelist = new List <Store>();

            //更新接口同步表
            var queryList = UpdateInterfaceTimestamp(interfaceName, loggingSessionInfo);

            if (queryList != null && queryList.Length > 0)
            {
                //存在,根据日期条件查询
                dsStores = storeService.GetSynWelfareStoreList(queryList.FirstOrDefault().LatestTime.ToString());
            }
            else
            {
                //不存在,查询所有数据
                dsStores = storeService.GetSynWelfareStoreList(string.Empty);
            }

            if (dsStores != null && dsStores.Tables.Count > 0 && dsStores.Tables[0].Rows.Count > 0)
            {
                stores.storelist = DataTableToObject.ConvertToList <Store>(dsStores.Tables[0]);

                //上传数据
                var content = stores.ToJSON();
                var result  = UploadData(interfaceName, stores.ToJSON());

                //写入接口日志
                var logEntity = new ZInterfaceLogEntity()
                {
                    LogId         = Utils.NewGuid(),
                    InterfaceName = interfaceName,
                    Params        = content,
                    ResultCode    = result.code,
                    ResultDesc    = result.description
                };

                InsertInterfaceLog(logEntity, loggingSessionInfo);
            }
        }
Example #22
0
        public override IEnumerable <StoreDictionary> Get(string collection, StoreList columns, StoreDictionary where, int limit)
        {
            string columnsJSON = columns.ToJSON().ToString();
            string whereJSON   = where != null ? where.ToJSON().ToString() : "";

            System.IntPtr pointer     = iosStore_get(collection, columnsJSON, whereJSON, limit < 0 ? "" : limit + "");
            string        recordsJSON = Marshal.PtrToStringAnsi(pointer);

            Marshal.FreeHGlobal(pointer);
            JSON recordsArray = JSON.Parse(recordsJSON);

            StoreDictionary[] records = new StoreDictionary[recordsArray.length];
            for (int i = 0; i < records.Length; i++)
            {
                records[i] = new StoreDictionary(recordsArray[i]);
            }
            return(records);
        }
Example #23
0
        protected override void RefreshMainData()
        {
            PgMng.Grow(string.Empty, "Almacen");

            _selectedOid = ActiveOID;

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

            case EntityMngFormTypeData.ByParameter:
                _sorted_list = List.GetSortedList();
                break;
            }
            PgMng.Grow(string.Empty, "Almacenes");
        }
        public StoreList GetByID(int ID)
        {
            StoreList store = new StoreList();

            using (var connection = new SqlConnection(_connectionString))
            {
                var cmd = connection.CreateCommand();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "SelectStoreByID";
                cmd.Parameters.AddWithValue(@"ID_Store", ID);
                connection.Open();
                var reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    store.IDStore   = (int)reader["ID_Store"];
                    store.StoreName = (string)reader["Store_Name"];
                }
            }
            return(store);
        }
        public void Add(StoreList value)
        {
            using (var connection = new SqlConnection(_connectionString))
            {
                var cmd = connection.CreateCommand();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "AddStore";
                cmd.Parameters.AddWithValue(@"Store_Name", value.StoreName);

                var id = new SqlParameter
                {
                    DbType        = DbType.Int32,
                    ParameterName = "@ID_Store",
                    Direction     = ParameterDirection.Output
                };

                connection.Open();
                cmd.ExecuteNonQuery();
            }
        }
Example #26
0
        public override int Remove(string collection, StoreDictionary where)
        {
            int       affected = 0;
            StoreList columns  = new StoreList(JSON.Parse(Get("meta.collections." + collection)));
            JSON      names    = GetRecords(collection);

            for (int i = 0; i < names.length; i++)
            {
                string name = names[i].stringValue;
                if (IsRecordIncluded(collection, name, where))
                {
                    foreach (string column in columns)
                    {
                        Delete("collections." + collection + "." + name + "." + column);
                    }
                    RemoveRecord(collection, name);
                    affected++;
                }
            }
            return(affected);
        }
Example #27
0
        /// <summary>
        /// Store được sử dụng để fill data vào combobox trên grid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void cbBoxStoreRefresh(object sender, StoreRefreshDataEventArgs e)
        {
            try
            {
                StoreDaTa     storeData = StoreList.Where(p => p.Store.ID == ((Store)sender).ID).FirstOrDefault();
                string        query     = e.Parameters["query"];
                List <object> dataList  = new List <object>();
                if (string.IsNullOrEmpty(storeData.WhereFilter))
                {
                    storeData.WhereFilter = "1=1";
                }
                else if (string.IsNullOrEmpty(query) == false
                         ) //Note: Nếu muốn sử dụng query thì trong trường filter phải có đoạn text như FieldName like {0}
                {
                    storeData.WhereFilter = string.Format(storeData.WhereFilter, "N'" + query + "'");
                }

                string sql = string.Format("select {0},{1} from {2} where {3}", storeData.DisplayField,
                                           storeData.ValueField, storeData.TableName, storeData.WhereFilter);
                DataTable Data = DataHandler.GetInstance().ExecuteDataTable(sql);

                foreach (DataRow row in Data.Rows)
                {
                    string _displayField = row[storeData.DisplayField].ToString();
                    string _valueField   = row[storeData.ValueField].ToString();

                    dataList.Add(new { valueField = _valueField, displayField = _displayField });
                }

                if (storeData.Store != null)
                {
                    storeData.Store.DataSource = dataList;
                    storeData.Store.DataBind();
                }
            }
            catch
            {
            }
        }
Example #28
0
 public void GenericList()
 {
     using (SessionNoServer session = new SessionNoServer(systemDir))
     {
         session.BeginUpdate();
         StoreList storeList = new StoreList();
         Placement place     = new Placement(55, 2, 1, 10, 10);
         storeList.Persist(place, session);
         UInt64 id = storeList.Id;
         session.Commit();
         using (SessionNoServer session2 = new SessionNoServer(systemDir))
         {
             session2.BeginRead();
             StoreList storeList2 = session2.Open <StoreList>(id);
             if (storeList2.in16 != 16)
             {
                 Console.WriteLine("Should be 16");
             }
             session2.Commit();
         }
     }
 }
 public void MyTest()
 {
     List <IDebugPrints> characters = null;
     var sl = new StoreList(characters);
 }
Example #30
0
        public override bool CreateCollection(string name, StoreList columns)
        {
            string columnsJSON = columns.ToJSON().ToString();

            return(native.CallStatic <bool>("createCollection", name, columnsJSON));
        }