public List<CellName> Ho_Nrel_Get(IEnumerable<小区切换查询> cdd_nrel)
        {
            var nrelation = cdd_nrel.ToLookup(e => e.小区名);

            List<CellName> nrel = new List<CellName>();
            int thr = 0;
            foreach (var n in nrelation)
            {
                var nreltop = n.OrderByDescending(e => e.切换次数);
                foreach (var nn in nreltop)
                {
                    thr++;
                    if (thr > 5) continue;
                    CellName cn = new CellName();
                    cn.Cell_name = n.Key;
                    cn.N_cell_name = nn.邻小区名;
                    cn.Handover = nn.切换次数;
                    nrel.Add(cn);
                }
                thr = 0;
            }
            foreach (var n in nrelation)
            {
                CellName cn = new CellName();
                cn.Cell_name = n.Key;
                cn.N_cell_name = n.Key;
                nrel.Add(cn);
            }
            return nrel;
        }
 public List<CellName> Cdd_Nrel_Get(IEnumerable<现网cdd_Nrel> cdd_nrel)
 {
     List<CellName> nrel = new List<CellName>();
     var nrelation = from p in cdd_nrel
                     select new { p.cell_name, p.n_cell_name };
     var nnative = cdd_nrel.Select(e => e.cell_name).Distinct();
     foreach (var n in nrelation)
     {
         CellName cn = new CellName();
         cn.Cell_name = n.cell_name;
         cn.N_cell_name = n.n_cell_name;
         if (cn.Cell_name.Length > 2 && cn.N_cell_name.Length > 2)
         {
             if (cn.Cell_name.IndexOf(cn.N_cell_name.Substring(0, cn.N_cell_name.Length - 2)) != -1)
                 if (cn.Cell_name.Length == cn.N_cell_name.Length)   //比较长度即可
                     nrel.Add(cn);
         }
     }
     foreach (string n in nnative)
     {
         CellName cn = new CellName();
         cn.Cell_name = n;
         cn.N_cell_name = n;
         nrel.Add(cn);
     }
     return nrel;
 }
Exemple #3
0
        public List <CellName> Cdd_Nrel_Get(IEnumerable <现网cdd_Nrel> cdd_nrel)
        {
            List <CellName> nrel      = new List <CellName>();
            var             nrelation = from p in cdd_nrel
                                        select new { p.cell_name, p.n_cell_name };
            var nnative = cdd_nrel.Select(e => e.cell_name).Distinct();

            foreach (var n in nrelation)
            {
                CellName cn = new CellName();
                cn.Cell_name   = n.cell_name;
                cn.N_cell_name = n.n_cell_name;
                if (cn.Cell_name.Length > 2 && cn.N_cell_name.Length > 2)
                {
                    if (cn.Cell_name.IndexOf(cn.N_cell_name.Substring(0, cn.N_cell_name.Length - 2)) != -1)
                    {
                        if (cn.Cell_name.Length == cn.N_cell_name.Length)   //比较长度即可
                        {
                            nrel.Add(cn);
                        }
                    }
                }
            }
            foreach (string n in nnative)
            {
                CellName cn = new CellName();
                cn.Cell_name   = n;
                cn.N_cell_name = n;
                nrel.Add(cn);
            }
            return(nrel);
        }
Exemple #4
0
        public List <CellName> Ho_Nrel_Get(IEnumerable <小区切换查询> cdd_nrel)
        {
            var nrelation = cdd_nrel.ToLookup(e => e.小区名);

            List <CellName> nrel = new List <CellName>();
            int             thr  = 0;

            foreach (var n in nrelation)
            {
                var nreltop = n.OrderByDescending(e => e.切换次数);
                foreach (var nn in nreltop)
                {
                    thr++;
                    if (thr > 5)
                    {
                        continue;
                    }
                    CellName cn = new CellName();
                    cn.Cell_name   = n.Key;
                    cn.N_cell_name = nn.邻小区名;
                    cn.Handover    = nn.切换次数;
                    nrel.Add(cn);
                }
                thr = 0;
            }
            foreach (var n in nrelation)
            {
                CellName cn = new CellName();
                cn.Cell_name   = n.Key;
                cn.N_cell_name = n.Key;
                nrel.Add(cn);
            }
            return(nrel);
        }
Exemple #5
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = CellName.GetHashCode();
         result = (result * 397) ^ Assemblies.GetHashCode();
         result = (result * 397) ^ EntryPointTypeName.GetHashCode();
         result = (result * 397) ^ SettingsXml.GetHashCode();
         return(result);
     }
 }
        /// <summary>
        /// 对cell索引表达式进行计算
        /// </summary>
        /// <param name="data">数据</param>
        /// <returns></returns>
        public string CalculateCellName(object data)
        {
            var matches = Regex.Matches(CellName, @"\{\+([\w\s+.]+)\}");

            if (matches.Count == 0)
            {
                return(CellName);
            }


            var length  = CellName.Length;
            int rowGrow = 0;
            int colGrow = 0;

            // 从cell表达式中获取原始cell坐标
            foreach (Match item in matches)
            {
                CellName = CellName.Replace(item.Value, string.Empty);
            }
            var location = ExcelHandler.CellNameToLocation(CellName);


            if (matches.Count == 1)
            {
                var match = matches[0];
                var grow  = RazorTemplateHelper.RunRazorSnippet <int>(match.Groups[1].Value, data);
                if (matches[0].Length + matches[0].Index == length)
                {
                    rowGrow = grow;
                }
                else
                {
                    colGrow = grow;
                }
            }
            else
            {
                if (matches.Count == 2)
                {
                    colGrow = RazorTemplateHelper.RunRazorSnippet <int>(matches[0].Groups[1].Value, data);
                    rowGrow = RazorTemplateHelper.RunRazorSnippet <int>(matches[1].Groups[1].Value, data);
                }
            }

            location.RowIndex    += rowGrow;
            location.ColumnIndex += colGrow;

            return(ExcelHandler.LocationToCellName(location.ColumnIndex, location.RowIndex));
        }
Exemple #7
0
        protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state)
        {
            PropertyDescriptor property = context.DataContext.GetProperties()[ExcelCreate.GetExcelAppTag];
            Excel::Application excelApp = property.GetValue(context.DataContext) as Excel::Application;

            try
            {
                Int32             cellColumn = CellColumn.Get(context);
                Int32             cellRow    = CellRow.Get(context);
                string            cellName   = CellName.Get(context);
                string            sheetName  = SheetName.Get(context);
                Excel::_Worksheet sheet;

                if (sheetName == null)
                {
                    sheet = excelApp.ActiveSheet;
                }
                else
                {
                    sheet = excelApp.ActiveWorkbook.Sheets[sheetName];
                }
                object cellContent = null;
                if (cellName == null)
                {
                    cellContent = sheet.Cells[cellRow, cellColumn].Value2;
                }
                else
                {
                    cellContent = sheet.Range[cellName].Value2;
                }
                CellContent.Set(context, cellContent);

                System.Runtime.InteropServices.Marshal.ReleaseComObject(sheet);
                sheet = null;
                GC.Collect();
            }
            catch (Exception e)
            {
                SharedObject.Instance.Output(SharedObject.enOutputType.Error, "EXCEL获取单元格内容出错", e.Message);
                new CommonVariable().realaseProcessExit(excelApp);
            }
            m_Delegate = new runDelegate(Run);
            return(m_Delegate.BeginInvoke(callback, state));
        }
Exemple #8
0
        async void LoadTableFuctionality()
        {
            DidInitiliseSource = false;
            try
            {
                loadingOverlay = new LoadingOverlay(UIScreen.MainScreen.Bounds);
                View.Add(loadingOverlay);
                ParseQuery <ParseObject> query = ParseObject.GetQuery("Coffees");
                query.Include("Title").Include("Price").Include("ImageName");

                var iEnumerableColl = await query.FindAsync();

                foreach (ParseObject coffeeElements in iEnumerableColl)
                {
                    string coffeeName = coffeeElements.Get <string>("Title");
                    string imageName  = coffeeElements.Get <string>("ImageName");
                    double price      = coffeeElements.Get <double>("Price");

                    coffeeItems.Add(new Coffee(coffeeName, imageName, "" + price));
                }

                loadingOverlay.Hide();
            }
            catch (ParseException)
            {
                loadingOverlay.Hide();
                AlertPopUp("Error", "Connection error", "OK");
            }

            Source         = new TableSourceOrdering(coffeeItems);
            Source.Voucher = VouchersLabel.Text;

            Source.Launched          = true;
            Source.Ordered           = false;
            Source.GetInitialVoucher = VouchersLabel.Text;

            ordersTable.Source = Source;
            ordersTable.ReloadData();
            DidInitiliseSource = true;

            Source.onCellForOrderName += (sender, e) =>
            {
                CellName = e;
            };

            Source.onCellSelectedForVouchers += (sender, e) =>
            {
                VoucherCount.Voucher      = e;
                VoucherCount.IsSelected   = true;
                VoucherCount.IsDeselected = false;
                VoucherCount.VoucherChange();
                VouchersLabel.Text = "" + VoucherCount.GetVoucher() + " Vouchers";
                Source.Voucher     = VouchersLabel.Text;

                if (!VoucherCount.IsVoucherDepleted)
                {                          // tag all the orders purchased by vouchers
                    taggedOrders.Add(new TagOrder(CellName));
                    taggedOrderNamesForPrice.Add(CellName);
                }
            };

            Source.onCellDeselectedForVouchers += (sender, e) =>
            {
                //increments voucher if its a tagged order

                VoucherCount.HasTag = false;

                foreach (TagOrder order in taggedOrders)
                {
                    //if (!NamesOfTaggedOrders.Contains(order.OrderName)) NamesOfTaggedOrders += order.OrderName + "*";
                    if (order.OrderName.Equals(CellName))
                    {
                        Debug.WriteLine(order.OrderName);
                        NamesOfTaggedOrders = order.OrderName;
                        taggedOrders.Remove(order);
                        VoucherCount.HasTag = true;
                        break;
                    }
                }

                if (PriceCount.Depleted)
                {
                    VoucherCount.IsDeselected = true;
                    VoucherCount.IsSelected   = false;
                    VoucherCount.VoucherChange();
                    VouchersLabel.Text = "" + VoucherCount.GetVoucher() + " Vouchers";
                    Source.Voucher     = VouchersLabel.Text;
                }
                else if (CellName.Equals(NamesOfTaggedOrders))
                {
                    VoucherCount.IsDeselected = true;
                    VoucherCount.IsSelected   = false;
                    VoucherCount.VoucherChange();
                    VouchersLabel.Text = "" + VoucherCount.GetVoucher() + " Vouchers";
                    Source.Voucher     = VouchersLabel.Text;
                }
                NamesOfTaggedOrders = string.Empty;
            };

            Source.onCellSelectedForPrice += (sender, e) =>
            {
                if (VoucherCount.IsVoucherDepleted)
                {
                    PriceCount.Price      = e;
                    PriceCount.Selected   = true;
                    PriceCount.Deselected = false;
                    PriceCount.PriceChange();
                    costText.Text = PriceCount.GetPrice().ToString("R 0.00");
                }
            };

            Source.onCellDeselectedForPrice += (sender, e) =>
            {
                const int VOUCHER_BEFORE_EXECUTION_TO_ZERO = 1;

                if (VoucherCount.IsVoucherDepleted && VoucherCount.Voucher != VOUCHER_BEFORE_EXECUTION_TO_ZERO)
                {
                    PriceCount.Price      = e;
                    PriceCount.Selected   = false;
                    PriceCount.Deselected = true;
                    PriceCount.PriceChange();
                    costText.Text = PriceCount.GetPrice().ToString("R 0.00");
                }
                else if (VoucherCount.GetVoucher() != 0 && !VoucherCount.HasTag)
                {
                    PriceCount.Price      = e;
                    PriceCount.Selected   = false;
                    PriceCount.Deselected = true;
                    PriceCount.PriceChange();
                    costText.Text = PriceCount.GetPrice().ToString("R 0.00");
                }
            };
        }
Exemple #9
0
 private string GetStringCellData(CellName myCellName, ICell myCell)
 {
     return(GetStringCellDataCore(myCellName.ToString(), myCell));
 }