Exemplo n.º 1
0
        private async void ReadStaticData(CancellationToken token)
        {
            await Task.Factory.StartNew((Action)(() =>
            {
                while (!token.IsCancellationRequested)
                {
                    if (!_staticConnected)
                    {
                        _staticConnected = _staticMemoryReader.Connect();
                    }
                    DateTime utcNow = DateTime.UtcNow;
                    if ((utcNow - _staticLastTimeStamp).TotalMilliseconds >= _staticPollInterval)
                    {
                        _staticLastTimeStamp = utcNow;
                        byte[] buffer = _staticMemoryReader.Read();

                        GCHandle gCHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
                        try
                        {
                            _staticData = (StaticInfo)Marshal.PtrToStructure(gCHandle.AddrOfPinnedObject(), typeof(StaticInfo));
                            ProcessStaticData();
                        }
                        finally
                        {
                            gCHandle.Free();
                        }
                    }
                    Thread.Sleep((int)_staticPollInterval);
                }
            }));
        }
Exemplo n.º 2
0
        void SetTokenStuff()
        {
            if (token != null && !string.IsNullOrEmpty(token.AccessToken))
            {
                switch (typeenum)
                {
                case CharacterEnum.BuildCorp:
                    db.Settings.BuildCorpCharacterId = token.CharacterID;
                    break;

                case CharacterEnum.EmpireDonkey:
                    db.Settings.EmpireDonkeyCharacterId = token.CharacterID;
                    break;
                }

                var characterResponse = StaticInfo.GetESIResponse <Character>("/characters/{character_id}/", typeenum);

                switch (typeenum)
                {
                case CharacterEnum.BuildCorp:
                    db.Settings.BuildCorpAccessToken   = token.AccessToken;
                    db.Settings.BuildCorpCorporationId = characterResponse.Result.corporation_id;
                    break;

                case CharacterEnum.EmpireDonkey:
                    db.Settings.EmpireDonkeyAccessToken   = token.AccessToken;
                    db.Settings.EmpireDonkeyCorporationId = characterResponse.Result.corporation_id;
                    break;
                }
            }
        }
Exemplo n.º 3
0
    private void CheckForAd()
    {
        bool hasRemoveAds = false;

        if (SaveManager.Instance != null)
        {
            hasRemoveAds = SaveManager.Instance.GetHasRemoveAdsStatus();
        }

        int numPlays = StaticInfo.GetNumberOfPlays();

        if (numPlays > 0 && numPlays % 3 == 0 && !hasRemoveAds && !watchedRewardedAd)
        {
            if (UnityAds.CheckForAd())
            {
                SoundManager.Instance.FadeOutBackgroundMusic(1f);
                UnityAds.ShowAd(AdCompleted);
            }
            else
            {
                // Debug.Log("Add didn't show");
                LoadScene(currentLoadString);
            }
        }
        else
        {
            LoadScene(currentLoadString);
        }
    }
Exemplo n.º 4
0
        private static void GetToken(string code, Dictionary <string, string> body)
        {
            var content = new FormUrlEncodedContent(body);
            var result  = db.Settings.AuthURL
                          .AppendPathSegment("token")
                          .WithBasicAuth(db.Settings.ESIClientId, db.Settings.ESISecret)
                          .PostAsync(content)
                          .ReceiveString()
                          .Result;

            var obj   = JObject.Parse(result);
            var token = new AuthToken()
            {
                AccessToken  = obj.SelectToken("access_token").Value <string>(),
                Expires      = obj.SelectToken("expires_in").Value <int>(),
                RefreshToken = obj.SelectToken(Strings.Refresh_Token).Value <string>()
            };

            if (body[Strings.Grant_Type] == Strings.Authorization_Code)
            {
                token.AuthorizationToken = code;
            }

            GetCharacterDetails(ref token);

            StaticInfo.Completed(token);
        }
Exemplo n.º 5
0
        private void GetNewSecurityRuleID(ref ConnectionManager conManager, ref CustomList <SecurityRule> securityRuleList, ref CustomList <RuleDetails> securityRuleDetailList)
        {
            String newSecurityRuleID = String.Empty;

            try
            {
                CustomList <SecurityRule> tempSecurityRuleList = securityRuleList.FindAll(f => f.IsAdded);
                if (tempSecurityRuleList.Count != 0)
                {
                    newSecurityRuleID = StaticInfo.MakeUniqueCode("SecurityRuleCode", 20, DateTime.Today.ToString(), "yy", "SR", "-", "");
                    securityRuleList[0].SecurityRuleCode = newSecurityRuleID;
                    securityRuleInfoID = newSecurityRuleID;
                }
                else
                {
                    securityRuleInfoID = securityRuleList[0].SecurityRuleCode;
                }

                CustomList <RuleDetails> tempSecurityRuleDetailList = securityRuleDetailList.FindAll(f => f.IsAdded);
                foreach (RuleDetails sRO in tempSecurityRuleDetailList)
                {
                    sRO.SecurityRuleCode = securityRuleList[0].SecurityRuleCode;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 6
0
        private void GetNewLoanCode(ref ConnectionManager conManager, ref CustomList <LoanDefination> LoanDefinationList, ref CustomList <LoanProcess> LoanProcessList)
        {
            String newLoanCode = String.Empty;

            try
            {
                CustomList <LoanDefination> addedLoanDefinationList = LoanDefinationList.FindAll(f => f.IsAdded);
                if (addedLoanDefinationList.Count != 0)
                {
                    newLoanCode = StaticInfo.MakeUniqueCode("LoanCode", 20, DateTime.Today.ToString(), "yy", "LC", "-", "");
                    LoanDefinationList[0].LoanCode = newLoanCode;
                    loanCode = newLoanCode;
                }
                else
                {
                    loanCode = LoanDefinationList[0].LoanCode;
                }
                CustomList <LoanProcess> AddedLoanProcess = LoanProcessList.FindAll(f => f.IsAdded);
                foreach (LoanProcess lP in AddedLoanProcess)
                {
                    lP.LoanCode = LoanDefinationList[0].LoanCode;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 7
0
        void ESIAssetImport()
        {
            ESIbuildCorpAssets = StaticInfo.ESIImportCrawl <ESI.Asset>("/corporations/{corporation_id}/assets/", ESI.CharacterEnum.BuildCorp);
            ESIempireDonkey    = StaticInfo.ESIImportCrawl <ESI.Asset>("/characters/{character_id}/assets/", ESI.CharacterEnum.EmpireDonkey);

            Console.WriteLine("....Done loading assets");
        }
Exemplo n.º 8
0
        private void GetNewPolicyID(ref ConnectionManager conManager, ref CustomList <LeavePolicyMaster> LeavePolicyMasterList, ref CustomList <LeavePolicyDetails> LeavePolicyDetailsList)
        {
            String newLeavePolicyID = String.Empty;

            try
            {
                CustomList <LeavePolicyMaster> tempLeavePolicyMasterList = LeavePolicyMasterList.FindAll(f => f.IsAdded);
                if (tempLeavePolicyMasterList.Count != 0)
                {
                    newLeavePolicyID = StaticInfo.MakeUniqueCode("LeavePolicyID", 20, DateTime.Today.ToString(), "yy", "LPI", "-", "");
                    LeavePolicyMasterList[0].LeavePolicyID = newLeavePolicyID.ToInt();
                    leavePolicyID = newLeavePolicyID;
                }
                else
                {
                    leavePolicyID = LeavePolicyMasterList[0].LeavePolicyID.ToString();
                }

                CustomList <LeavePolicyDetails> tempLeavePolicyDetailsList = LeavePolicyDetailsList.FindAll(f => f.IsAdded);
                foreach (LeavePolicyDetails lPD in tempLeavePolicyDetailsList)
                {
                    lPD.LeavePolicyID = leavePolicyID.ToInt();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 private void ResolveCallBackMode()
 {
     try
     {
         String callMode = HttpContext.Current.Request.QueryString["CallMode"];
         callBackMode = (ProductionDataCaptureCallBackMode)StaticInfo.GetEnumValue(typeof(ProductionDataCaptureCallBackMode), callMode);
         if (callMode.CompareTo("RateDynamicGrid").IsZero())
         {
             callBackMode = ProductionDataCaptureCallBackMode.RateDynamicGrid;
         }
         //if (callMode.CompareTo("DataCaptureDynamicGrid").IsZero())
         //{
         //    callBackMode = ProductionDataCaptureCallBackMode.DataCaptureDynamicGrid;
         //}
         if (callMode.CompareTo("AddToGrid").IsZero())
         {
             callBackMode = ProductionDataCaptureCallBackMode.AddToGrid;
         }
         if (callMode.CompareTo("TodayEntryList").IsZero())
         {
             callBackMode = ProductionDataCaptureCallBackMode.TodayEntryList;
         }
         if (callMode.CompareTo("UpdateDataCaptureGrid").IsZero())
         {
             callBackMode = ProductionDataCaptureCallBackMode.UpdateDataCaptureGrid;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 10
0
        protected void StaticInfoUpdated(object sender, StaticInfoEventArgs e)
        {
            if (e.StaticInfo.MaxRpm == 0)
            {
                //auto calibrate the max rpm. Sometimes the car doesn't return this info.
                if (lastRpm < currentRpm && currentRpm > 5000)
                {
                    lastRpm = currentRpm;
                }
            }
            else
            {
                lastRpm = e.StaticInfo.MaxRpm;
            }
            firstRpm = FIRST_RPM * lastRpm;
            //calibrate shift gear light rpm
            lastRpm *= MainForm.maxRPM;
            si       = e.StaticInfo;

            flag = (int)gr.Flag;

            if (ph.PitLimiterOn > 0)
            {
                flag = (int)Constants.FLAG_TYPE.IN_PIT_FLAG;
            }
        }
Exemplo n.º 11
0
        protected void btnFindSupervisor_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                TextBox empCodeTextBox = (TextBox)ctrlEmpSearch2.FindControl("txtSearch");
                string  EmpCode        = empCodeTextBox.Text;

                CustomList <HRM_Emp>        EmpList = _salaryManager.doSearch(EmpCode);
                Dictionary <string, string> columns = new Dictionary <string, string>();

                columns.Add("EmpCode", "Employee Code");
                columns.Add("EmpName", "Employee Name");
                columns.Add("StaffCategory", "Staff Category");
                columns.Add("Designation", "Designation");
                columns.Add("Department", "Department");
                columns.Add("JobLocation", "Job Location");

                StaticInfo.SearchItem(EmpList, "Emp Info", "SearchSupervisor", SearchColumnConfig.GetColumnConfig(typeof(HRM_Emp), columns), 700, GlobalEnums.enumSearchType.StoredProcedured);
            }
            catch (SqlException ex)
            {
                ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex));
            }
            catch (Exception ex)
            {
                ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getExceptionMessage(ex));
            }
        }
Exemplo n.º 12
0
        private void ItemPrice_Loaded(object sender, RoutedEventArgs e)
        {
            Brush lightYellow = new SolidColorBrush(Color.FromRgb(0xAA, 0x9E, 0x82));
            Brush lightGold   = new SolidColorBrush(Color.FromRgb(0xA3, 0x8D, 0x6D));

            string    priceType    = Price.Type == "~price" ? "Exact Price:" : "Asking Price:";
            TextBlock txtPriceType = new TextBlock {
                Text = priceType, Foreground = lightGold, TextAlignment = TextAlignment.Center, Margin = new Thickness(0, 6, 0, 0)
            };

            WrapPanel wrap = new WrapPanel {
                HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, 0, 0, 3)
            };

            wrap.Children.Add(new TextBlock {
                Text = Price.Amount + "x ", Foreground = lightYellow, Margin = new Thickness(0, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center, FontWeight = FontWeights.Bold
            });

            StaticInfo info      = StaticInfo.Get(Price.Currency);
            string     imagePath = "https://web.poecdn.com" + info.Image;

            wrap.Children.Add(new ImageBox {
                CacheSource = imagePath, Width = 26
            });

            //wrap.Children.Add(new TextBlock { Text = " " + info.Text, Foreground = lightYellow });

            panel.Children.Add(txtPriceType);
            panel.Children.Add(wrap);
        }
Exemplo n.º 13
0
        public void GetAttackBitboard_Queen(string[] expected, string[] occupied, string source)
        {
            var sourceLoc  = Location.Parse(source);
            var occupiedBb = Bitboard.FromLocations(occupied.Select(Location.Parse));

            var actual = StaticInfo.GetAttackBitboard(Piece.WhiteQueen, sourceLoc, occupiedBb);

            Assert.Equal(expected.Select(Location.Parse), actual.Locations(), OrderInsensitiveComparer <Location> .Instance);
        }
        public ComfortProfile GetComfortProfile(string appUserId)
        {
            StaticInfo     staticInfo = _staticInfoRepository.GetStaticInfoByUserId(appUserId);
            Nullable <int> comfortTeapotTemperature = null;

            if (_teapotRepository.GetTeapotByUserId(appUserId) != null)
            {
                comfortTeapotTemperature = _teapotRepository.GetTeapotByUserId(appUserId).ComfortTemperature;
            }

            if (staticInfo != null)
            {
                ComfortProfile comfortProfile = new ComfortProfile()
                {
                    UserId                    = appUserId,
                    ShoeSize                  = staticInfo.ShoeSize,
                    Allergens                 = staticInfo.Allergens,
                    ChairTypeId               = staticInfo.ChairTypeId,
                    ClothingSize              = staticInfo.ClothingSize,
                    FruitPreferences          = staticInfo.FruitPreferences,
                    KindOfCoffee              = staticInfo.KindOfCoffee,
                    KindOfTea                 = staticInfo.KindOfTea,
                    MattressTypeId            = staticInfo.MattressTypeId,
                    MusicalPreferences        = staticInfo.MusicalPreferences,
                    TableTypeId               = staticInfo.TableTypeId,
                    WaterTypeId               = staticInfo.WaterTypeId,
                    PreferableRoomsIndicators = _roomRepository.GetPreferableRoomsIndicators(appUserId),
                    FavoriteCoffeeTypes       = _coffeeRepository.GetFavouriteCoffeeTypes(appUserId).Select(ct => (object)new { ct.Id, ct.Name }).ToList(),
                    ComfortTeapotTemperature  = comfortTeapotTemperature
                };

                if (_coffeeRepository.GetPreferableCoffeeTimes(appUserId) != null)
                {
                    comfortProfile.PreferableCoffeeTimes = _coffeeRepository.GetPreferableCoffeeTimes(appUserId).Select(cl => (object)new { cl.CoffeeTypeId, cl.Date, cl.HowOftenId }).ToList();
                }
                else
                {
                    comfortProfile.PreferableCoffeeTimes = null;
                }

                if (_teapotRepository.GetPreferableTeaTimes(appUserId) != null)
                {
                    comfortProfile.PreferableTeaTimes = _teapotRepository.GetPreferableTeaTimes(appUserId).Select(cl => (object)new { cl.Temperature, cl.Date, cl.HowOftenId }).ToList();
                }
                else
                {
                    comfortProfile.PreferableTeaTimes = null;
                }

                return(comfortProfile);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 15
0
 static LocalizationRowHandler()
 {
     SchemaChangeSource.Observers += (schema, table) =>
     {
         if (schema == schemaName)
         {
             info = null;
         }
     };
 }
Exemplo n.º 16
0
 static CaptureLogHandler()
 {
     SchemaChangeSource.Observers += (schema, table) =>
     {
         if (schema == schemaName)
         {
             info = null;
         }
     };
 }
Exemplo n.º 17
0
 static CaptureLogHandler()
 {
     SchemaChangeSource.Observers += (connectionKey, table) =>
     {
         if (connectionKey == logConnectionKey)
         {
             info = null;
         }
     };
 }
Exemplo n.º 18
0
        private void AC_StaticInfoUpdated(object sender, StaticInfoEventArgs e)
        {
            this._staticInfo = e.StaticInfo;
            // Print out some data from StaticInfo

            //  Console.WriteLine("StaticInfo\r\n");
            //  Console.WriteLine("  Car Model: " + e.StaticInfo.CarModel + "\r\n");
            //  Console.WriteLine("  Track:     " + e.StaticInfo.Track + "\r\n");
            //  Console.WriteLine("  Max RPM:   " + e.StaticInfo.MaxRpm + "\r\n");
        }
        protected void btnFind_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                StringBuilder sb = new StringBuilder();
                if (ddlCompany.SelectedValue != "")
                {
                    sb.Append("@OrgKey=");
                    sb.Append(ddlCompany.SelectedValue.ToInt());
                    sb.Append(",");
                }
                if (ddlBranch.SelectedValue != "")
                {
                    sb.Append("@BranchKey=");
                    sb.Append(ddlBranch.SelectedValue.ToInt());
                    sb.Append(",");
                }
                if (ddlDepartment.SelectedValue != "")
                {
                    sb.Append("@DepartmentKey=");
                    sb.Append(ddlDepartment.SelectedValue.ToInt());
                    sb.Append(",");
                }
                if (ddlGrade.SelectedValue != "")
                {
                    sb.Append("@GradeKey=");
                    sb.Append(ddlGrade.SelectedValue.ToInt());
                    sb.Append(",");
                }
                if (ddlDesignation.SelectedValue != "")
                {
                    sb.Append("@DesigKey=");
                    sb.Append(ddlDesignation.SelectedValue.ToInt());
                    sb.Append(",");
                }
                string EmpKey = "";
                Session[StaticInfo.SearchArg] = sb;
                CustomList <HRM_Emp>        ProcessedAndUnProcessedList = _manager.doSearch(EmpKey);
                Dictionary <string, string> columns = new Dictionary <string, string>();

                columns.Add("EmpCode", "Employee Code");
                columns.Add("EmpName", "Employee Name");

                StaticInfo.SearchItem(ProcessedAndUnProcessedList, "Emp Info", "SearchEmployee", SearchColumnConfig.GetColumnConfig(typeof(HRM_Emp), columns), 500, GlobalEnums.enumSearchType.StoredProcedured);
                //StaticInfo.SearchItem(items, "Emp Info", "SearchEmployee", SearchColumnConfig.GetColumnConfig(typeof(HRM_Emp), columns), 500);
            }
            catch (SqlException ex)
            {
                ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex));
            }
            catch (Exception ex)
            {
                ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getExceptionMessage(ex));
            }
        }
Exemplo n.º 20
0
        static StaticInfo EnsureInfo()
        {
            var newInfo = info;

            if (newInfo != null)
            {
                return(newInfo);
            }

            var logTableAttr = typeof(TRow).GetCustomAttribute <CaptureLogAttribute>(false);

            if (logTableAttr == null || logTableAttr.LogTable.IsTrimmedEmpty())
            {
                throw new InvalidOperationException(String.Format("{0} row type has no capture log table attribute defined!", typeof(TRow).Name));
            }

            schemaName = RowRegistry.GetSchemaName(typeof(TRow));
            var instance = RowRegistry.GetSchemaRow(schemaName, logTableAttr.LogTable);

            if (instance == null)
            {
                throw new InvalidOperationException(String.Format("Can't locate {0} capture log table in schema {1} for {2} row type!",
                                                                  logTableAttr.LogTable, schemaName, typeof(TRow).Name));
            }

            var captureLogRow = instance as ICaptureLogRow;

            if (captureLogRow == null)
            {
                throw new InvalidOperationException(String.Format("Capture log table {0} doesn't implement ICaptureLogRow interface!",
                                                                  logTableAttr.LogTable, schemaName, typeof(TRow).Name));
            }

            if (!(captureLogRow is IIsActiveRow))
            {
                throw new InvalidOperationException(String.Format("Capture log table {0} doesn't implement IIsActiveRow interface!",
                                                                  logTableAttr.LogTable, schemaName, typeof(TRow).Name));
            }

            newInfo = new StaticInfo();
            newInfo.logRowInstance       = instance;
            newInfo.captureLogInstance   = captureLogRow;
            newInfo.rowInstance          = new TRow();
            newInfo.rowFieldPrefixLength = PrefixHelper.DeterminePrefixLength(newInfo.rowInstance.EnumerateTableFields(), x => x.Name);
            newInfo.logFieldPrefixLength = PrefixHelper.DeterminePrefixLength(instance.EnumerateTableFields(), x => x.Name);
            newInfo.mappedIdField        = ((Row)captureLogRow).FindField(logTableAttr.MappedIdField) as IIdField;
            if (newInfo.mappedIdField == null)
            {
                throw new InvalidOperationException(String.Format("Can't locate capture log table mapped ID field for {0}!",
                                                                  ((Row)captureLogRow).Table));
            }

            info = newInfo;
            return(newInfo);
        }
Exemplo n.º 21
0
 public void OnMouseDown()
 {
     if (increase)
     {
         StaticInfo.IncreaseLevel();
     }
     else
     {
         StaticInfo.DecreaseLevel();
     }
 }
Exemplo n.º 22
0
        public StaticModifier(ModifierInfo info, Entity casterEntity, Entity targetEntity, Environment environment, CollectionOfInteractions modifierInteractionCollection) : base(info, casterEntity, targetEntity, environment, modifierInteractionCollection)
        {
            this.info             = (StaticInfo)info;
            this.environment      = environment;
            caster                = casterEntity.GetComponent <SkillComponent>().Character;
            target                = targetEntity.GetComponent <SkillComponent>().Character;
            targetHealthComponent = targetEntity.GetComponent <HealthComponent>();
            casterStatsComponent  = casterEntity.GetComponent <StatsComponent>();
            targetStatsComponent  = targetEntity.GetComponent <StatsComponent>();

            duration = this.info.Smc.ShowDurationInSeconds();
        }
Exemplo n.º 23
0
        public Market(db.Db dataBase)
        {
            ESIcostIndices = StaticInfo.ESIImportCrawl <ESI.CostIndice>("/industry/systems/", pageSize: 10000);
            Console.WriteLine("....Done getting cost indices");

            ESImarketPrices = StaticInfo.ESIImportCrawl <ESI.MarketPrice>("/markets/prices/", pageSize: 20000);
            Console.WriteLine("....Done getting estimated prices");

            this.dataBase = dataBase;
            region[0]     = new Region(10000002); // the forge/jita
            //region[1] = new Region(10000060); // delve
        }
        public JsonResult GetStaticInfoForCurrentUser(string userId)
        {
            StaticInfo staticInfo = _staticInfoRepository.GetStaticInfoByUserId(userId);

            if (staticInfo != null)
            {
                return(new JsonResult(ConvertToRequestStaticInfo(staticInfo)));
            }
            else
            {
                return(new JsonResult("error"));
            }
        }
        public RibbonFormStoricoInserimento()
        {
            InitializeComponent();

            this.Text = String.Format("Win Ticket Next ({0})", Program.UtenteCollegato.FullName);

            repositoryItemLookUpEditIngresso.DataSource = Program.UtenteCollegato.GetMioElencoIngressi(this.unitOfWork1, Program.Postazione);

            this.barEditItemAlla.EditValue  = DateTime.Today.AddDays(-1);
            this.barEditItemDalla.EditValue = DateTime.Today.AddDays(-1);

            StaticInfo.DataAgg(this.barStaticItemInfo);
        }
Exemplo n.º 26
0
        private void SetValue(RDLParameter param, FilterSets value)
        {
            try
            {
                param.DbType = (DbType)StaticInfo.GetEnumValue(typeof(DbType), value.DataType);
                switch (param.DbType)
                {
                case DbType.DateTime:
                    CultureInfo provider = CultureInfo.InvariantCulture;
                    if (value.ColumnValue == "")
                    {
                        param.Value = String.Empty;
                        break;
                    }
                    param.Value = DateTime.ParseExact(value.ColumnValue, StaticInfo.GridDateFormat, provider).ToString(StaticInfo.DateFormat);
                    break;

                case DbType.Int16:
                    param.Value = Convert.ToInt16(value.ColumnValue);
                    break;

                case DbType.Int32:
                    param.Value = Convert.ToInt32(value.ColumnValue);
                    break;

                case DbType.Int64:
                    param.Value = Convert.ToInt64(value.ColumnValue);
                    break;

                case DbType.Double:
                    param.Value = Convert.ToDouble(value.ColumnValue);
                    break;

                case DbType.Decimal:
                    param.Value = Convert.ToDecimal(value.ColumnValue);
                    break;

                case DbType.Boolean:
                    param.Value = Convert.ToBoolean(value.ColumnValue);
                    break;

                default:
                    param.Value = value.ColumnValue;
                    break;
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Exemplo n.º 27
0
        //
        // GET: /Services/
        //[HttpGet]
        //public ViewResult SortView()
        //{
        //    StaticInfo saticinfo = new StaticInfo(db);
        //    var groupnumberlist = new SelectList(new[] { "6", "12", "24" });
        //    ViewBag.GroupNumberList = groupnumberlist;
        //    var sortOrderlist = new SelectList(new[] { "Rate", "Name", "Date", "CookingTime" });
        //    ViewBag.sortOrderlist = sortOrderlist;
        //    var sortOrder = "FinalRate";
        //    var recipestemp = saticinfo.SortRecipes(sortOrder, db);
        //    var pageNumber = 1;
        //    var pageSize =  6;

        //    return View(recipestemp.ToPagedList(pageNumber, pageSize));
        //}
        //[HttpPost]
        public ViewResult SortView(string sortOrder, int?page, int?pagesize, bool?cookingTimeActive, string cookingTime)
        {
            StaticInfo saticinfo       = new StaticInfo(db);
            var        groupnumberlist = new SelectList(new[] { "6", "12", "24" });

            ViewBag.GroupNumberList = groupnumberlist;
            var sortOrderlist = new SelectList(new[] { "Rate", "Name", "Date", "CookingTime" });

            ViewBag.sortOrderlist = sortOrderlist;


            if (sortOrder.IsEmpty())
            {
                sortOrder = "FinalRate";
            }
            var recipestemp = saticinfo.SortRecipes(sortOrder, db);

            if (cookingTimeActive == true)
            {
                var intcotime = int.Parse(cookingTime);
                //recipestemp = saticinfo.CookingTimeLess(intcotime, recipestemp);
                recipestemp = from item in recipestemp
                              where item.CookingTime <= intcotime
                              select item;
            }

            //if (!pNumberState.IsEmpty())
            //{
            //    var intPnum = int.Parse(peopleNum);
            //    if (pNumberState.Equals("less"))
            //    {
            //        recipestemp = from item in recipestemp
            //            where item.PeopoleNumber <= intPnum
            //            select item;
            //    }
            //    else
            //    {
            //        recipestemp = from item in recipestemp
            //            where item.PeopoleNumber >= intPnum
            //            select item;
            //    }
            //}

            var pageNumber = (page ?? 1);
            var pageSize   = (pagesize ?? 6);

            ViewBag.currentsize  = pageSize;
            ViewBag.currentorder = sortOrder;
            //return HttpUtility.HtmlEncode("pageSize" + pageSize+ ",pageNimber" + pageNumber);
            return(View(recipestemp.ToPagedList(pageNumber, pageSize)));
        }
Exemplo n.º 28
0
        public RibbonFormStorico()
        {
            InitializeComponent();

            this.Text = String.Format("Win Ticket Next ({0})", Program.UtenteCollegato.FullName);

            this.barEditItemAlla.EditValue  = DateTime.Now.Date;
            this.barEditItemDalla.EditValue = DateTime.Now.Date;

            this.barCheckItemPostazione.Caption = string.Format("Solo questa postazione ({0})", Program.Postazione.Nome);
            this.barCheckItemUtente.Caption     = string.Format("Solo questo utente ({0})", Program.UtenteCollegato.FullName);

            StaticInfo.DataAgg(this.barStaticItemInfo);
        }
Exemplo n.º 29
0
        static StaticInfo EnsureInfo()
        {
            var newInfo = info;

            if (newInfo != null)
            {
                return(newInfo);
            }

            var localAttr = typeof(TRow).GetCustomAttribute <LocalizationRowAttribute>(false);

            if (localAttr == null || localAttr.LocalizationTable.IsTrimmedEmpty())
            {
                throw new InvalidOperationException(String.Format("{0} row type has no localization attribute defined!", typeof(TRow).Name));
            }

            schemaName = RowRegistry.GetConnectionKey(typeof(TRow));
            var localInstance = RowRegistry.GetConnectionRow(schemaName, localAttr.LocalizationTable);

            if (localInstance == null)
            {
                throw new InvalidOperationException(String.Format("Can't locate {0} localization table in schema {1} for {2} row type!",
                                                                  localAttr.LocalizationTable, schemaName, typeof(TRow).Name));
            }

            var localRow = localInstance as ILocalizationRow;

            if (localRow == null)
            {
                throw new InvalidOperationException(String.Format("Localization table {0} doesn't implement ILocalizationRow interface!",
                                                                  localAttr.LocalizationTable, schemaName, typeof(TRow).Name));
            }


            newInfo = new StaticInfo();
            newInfo.localRowInterface         = localRow;
            newInfo.localRowInstance          = localInstance;
            newInfo.rowInstance               = new TRow();
            newInfo.rowFieldPrefixLength      = PrefixHelper.DeterminePrefixLength(newInfo.rowInstance.EnumerateTableFields(), x => x.Name);
            newInfo.localRowFieldPrefixLength = PrefixHelper.DeterminePrefixLength(localInstance.EnumerateTableFields(), x => x.Name);
            newInfo.mappedIdField             = (IIdField)((Row)localInstance).FindField(localAttr.MappedIdField);
            if (newInfo.mappedIdField == null)
            {
                throw new InvalidOperationException(String.Format("Can't locate localization table mapped ID field for {0}!",
                                                                  localInstance.Table));
            }

            info = newInfo;
            return(newInfo);
        }
Exemplo n.º 30
0
        protected void btnFind_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                CustomList <ASL.Hr.DAO.OTSlab> items   = manager.GetAllOTSlab();
                Dictionary <string, string>    columns = new Dictionary <string, string>();

                columns.Add("OTSlabID", "OT Slab");

                StaticInfo.SearchItem(items, "OT Slab", "SearchOTSlab", ASL.Web.Framework.SearchColumnConfig.GetColumnConfig(typeof(ASL.Hr.DAO.OTSlab), columns), 500);
            }
            catch (Exception ex)
            {
                this.ErrorMessage = ("Error: <br>" + ex.Message + "<br>Call Stack: <br>" + ex.StackTrace);
            }
        }