예제 #1
0
        protected virtual void Shoot()
        {
            if (ammo == 0)
            {
                GlobalUtilities.ShowInteractMessage("Needs reload");
                return;
            }
            else if (this._lastShootTime < fireRate)
            {
                this._lastShootTime += Time.deltaTime;
                return;
            }

            this._lastShootTime = 0;
            ammo -= 1;


            // instantiate the projectile weapon
            GameObject child = (GameObject)Instantiate(
                this.projectile,
                transform.parent.position + (transform.parent.forward * 2),
                transform.parent.rotation
                );

            child.transform.localPosition = Camera.main.transform.position + (Camera.main.transform.forward * 3);
            child.transform.localRotation = Camera.main.transform.rotation * this.projectile.transform.rotation;
            child.transform.localScale    = this.projectile.transform.localScale;


            ProjectileWeapon projectile = child.GetComponent <ProjectileWeapon> ();

            projectile.speed *= _projectileSpeedMod;
            projectile.Damage = projectile.Damage * _projectileDamageMod;
            projectile.Project(Camera.main.transform.forward);
        }
예제 #2
0
        private void CreateProductMappings()
        {
            CreateMap <Product, OrderDetailRequest>()
            .ForMember(dest => dest.ItemCode, ops => ops.MapFrom(src => src.ItemCode))
            .ForMember(dest => dest.Quantity, ops => ops.MapFrom(src => src.Quantity))
            .ForMember(dest => dest.PriceEachOverride, ops => ops.MapFrom(src => src.PriceEachOverride))
            ;

            CreateMap <ItemResponse, Product>()
            .ForMember(dest => dest.ItemCode, ops => ops.MapFrom(src => src.ItemCode))
            .ForMember(dest => dest.Description, ops => ops.MapFrom(src => src.Description))
            .ForMember(dest => dest.ShortDetail, ops => ops.MapFrom(src => src.ShortDetail))
            .ForMember(dest => dest.ShortDetail4, ops => ops.MapFrom(src => src.ShortDetail4))
            .ForMember(dest => dest.LongDetail1, ops => ops.MapFrom(src => src.LongDetail))
            .ForMember(dest => dest.CategoryId, ops => ops.MapFrom(src => src.CategoryID))
            .ForMember(dest => dest.Price, ops => ops.MapFrom(src => src.Price))
            .ForMember(dest => dest.LargePicture, ops => ops.MapFrom(
                           src => GlobalUtilities.GetProductImagePath(src.LargePicture, src.ItemCode)))
            .ForMember(dest => dest.SmallPicture, ops => ops.MapFrom(
                           src => GlobalUtilities.GetProductImagePath(src.SmallPicture, src.ItemCode)))
            .ForMember(dest => dest.TinyPicture, ops => ops.MapFrom(
                           src => GlobalUtilities.GetProductImagePath(src.TinyPicture, src.ItemCode)))
            .ForMember(dest => dest.Field4, ops => ops.MapFrom(src => src.Field4))
            .ForMember(dest => dest.Field5, ops => ops.MapFrom(src => src.Field5))
            .ForMember(dest => dest.Field6, ops => ops.MapFrom(src => src.Field6))
            ;
        }
예제 #3
0
        public static int Insert(Codes o)
        {
            SqlParameter[] arrParams = new SqlParameter[14];

            arrParams[0]  = new SqlParameter("@CTID", GlobalUtilities.DBSafeValue(o.CTID, o.CTID.GetTypeCode()));
            arrParams[1]  = new SqlParameter("@Code", GlobalUtilities.DBSafeValue(o.Code, o.Code.GetTypeCode()));
            arrParams[2]  = new SqlParameter("@Description", GlobalUtilities.DBSafeValue(o.Description, o.Description.GetTypeCode()));
            arrParams[3]  = new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode()));
            arrParams[4]  = new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode()));
            arrParams[5]  = new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode()));
            arrParams[6]  = new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode()));
            arrParams[7]  = new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode()));
            arrParams[8]  = new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode()));
            arrParams[9]  = new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode()));
            arrParams[10] = new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode()));
            arrParams[11] = new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode()));
            arrParams[12] = new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode()));

            arrParams[13]           = new SqlParameter("@CID", GlobalUtilities.DBSafeValue(o.CID, o.CID.GetTypeCode()));
            arrParams[13].Direction = ParameterDirection.Output;

            SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Code_Insert", arrParams);

            o.CID = int.Parse(arrParams[13].Value.ToString());

            return(o.CID);
        }
        public IEnumerable <IProduct> GetProducts(IOrderConfiguration configuration, int categoryID = 0, bool returnLongDetails = true)
        {
            if (categoryID == 0)
            {
                categoryID = configuration.CategoryID;
            }

            // Get the products
            var response = Exigo.WebService().GetItems(new GetItemsRequest
            {
                WarehouseID         = configuration.WarehouseID,
                PriceType           = configuration.PriceTypeID,
                LanguageID          = GlobalUtilities.GetCurrentLanguageID(),
                CurrencyCode        = configuration.CurrencyCode,
                RestrictToWarehouse = true,
                ReturnLongDetail    = returnLongDetails,
                WebID         = 1,
                WebCategoryID = categoryID
            });


            foreach (var item in response.Items)
            {
                yield return((Item)item);
            }
        }
예제 #5
0
        bool onlyOne = false;                                                                       // View session live for more details.

        /*
         * MainPage - Constructor, initialize the componets, make sure there is no live session in the database
         * Fill projetcs list.
         */
        public MainPage()
        {
            List <Project> ProjectsL;

            if (database.GetUser() == null)
            {
                Settings temp_settings = new Settings();
                ProjectsL = new List <Project>();
                user      = new User("Erick", temp_settings, ProjectsL);
                database.SaveUser(user);
            }
            else
            {
                user          = database.GetUser();
                user.projects = database.GetProjectUser(user.Id);
            }
            InitializeComponent();
            live = database.GetliveSession();
            if (live != null)
            {
                DisplayAlert("Session left Live", "The appplication was closed and a session was alive the end time was set to now, this can be change on the edit option for the session.", "OK");
                live.end = DateTime.Now;
                database.UpdateSession(live);
            }
            Proyects.ItemTapped += OnSelection;
            GlobalUtilities.setAccel();
        }
예제 #6
0
        public static int Insert(SchoolCrosswalk o)
        {
            SqlParameter[] arrParams = new SqlParameter[19];

            arrParams[0] = new SqlParameter("@SchoolID", GlobalUtilities.DBSafeValue(o.SchoolID, o.SchoolID.GetTypeCode()));
            arrParams[1] = new SqlParameter("@SchTypeID", GlobalUtilities.DBSafeValue(o.SchTypeID, o.SchTypeID.GetTypeCode()));
            arrParams[2] = new SqlParameter("@DistrictID", GlobalUtilities.DBSafeValue(o.DistrictID, o.DistrictID.GetTypeCode()));
            arrParams[3] = new SqlParameter("@City", GlobalUtilities.DBSafeValue(o.City, o.City.GetTypeCode()));
            arrParams[4] = new SqlParameter("@MinGrade", GlobalUtilities.DBSafeValue(o.MinGrade, o.MinGrade.GetTypeCode()));
            arrParams[5] = new SqlParameter("@MaxGrade", GlobalUtilities.DBSafeValue(o.MaxGrade, o.MaxGrade.GetTypeCode()));
            arrParams[6] = new SqlParameter("@MinAge", GlobalUtilities.DBSafeValue(o.MinAge, o.MinAge.GetTypeCode()));
            arrParams[7] = new SqlParameter("@MaxAge", GlobalUtilities.DBSafeValue(o.MaxAge, o.MaxAge.GetTypeCode()));

            arrParams[8]  = new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode()));
            arrParams[9]  = new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode()));
            arrParams[10] = new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode()));
            arrParams[11] = new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode()));
            arrParams[12] = new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode()));
            arrParams[13] = new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode()));
            arrParams[14] = new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode()));
            arrParams[15] = new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode()));
            arrParams[16] = new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode()));
            arrParams[17] = new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode()));

            arrParams[18]           = new SqlParameter("@ID", GlobalUtilities.DBSafeValue(o.ID, o.ID.GetTypeCode()));
            arrParams[18].Direction = ParameterDirection.Output;

            SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_SchoolCrosswalk_Insert", arrParams);

            o.ID = int.Parse(arrParams[18].Value.ToString());

            return(o.ID);
        }
예제 #7
0
    private void UpdateFingersBasedOnTouch()
    {
        if (fingers == null)
        {
            fingers = new GameObject[] { finger1, finger2, finger3, finger4, finger5 };
        }
        lock (curAvaiPointers.AccessLock)
        {
            if (curAvaiPointers.CriticData == null)
            {
                return;
            }
            TouchPointerData[] avaiPointers = (TouchPointerData[])curAvaiPointers.CriticData;
            for (int i = 0; i < fingers.Length; i++)
            {
                GameObject finger = fingers[i];
                if (finger == null)
                {
                    continue;
                }
                if (i < avaiPointers.Length)
                {
                    finger.SetActive(true);

                    Vector2 relPosInPad = GlobalUtilities.ConvertMobileRelPosToUnityRelPos(new Vector2(avaiPointers[i].RelX, avaiPointers[i].RelY));
                    finger.transform.localPosition = new Vector3(relPosInPad.x, relPosInPad.y, finger.transform.localPosition.z);
                }
                else
                {
                    finger.SetActive(false);
                }
            }
        }
    }
        public IEnumerable <IItem> GetProducts(IOrderConfiguration configuration, string[] itemcodes)
        {
            var results = new List <IItem>();

            if (itemcodes.Length == 0)
            {
                yield break;
            }

            // Get the products
            var response = Exigo.WebService().GetItems(new GetItemsRequest
            {
                WarehouseID         = configuration.WarehouseID,
                PriceType           = configuration.PriceTypeID,
                LanguageID          = GlobalUtilities.GetCurrentLanguageID(),
                CurrencyCode        = configuration.CurrencyCode,
                RestrictToWarehouse = true,
                ReturnLongDetail    = true,
                ItemCodes           = itemcodes.Distinct().ToArray()
            });


            foreach (var item in response.Items)
            {
                yield return((Item)item);
            }
        }
예제 #9
0
        public static int Update(Codes o)
        {
            int iReturn = -1; //assume the worst

            SqlParameter[] arrParams = new SqlParameter[14];

            arrParams[0] = new SqlParameter("@CID", GlobalUtilities.DBSafeValue(o.CID, o.CID.GetTypeCode()));
            arrParams[1] = new SqlParameter("@CTID", GlobalUtilities.DBSafeValue(o.CTID, o.CTID.GetTypeCode()));
            arrParams[2] = new SqlParameter("@Code", GlobalUtilities.DBSafeValue(o.Code, o.Code.GetTypeCode()));
            arrParams[3] = new SqlParameter("@Description", GlobalUtilities.DBSafeValue(o.Description, o.Description.GetTypeCode()));

            arrParams[4]  = new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode()));
            arrParams[5]  = new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode()));
            arrParams[6]  = new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode()));
            arrParams[7]  = new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode()));
            arrParams[8]  = new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode()));
            arrParams[9]  = new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode()));
            arrParams[10] = new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode()));
            arrParams[11] = new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode()));
            arrParams[12] = new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode()));
            arrParams[13] = new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode()));

            try
            {
                iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Code_Update", arrParams);
            }

            catch (SqlException exx)
            {
                System.Diagnostics.Debug.Write(exx.Message);
            }

            return(iReturn);
        }
예제 #10
0
        public UserIdentity(System.Web.Security.FormsAuthenticationTicket ticket)
        {
            string[] a = ticket.UserData.Split('|');
            Name = ticket.Name;

            // WebIdentity Variables
            CustomerID = int.Parse(GlobalUtilities.Coalesce(a[0], "0"));
            FirstName  = GlobalUtilities.Coalesce(a[1], "");
            LastName   = GlobalUtilities.Coalesce(a[2], "");
            Company    = GlobalUtilities.Coalesce(a[3], "");
            Country    = GlobalUtilities.Coalesce(a[4], "");

            EnrollerID = Convert.ToInt32(a[5]);
            SponsorID  = Convert.ToInt32(a[6]);

            LanguageID         = int.Parse(GlobalUtilities.Coalesce(a[7], Languages.English.ToString()));
            CustomerTypeID     = int.Parse(GlobalUtilities.Coalesce(a[8], CustomerTypes.Distributor.ToString()));
            CustomerStatusID   = int.Parse(GlobalUtilities.Coalesce(a[9], CustomerStatusTypes.Active.ToString()));
            DefaultWarehouseID = int.Parse(GlobalUtilities.Coalesce(a[10], Warehouses.Default.ToString()));
            PriceTypeID        = int.Parse(GlobalUtilities.Coalesce(a[11], PriceTypes.Distributor.ToString()));
            CurrencyCode       = GlobalUtilities.Coalesce(a[12], "usd");
            CreatedDate        = Convert.ToDateTime(a[13]);

            Expires = ticket.Expiration;
        }
예제 #11
0
        /// <summary>
        /// Updates content block in ContentItemCountryLanguages table and deletes from cache.
        /// </summary>
        /// <param name="contentBlock"></param>
        public static void SetContentBlock(ContentItem contentBlock)
        {
            ContentService.SetContentItemCountryLanguages(contentBlock);

            //Deletes content item ID from cache after modifying block, so that page will reload from DB instead of pulling from cache
            GlobalUtilities.DeleteFromCache(contentBlock.ContentItemID.ToString().ToUpper() + contentBlock.CountryID + contentBlock.LanguageID.ToString());
        }
예제 #12
0
        protected override void Update()
        {
            base.Update();

            bool holding = CrossPlatformInputManager.GetButton(GlobalUtilities.ATTACK_1);

            if (this._isBeingHeld)
            {
                if (ammo == 0)
                {
                    GlobalUtilities.ShowInteractMessage("Reloading... " + this._lastReloadTime + "/" + this.reloadTime);
                    this._isReloading = true;
                    this._heldTime    = 0;
                }
                else
                {
                    if (holding)
                    {
                        this._heldTime += Time.deltaTime;
                        this._heldTime  = Mathf.Min(this._heldTime, this.maxHoldTime);
                    }
                    else
                    {
                        this._heldTime = 0;
                    }

                    this._projectileSpeedMod = this._projectileDamageMod = this._heldTime / this.maxHoldTime;
                }
            }
        }
        public Rank GetCurrentRank(int CustomerID, int PeriodTypeID)
        {
            var result = new Rank();

            var response = GetContext().PeriodVolumes
                           .Where(c => c.CustomerID == CustomerID)
                           .Where(c => c.PeriodTypeID == PeriodTypeID)
                           .Where(c => c.Period.IsCurrentPeriod)
                           .Select(c => new
            {
                RankID          = c.PaidRankID,
                RankDescription = c.PaidRank.RankDescription
            })
                           .FirstOrDefault();

            if (response == null)
            {
                return(null);
            }

            result.RankID          = response.RankID;
            result.RankDescription = GlobalUtilities.Coalesce(response.RankDescription, "Unknown");

            return(result);
        }
        public static int Insert(LibraryCrosswalk o)
        {
            var arrParams = new List <SqlParameter>();

            arrParams.Add(new SqlParameter("@BranchID", GlobalUtilities.DBSafeValue(o.BranchID, o.BranchID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@DistrictID", GlobalUtilities.DBSafeValue(o.DistrictID, o.DistrictID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@City", GlobalUtilities.DBSafeValue(o.City, o.City.GetTypeCode())));

            arrParams.Add(new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())));

            arrParams.Add(new SqlParameter("@BranchLink", GlobalUtilities.DBSafeValue(o.BranchLink, o.FldText1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BranchAddress", GlobalUtilities.DBSafeValue(o.BranchAddress, o.FldText2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BranchTelephone", GlobalUtilities.DBSafeValue(o.BranchTelephone, o.FldText3.GetTypeCode())));

            var param = new SqlParameter("@ID", GlobalUtilities.DBSafeValue(o.ID, o.ID.GetTypeCode()));

            param.Direction = ParameterDirection.Output;
            arrParams.Add(param);
            SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_LibraryCrosswalk_Insert", arrParams.ToArray());

            o.ID = int.Parse(param.Value.ToString());

            return(o.ID);
        }
        public JsonNetResult SetAvatarFromUrl(string url)
        {
            // Get the bytes from the provided location
            var bytes = GlobalUtilities.GetExternalImageBytes(url);

            // Determine if the image is valid
            var isValidImage = false;

            try
            {
                var stream = new MemoryStream(bytes);
                var bitmap = Image.FromStream(stream);
                isValidImage = (bytes != null && bytes.Length > 0 && bitmap != null);
            }
            catch { }


            if (isValidImage)
            {
                // Save the image
                Exigo.Images().SaveUncroppedCustomerAvatar(Identity.Current.CustomerID, bytes);
            }

            return(new JsonNetResult(new
            {
                success = isValidImage,
                length = bytes.Length
            }));
        }
예제 #16
0
        public static Address SetCustomerAddressOnFile(int customerID, Address address, AddressType type)
        {
            var saveAddress = false;
            var request     = new UpdateCustomerRequest();

            request.CustomerID = customerID;

            // Attempt to validate the user's entered address if US address
            address = GlobalUtilities.ValidateAddress(address) as Address;

            // New Addresses
            if (type == AddressType.New)
            {
                return(ExigoDAL.SaveNewCustomerAddress(customerID, address));
            }

            // Main address
            if (type == AddressType.Main)
            {
                saveAddress          = true;
                request.MainAddress1 = address.Address1;
                request.MainAddress2 = address.Address2 ?? string.Empty;
                request.MainCity     = address.City;
                request.MainState    = address.State;
                request.MainZip      = address.Zip;
                request.MainCountry  = address.Country;
            }

            // Mailing address
            if (type == AddressType.Mailing)
            {
                saveAddress          = true;
                request.MailAddress1 = address.Address1;
                request.MailAddress2 = address.Address2 ?? string.Empty;
                request.MailCity     = address.City;
                request.MailState    = address.State;
                request.MailZip      = address.Zip;
                request.MailCountry  = address.Country;
            }

            // Other address
            if (type == AddressType.Other)
            {
                saveAddress           = true;
                request.OtherAddress1 = address.Address1;
                request.OtherAddress2 = address.Address2 ?? string.Empty;
                request.OtherCity     = address.City;
                request.OtherState    = address.State;
                request.OtherZip      = address.Zip;
                request.OtherCountry  = address.Country;
            }

            if (saveAddress)
            {
                ExigoDAL.WebService().UpdateCustomer(request);
                ExigoDAL.PurgeCustomer(customerID);
            }

            return(address);
        }
예제 #17
0
        public static int Delete(Badge o)
        {
            int iReturn = -1; //assume the worst

            SqlParameter[] arrParams = new SqlParameter[1];

            arrParams[0] = new SqlParameter("@BID", GlobalUtilities.DBSafeValue(o.BID, o.BID.GetTypeCode()));

            try
            {
                var fileName = (HttpContext.Current.Server.MapPath("~/Images/Badges/") + "\\" + o.BID.ToString() + ".png");
                File.Delete(fileName);
                fileName = (HttpContext.Current.Server.MapPath("~/Images/Badges/") + "\\sm_" + o.BID.ToString() + ".png");
                File.Delete(fileName);
                fileName = (HttpContext.Current.Server.MapPath("~/Images/Badges/") + "\\md_" + o.BID.ToString() + ".png");
                File.Delete(fileName);

                iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Badge_Delete", arrParams);
            }

            catch (SqlException exx)
            {
                "GRA.SRP.DAL.Badge".Log().Error("Error deleting Badge: {0} - {1}",
                                                exx.Message,
                                                exx.StackTrace);

                System.Diagnostics.Debug.Write(exx.Message);
            }
            return(iReturn);
        }
예제 #18
0
        public static int Update(Event o)
        {
            int iReturn   = -1; //assume the worst
            var arrParams = new List <SqlParameter>();

            arrParams.Add(new SqlParameter("@EID", GlobalUtilities.DBSafeValue(o.EID, o.EID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EventTitle", GlobalUtilities.DBSafeValue(o.EventTitle, o.EventTitle.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EventDate", GlobalUtilities.DBSafeValue(o.EventDate, o.EventDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EventTime", GlobalUtilities.DBSafeValue(o.EventTime, o.EventTime.GetTypeCode())));
            string html = o.HTML;

            if (!string.IsNullOrWhiteSpace(html) && html.EndsWith(TrailingBr))
            {
                html = html.Substring(0, html.Length - TrailingBr.Length);
            }
            arrParams.Add(new SqlParameter("@HTML", GlobalUtilities.DBSafeValue(html, html.GetTypeCode())));
            arrParams.Add(new SqlParameter("@SecretCode", GlobalUtilities.DBSafeValue(o.SecretCode, o.SecretCode.GetTypeCode())));
            arrParams.Add(new SqlParameter("@NumberPoints", GlobalUtilities.DBSafeValue(o.NumberPoints, o.NumberPoints.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BadgeID", GlobalUtilities.DBSafeValue(o.BadgeID, o.BadgeID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BranchID", GlobalUtilities.DBSafeValue(o.BranchID, o.BranchID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@Custom1", GlobalUtilities.DBSafeValue(o.Custom1, o.Custom1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@Custom2", GlobalUtilities.DBSafeValue(o.Custom2, o.Custom2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@Custom3", GlobalUtilities.DBSafeValue(o.Custom3, o.Custom3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModDate", GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModUser", GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedDate", GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedUser", GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode())));

            arrParams.Add(new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())));

            arrParams.Add(new SqlParameter("@ShortDescription", GlobalUtilities.DBSafeValue(o.ShortDescription, o.ShortDescription.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EndDate", GlobalUtilities.DBSafeValue(o.EndDate, o.EndDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EndTime", GlobalUtilities.DBSafeValue(o.EndTime, o.EndTime.GetTypeCode())));

            arrParams.Add(new SqlParameter("@ExternalLinkToEvent", GlobalUtilities.DBSafeValue(o.ExternalLinkToEvent, o.ExternalLinkToEvent.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HiddenFromPublic", GlobalUtilities.DBSafeValue(o.HiddenFromPublic, o.HiddenFromPublic.GetTypeCode())));

            try
            {
                iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Event_Update", arrParams.ToArray());
            }
            catch (SqlException exx)
            {
                "GRA.SRP.DAL.Event".Log().Error("Error updating Event: {0} - {1}",
                                                exx.Message,
                                                exx.StackTrace);
                System.Diagnostics.Debug.Write(exx.Message);
            }

            return(iReturn);
        }
예제 #19
0
 protected override void OnTriggerEnter(Collider hit)
 {
     if (hit.CompareTag(GlobalUtilities.LOCAL_PLAYER_TAG))
     {
         GlobalUtilities.ShowWarningMessage("Warning! You are leaving the game area please turn back!");
     }
 }
예제 #20
0
 protected override void OnTriggerExit(Collider hit)
 {
     if (hit.CompareTag(GlobalUtilities.LOCAL_PLAYER_TAG))
     {
         GlobalUtilities.ClearWarningText();
     }
 }
예제 #21
0
        /// <summary>
        /// Creates and edits an alert.
        /// </summary>
        public static void SetAlert(ContentItem content)
        {
            // Create alert, else edit alert.
            if (content.ContentItemID == null)
            {
                content.CountryID = content.CountryIDList != null?String.Join(", ", content.CountryIDList.ToArray()) : "";

                // Send item to CreateContentItem Exigo service to create alert in database.
                var contentItem = ContentService.SetContentItems(content);

                // For each country/language set, create one entry in the ContentItemCountryLanguage DB.
                ContentService.SetContentItemCountryLanguages(contentItem);
            }
            else
            {
                // Send ContentItem to EditContentItems exigo service.
                ContentService.SetContentItems(content);

                // Delete ContentItem from ContentItemCountryLanguage DB since we will re-set the country/language availability.
                ContentService.DeleteContentItemCountryLanguages(content.ContentItemID.ToString());

                //// Create one entry for each country/language selected.
                ContentService.SetContentItemCountryLanguages(content);

                //Deletes content item ID from cache after modifying block, so that page will reload from DB instead of pulling from cache.
                GlobalUtilities.DeleteFromCache(content.ContentItemID.ToString());
            }
        }
예제 #22
0
        //public byte[] GetCustomerAvatar(int customerID, AvatarType type, bool cache = true)
        //{
        //    var bytes = new byte[0];


        //    // Try to return the image found at the avatar path
        //    bytes = GlobalUtilities.GetExternalImageBytes(GlobalUtilities.GetCustomerAvatarUrl(customerID, type, cache));


        //    // If we didn't find anything there, convert the default image (which is Base64) to a byte array.
        //    // We'll use that instead
        //    if (bytes == null || bytes.Length == 0)
        //    {
        //        Exigo.Images().SetCustomerAvatar(customerID, Convert.FromBase64String(GlobalSettings.Avatars.DefaultAvatarAsBase64));
        //        return GetCustomerAvatar(customerID, type, cache);
        //    }

        //    return bytes;
        //}

        //public bool SaveUncroppedCustomerAvatar(int customerID, byte[] bytes)
        //{
        //    // Define the customer profile settings
        //    var path = "customers/{0}".FormatWith(customerID);
        //    var filename = "avatar-raw.png";
        //    var maxWidth = 500;
        //    var maxHeight = 500;

        //    // Resize the image
        //    var resizedBytes = GlobalUtilities.ResizeImage(bytes, maxWidth, maxHeight);

        //    // Save the image
        //    return SaveImage(path, filename, resizedBytes);
        //}
        public bool SetCustomerAvatar(int customerID, byte[] bytes, bool saveToHistory = false)
        {
            //// Define the customer profile settings
            //var path      = "customers/{0}".FormatWith(customerID);

            //// Resize and save the images for each of the sizes
            //var result = false;
            //result = SaveImage(path, "avatar-lg.png", GlobalUtilities.ResizeImage(bytes, 300, 300));
            //result = SaveImage(path, "avatar.png", GlobalUtilities.ResizeImage(bytes, 100, 100));
            //result = SaveImage(path, "avatar-sm.png", GlobalUtilities.ResizeImage(bytes, 50, 50));
            //result = SaveImage(path, "avatar-xs.png", GlobalUtilities.ResizeImage(bytes, 16, 16));

            //// Save the image to the avatar history if applicable
            //if (result && saveToHistory)
            //{
            //    SaveCustomerAvatarToHistory(customerID, GlobalUtilities.ResizeImage(bytes, 300, 300));
            //}

            //return result;
            bool result = ((GlobalUtilities.InsertOrUpdateAvatarToAPI(customerID, bytes) ? GlobalUtilities.InsertOrUpdateAvatarToReportingDatabase(customerID, bytes) : false));

            if (result && saveToHistory)
            {
                SaveCustomerAvatarToHistory(customerID, bytes);
            }
            return(result);
        }
예제 #23
0
        public SubscriptionsController()
        {
            //We create this object to retrieve the user's currently selected market
            var CurrentMarket = GlobalUtilities.GetCurrentMarket();

            //We create an auto order configuration based off of their currently selected market
            this.OrderConfiguration = GlobalUtilities.GetMarketConfiguration(CurrentMarket.Name).BackOfficeOrders;
        }
예제 #24
0
 public void OnTriggerExit(Collider hit)
 {
     GlobalUtilities.ClearInteractText();
     if (this._currentInteractionObject == hit)
     {
         this._currentInteractionObject = null;
     }
 }
예제 #25
0
        public static void TenantInitialize(int src, int dst)
        {
            SqlParameter[] arrParams = new SqlParameter[2];

            arrParams[0] = new SqlParameter("@src", GlobalUtilities.DBSafeValue(src, src.GetTypeCode()));
            arrParams[1] = new SqlParameter("@dst", GlobalUtilities.DBSafeValue(dst, dst.GetTypeCode()));
            SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Event_InitTenant", arrParams);
        }
        public ActionResult Register(string ReturnUrl, AccountRegistrationViewModel model)
        {
            try
            {
                // Get the current market
                var configuration = CurrentMarket.Configuration.Orders;

                // Create the request
                var request = new CreateCustomerRequest();

                request.InsertEnrollerTree = true;
                request.FirstName          = model.Customer.FirstName;
                request.LastName           = model.Customer.LastName;
                request.Email              = model.Customer.Email;
                request.CanLogin           = true;
                request.LoginName          = model.Customer.LoginName;
                request.LoginPassword      = model.Password;
                request.CustomerType       = CustomerTypes.RetailCustomer;
                request.CustomerStatus     = CustomerStatuses.Active;
                request.EntryDate          = DateTime.Now.ToCST();
                request.DefaultWarehouseID = configuration.WarehouseID;
                request.CurrencyCode       = configuration.CurrencyCode;
                request.LanguageID         = GlobalUtilities.GetSelectedLanguage(this.HttpContext).LanguageID;
                request.EnrollerID         = Identity.Owner.CustomerID;
                request.MainCountry        = CurrentMarket.MainCountry;

                // Create the customer
                var response = ExigoDAL.WebService().CreateCustomer(request);

                // Opt in the customer if they choose to receive emails
                if (model.Customer.IsOptedIn)
                {
                    ExigoDAL.SendEmailVerification(response.CustomerID, request.Email);
                }

                // Sign in the customer
                var service = new IdentityService();
                service.SignIn(model.Customer.LoginName, model.Password);

                // Redirect the customer to the appropriate place, depending on if they got here from shopping
                if (ReturnUrl.IsNotEmpty())
                {
                    return(Redirect(ReturnUrl));
                }
                else
                {
                    return(RedirectToAction("index", "account", new { webalias = Identity.Owner.WebAlias }));
                }
            }
            catch (Exception ex)
            {
                var newModel = new AccountRegistrationViewModel();
                newModel.ErrorMessage = ex.Message;
                model.ReturnUrl       = ReturnUrl;

                return(View(newModel));
            }
        }
        public ActionResult SetHistoricalAvatar(string url)
        {
            // Get the bytes from the provided location
            var bytes = GlobalUtilities.GetExternalImageBytes(url);

            Exigo.Images().SetCustomerAvatar(Identity.Current.CustomerID, bytes);

            return(RedirectToAction("ManageAvatar"));
        }
예제 #28
0
 private static void PopulateItemImages(IEnumerable <Item> items)
 {
     foreach (var item in items)
     {
         item.TinyImageUrl  = GlobalUtilities.GetProductImagePath(item.TinyImageUrl);
         item.SmallImageUrl = GlobalUtilities.GetProductImagePath(item.SmallImageUrl);
         item.LargeImageUrl = GlobalUtilities.GetProductImagePath(item.LargeImageUrl);
     }
 }
예제 #29
0
 public ShoppingCartItem(IShoppingCartItem item)
 {
     ID                  = (item.ID != Guid.Empty) ? item.ID : Guid.NewGuid();
     ItemCode            = GlobalUtilities.Coalesce(item.ItemCode);
     Quantity            = item.Quantity;
     GroupMasterItemCode = GlobalUtilities.Coalesce(item.GroupMasterItemCode);
     Type                = item.Type;
     Children            = item.Children;
 }
예제 #30
0
        public static int Insert(Event o)
        {
            var arrParams = new List <SqlParameter>();

            arrParams.Add(new SqlParameter("@EventTitle", GlobalUtilities.DBSafeValue(o.EventTitle, o.EventTitle.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EventDate", GlobalUtilities.DBSafeValue(o.EventDate, o.EventDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EventTime", GlobalUtilities.DBSafeValue(o.EventTime, o.EventTime.GetTypeCode())));

            string html = o.HTML;

            if (!string.IsNullOrWhiteSpace(html) && html.EndsWith(TrailingBr))
            {
                html = html.Substring(0, html.Length - TrailingBr.Length);
            }

            arrParams.Add(new SqlParameter("@HTML", GlobalUtilities.DBSafeValue(html, html.GetTypeCode())));
            arrParams.Add(new SqlParameter("@SecretCode", GlobalUtilities.DBSafeValue(o.SecretCode, o.SecretCode.GetTypeCode())));
            arrParams.Add(new SqlParameter("@NumberPoints", GlobalUtilities.DBSafeValue(o.NumberPoints, o.NumberPoints.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BadgeID", GlobalUtilities.DBSafeValue(o.BadgeID, o.BadgeID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BranchID", GlobalUtilities.DBSafeValue(o.BranchID, o.BranchID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@Custom1", GlobalUtilities.DBSafeValue(o.Custom1, o.Custom1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@Custom2", GlobalUtilities.DBSafeValue(o.Custom2, o.Custom2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@Custom3", GlobalUtilities.DBSafeValue(o.Custom3, o.Custom3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModDate", GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModUser", GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedDate", GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedUser", GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode())));

            arrParams.Add(new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())));

            arrParams.Add(new SqlParameter("@ShortDescription", GlobalUtilities.DBSafeValue(o.ShortDescription, o.ShortDescription.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EndDate", GlobalUtilities.DBSafeValue(o.EndDate, o.EndDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EndTime", GlobalUtilities.DBSafeValue(o.EndTime, o.EndTime.GetTypeCode())));

            arrParams.Add(new SqlParameter("@ExternalLinkToEvent", GlobalUtilities.DBSafeValue(o.ExternalLinkToEvent, o.ExternalLinkToEvent.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HiddenFromPublic", GlobalUtilities.DBSafeValue(o.HiddenFromPublic, o.HiddenFromPublic.GetTypeCode())));

            var param = new SqlParameter("@EID", GlobalUtilities.DBSafeValue(o.EID, o.EID.GetTypeCode()));

            param.Direction = ParameterDirection.Output;
            arrParams.Add(param);

            SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Event_Insert", arrParams.ToArray());

            o.EID = int.Parse(param.Value.ToString());

            return(o.EID);
        }