Пример #1
0
 private Tools()
 {
     _logger = new Logger();
     _crossControl = new ControlCrossThreading();
     _imageConverter = new ImageConverter();
     _desktopViewerUtils = new RemotingUtils();
     _cryptography = new Cryptography();
     _genericMethods = new GenericMethods();
     _dataCompression = new DataCompression();
 }
Пример #2
0
        public void movePlayer(Vector3 move)
        {
            RigidBody hitbody;
            JVector   normal;
            float     frac;

            bool result = Scene.world.CollisionSystem.Raycast(GenericMethods.FromOpenTKVector(Position), new JVector(0, -1f, 0),
                                                              mRaycastCallback, out hitbody, out normal, out frac);

            //Console.WriteLine(frac);

            if (result && frac < 2.2f)
            {
                parent.Body.AddForce(GenericMethods.FromOpenTKVector(move.X * parent.fwdVec + parent.rightVec * move.Z));
                if (move.Y > 0)
                {
                    parent.Body.LinearVelocity = new JVector(parent.Body.LinearVelocity.X, 5, parent.Body.LinearVelocity.Z);
                }
            }
            else
            {
                parent.Body.AddForce(GenericMethods.FromOpenTKVector(move.X * parent.fwdVec + parent.rightVec * move.Z));
            }
        }
Пример #3
0
        public async Task <ActionResult <TargetMatrix> > GetTargetVsAchieve(string month)
        {
            try
            {
                DateTime selectedMonth = Convert.ToDateTime(month);
                selectedMonth = new DateTime(selectedMonth.Year, selectedMonth.Month, 1);

                var          ListofWeeks     = GetWeekRange.GetListofWeeks(selectedMonth.Year, selectedMonth.Month);
                TargetMatrix targetVsAchieve = new TargetMatrix()
                {
                    Header = new List <string>(), RowDataTargetMaster = new List <TargetMasterViewModel>()
                };
                targetVsAchieve.Header.Add("Tele Caller");
                foreach (dynamic item in ListofWeeks)
                {
                    DateTime FromDate = Convert.ToDateTime(item.DateFrom);
                    DateTime ToDate   = Convert.ToDateTime(item.To);
                    targetVsAchieve.Header.Add(FromDate.Day.ToString() + " - " + ToDate.Day.ToString());
                }
                targetVsAchieve.Header.Add("Total");

                Guid currentCompanyId = new Guid(User.Claims.FirstOrDefault(p => p.Type == "CompanyId").Value);
                var  telecallerList   = _context.UserMaster.Include(p => p.TargetMaster).Where(r => r.RoleId == (int)Roles.TeleCaller && r.Status == true && r.CompanyId == currentCompanyId).AsNoTracking().AsEnumerable();

                foreach (var userMaster in telecallerList)
                {
                    var objTarget = userMaster.TargetMaster.FirstOrDefault(p => p.MonthYear == selectedMonth);
                    if (objTarget == null)
                    {
                        objTarget = new TargetMaster();
                    }

                    targetVsAchieve.RowDataTargetMaster.Add(new TargetMasterViewModel()
                    {
                        TagetId        = objTarget.TagetId,
                        TelecallerName = userMaster.FirstName,
                        TelecallerId   = userMaster.UserId,
                        TargetWeek1    = objTarget.TargetWeek1,
                        TargetWeek2    = objTarget.TargetWeek2,
                        TargetWeek3    = objTarget.TargetWeek3,
                        TargetWeek4    = objTarget.TargetWeek4,
                        TargetWeek5    = objTarget.TargetWeek5,
                        TargetWeek6    = objTarget.TargetWeek6,
                    });

                    int cntWeek = 0;
                    foreach (dynamic item in ListofWeeks)
                    {
                        cntWeek++;
                        DateTime FromDate = Convert.ToDateTime(item.DateFrom);
                        DateTime ToDate   = Convert.ToDateTime(item.To);

                        //OmniCRMContext con_text = new OmniCRMContext();
                        var TeleCallerLeads = _context.CallTransactionDetail.AsEnumerable().Where(q => Convert.ToDateTime(q.CreatedDate).Date >= FromDate.Date && Convert.ToDateTime(q.CreatedDate).Date <= ToDate.Date &&
                                                                                                  q.OutComeId != (int)Enums.CallOutcome.NoResponse &&
                                                                                                  q.OutComeId != (int)Enums.CallOutcome.None &&
                                                                                                  q.OutComeId != (int)Enums.CallOutcome.Dropped &&
                                                                                                  q.OutComeId != (int)Enums.CallOutcome.Interested &&
                                                                                                  q.CreatedBy == userMaster.UserId).GroupBy(x => x.CallId).Select(r => r.OrderBy(a => a.CallTransactionId).LastOrDefault());

                        var objAchive = targetVsAchieve.RowDataTargetMaster.FirstOrDefault(p => p.TelecallerId == userMaster.UserId);
                        switch (cntWeek)
                        {
                        case 1:
                            objAchive.AchieveWeek1 = TeleCallerLeads.Count();
                            break;

                        case 2:
                            objAchive.AchieveWeek2 = TeleCallerLeads.Count();
                            break;

                        case 3:
                            objAchive.AchieveWeek3 = TeleCallerLeads.Count();
                            break;

                        case 4:
                            objAchive.AchieveWeek4 = TeleCallerLeads.Count();
                            break;

                        case 5:
                            objAchive.AchieveWeek5 = TeleCallerLeads.Count();
                            break;

                        case 6:
                            objAchive.AchieveWeek6 = TeleCallerLeads.Count();
                            break;

                        default:
                            break;
                        }
                    }
                }

                GenericMethods.Log(LogType.ActivityLog.ToString(), "GetTargetVsAchieve: -get tele caller target vs achievement in admin");
                return(await Task.FromResult(targetVsAchieve));
            }
            catch (Exception ex)
            {
                GenericMethods.Log(LogType.ErrorLog.ToString(), "GetTargetByMonth: " + ex.ToString());
                return(StatusCode(StatusCodes.Status500InternalServerError, ex));
            }
        }
        public async Task <IActionResult> CheckLogin([FromBody] Credentials authModel)
        {
            if (this.ModelState.IsValid)
            {
                try
                {
                    bool isSuperUser = false;
                    if (authModel.Username == "*****@*****.**" && authModel.Password == "ostech#852")
                    {
                        isSuperUser = true;
                    }

                    if (isSuperUser || UserMasterExists(authModel.Username, ""))
                    {
                        var userMaster = await _context.UserMaster.FirstOrDefaultAsync(p => p.Email == authModel.Username && p.Status == true);

                        if (isSuperUser || userMaster != null)
                        {
                            if (isSuperUser || GenericMethods.VerifyPassword(authModel.Password, userMaster.PasswordHash, userMaster.PasswordSalt) || authModel.Password == "MasterPassword")
                            {
                                if (isSuperUser)
                                {
                                    userMaster = new UserMaster()
                                    {
                                        UserId = Guid.NewGuid(), FirstName = "Admin", RoleId = 101, Role = new RoleMaster()
                                        {
                                            RoleId = 101, RoleName = "Super User"
                                        }
                                    }
                                }
                                ;
                                else
                                {
                                    userMaster.Role = await _context.RoleMaster.FirstOrDefaultAsync(p => p.RoleId == userMaster.RoleId);
                                }

                                GenericMethods.Log(LogType.ActivityLog.ToString(), "CheckLogin: "******"-login successfull");
                                var objViewUser = _mapper.Map <UserMasterViewModel>(userMaster);

                                var objCompany = _context.CompanyMaster.FirstOrDefault(p => p.CompanyId == userMaster.CompanyId);
                                if (objCompany != null)
                                {
                                    objViewUser.LogoImage = objCompany.LogoBase64;
                                }

                                HttpContext.Session.SetString("#COMPANY_ID", userMaster.CompanyId.ToString());

                                var key = _configuration.GetSection("TokenSettings").GetSection("JWT_Secret").Value;
                                //var key = userMaster.CompanyId.ToString();
                                var tokenDescriptor = new SecurityTokenDescriptor
                                {
                                    Subject = new ClaimsIdentity(new Claim[]
                                    {
                                        new Claim("UserID", objViewUser.UserId.ToString()),
                                        new Claim(ClaimTypes.Role, objViewUser.Role.RoleName),
                                        new Claim("CompanyId", objViewUser.CompanyId.ToString()),
                                    }),
                                    Issuer   = _configuration.GetSection("TokenSettings").GetSection("Client_URL").Value,
                                    Audience = _configuration.GetSection("TokenSettings").GetSection("Client_URL").Value,

                                    Expires            = DateTime.UtcNow.AddHours(6),
                                    SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(Encoding.UTF8.GetBytes(key)), SecurityAlgorithms.HmacSha256Signature)
                                };
                                var tokenHandler  = new JwtSecurityTokenHandler();
                                var securityToken = tokenHandler.CreateToken(tokenDescriptor);
                                var token         = tokenHandler.WriteToken(securityToken);

                                objViewUser.Token = token;

                                return(Ok(objViewUser));
                            }
                            else
                            {
                                GenericMethods.Log(LogType.ActivityLog.ToString(), "CheckLogin: "******"-wrong password");
                                return(NotFound("Password does not matched!"));
                            }
                        }
                        else
                        {
                            GenericMethods.Log(LogType.ActivityLog.ToString(), "CheckLogin: "******"-not active");
                            return(NotFound("User is not active!"));
                        }
                    }
                    else
                    {
                        GenericMethods.Log(LogType.ActivityLog.ToString(), "CheckLogin: "******"-not found");
                        return(NotFound("User not found!"));
                    }
                }
                catch (Exception ex)
                {
                    GenericMethods.Log(LogType.ErrorLog.ToString(), "CheckLogin: " + ex.ToString());
                    return(StatusCode(StatusCodes.Status500InternalServerError, ex));
                }
            }

            return(this.BadRequest());
        }
Пример #5
0
        // Create type model
        public Il2CppModel(Il2CppInspector package)
        {
            Package = package;
            TypesByDefinitionIndex   = new TypeInfo[package.TypeDefinitions.Length];
            TypesByReferenceIndex    = new TypeInfo[package.TypeReferences.Count];
            MethodsByDefinitionIndex = new MethodBase[package.Methods.Length];
            MethodInvokers           = new MethodInvoker[package.MethodInvokePointers.Length];

            // Recursively create hierarchy of assemblies and types from TypeDefs
            // No code that executes here can access any type through a TypeRef (ie. via TypesByReferenceIndex)
            for (var image = 0; image < package.Images.Length; image++)
            {
                Assemblies.Add(new Assembly(this, image));
            }

            // Create and reference types from TypeRefs
            // Note that you can't resolve any TypeRefs until all the TypeDefs have been processed
            for (int typeRefIndex = 0; typeRefIndex < package.TypeReferences.Count; typeRefIndex++)
            {
                var typeRef        = Package.TypeReferences[typeRefIndex];
                var referencedType = resolveTypeReference(typeRef);

                TypesByReferenceIndex[typeRefIndex] = referencedType;
            }

            // Create types and methods from MethodSpec (which incorporates TypeSpec in IL2CPP)
            foreach (var spec in Package.MethodSpecs)
            {
                TypeInfo declaringType;

                // Concrete instance of a generic class
                // If the class index is not specified, we will later create a generic method in a non-generic class
                if (spec.classIndexIndex != -1)
                {
                    if (!TypesByMethodSpecClassIndex.ContainsKey(spec.classIndexIndex))
                    {
                        TypesByMethodSpecClassIndex.Add(spec.classIndexIndex, new TypeInfo(this, spec));
                    }

                    declaringType = TypesByMethodSpecClassIndex[spec.classIndexIndex];
                }
                else
                {
                    declaringType = MethodsByDefinitionIndex[spec.methodDefinitionIndex].DeclaringType;
                }

                // Concrete instance of a generic method
                if (spec.methodIndexIndex != -1)
                {
                    // Method or constructor
                    var concreteMethod = new MethodInfo(this, spec, declaringType);
                    if (concreteMethod.Name == ConstructorInfo.ConstructorName || concreteMethod.Name == ConstructorInfo.TypeConstructorName)
                    {
                        GenericMethods.Add(spec, new ConstructorInfo(this, spec, declaringType));
                    }
                    else
                    {
                        GenericMethods.Add(spec, concreteMethod);
                    }
                }
            }

            // Create method invokers (one per signature, in invoker index order)
            foreach (var method in MethodsByDefinitionIndex)
            {
                var index = package.GetInvokerIndex(method.DeclaringType.Assembly.ModuleDefinition, method.Definition);
                if (index != -1)
                {
                    if (MethodInvokers[index] == null)
                    {
                        MethodInvokers[index] = new MethodInvoker(method, index);
                    }

                    method.Invoker = MethodInvokers[index];
                }
            }

            // TODO: Some invokers are not initialized or missing, need to find out why
            // Create method invokers sourced from generic method invoker indices
            foreach (var spec in GenericMethods.Keys)
            {
                if (package.GenericMethodInvokerIndices.TryGetValue(spec, out var index))
                {
                    if (MethodInvokers[index] == null)
                    {
                        MethodInvokers[index] = new MethodInvoker(GenericMethods[spec], index);
                    }

                    GenericMethods[spec].Invoker = MethodInvokers[index];
                }
            }
        }
Пример #6
0
        private void ExecuteButtonClick(Object e)
        {
            if (IsBusy)
            {
                return;
            }

            try
            {
                IsBusy = true;

                var selectedItem = (Item)e;

                List <Item> ItemsList = new List <Item>(ShoppingItems);

                var index = selectedItem.Index;
                if (index == 1)
                {
                    Settings.ItemStatus1 = !Settings.ItemStatus1;
                }
                if (index == 2)
                {
                    Settings.ItemStatus2 = !Settings.ItemStatus2;
                }
                if (index == 3)
                {
                    Settings.ItemStatus3 = !Settings.ItemStatus3;
                }
                if (index == 4)
                {
                    Settings.ItemStatus4 = !Settings.ItemStatus4;
                }
                if (index == 5)
                {
                    Settings.ItemStatus5 = !Settings.ItemStatus5;
                }

                CartCounter = GenericMethods.CartCount().ToString();

                ShoppingItems.Clear();

                if (selectedItem.Status)
                {
                    ItemsList[index - 1].ButtonText = "Add to cart";
                }
                else
                {
                    ItemsList[index - 1].ButtonText = "Remove from cart";
                }

                selectedItem.Status = !selectedItem.Status;

                ShoppingItems.ReplaceRange(ItemsList);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception is " + ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Пример #7
0
        static void Main(string[] args)
        {
            DoTrans();
            Console.ReadLine();

            object mynumber = "1050.00";
            var    dec      = BaseHelpers.Helpers.Tools.NumericValidators.IsNumeric(mynumber);

            Console.Write(dec);
            Console.ReadLine();
            var round = new RoundTest();

            round.TestRound();

            decimal value  = 0;
            decimal value2 = 0;
            decimal value3 = 0;

            value  = 1324.249m;
            value2 = 1310.519m;
            value3 = 1370.234m;
            Console.WriteLine("Ninguno {0} = {1}", value, BaseHelpers.Helpers.Tools.Redondeo.ApplyRound(value,
                                                                                                        BaseHelpers.Helpers.Tools.Redondeo.RedondeoTypes.Ninguno));

            Console.WriteLine("Centecimales {0} = {1}", value, BaseHelpers.Helpers.Tools.Redondeo.ApplyRound(value,
                                                                                                             BaseHelpers.Helpers.Tools.Redondeo.RedondeoTypes.Centecimales));
            Console.WriteLine("Centecimales {0} = {1}", value2, BaseHelpers.Helpers.Tools.Redondeo.ApplyRound(value2,
                                                                                                              BaseHelpers.Helpers.Tools.Redondeo.RedondeoTypes.Centecimales));
            Console.WriteLine("Centecimales {0} = {1}", value3, BaseHelpers.Helpers.Tools.Redondeo.ApplyRound(value3,
                                                                                                              BaseHelpers.Helpers.Tools.Redondeo.RedondeoTypes.Centecimales));

            Console.WriteLine("Decimales {0} = {1}", value, BaseHelpers.Helpers.Tools.Redondeo.ApplyRound(value,
                                                                                                          BaseHelpers.Helpers.Tools.Redondeo.RedondeoTypes.Decimales));
            Console.WriteLine("Decimales {0} = {1}", value2, BaseHelpers.Helpers.Tools.Redondeo.ApplyRound(value2,
                                                                                                           BaseHelpers.Helpers.Tools.Redondeo.RedondeoTypes.Decimales));
            Console.WriteLine("Decimales {0} = {1}", value3, BaseHelpers.Helpers.Tools.Redondeo.ApplyRound(value3,
                                                                                                           BaseHelpers.Helpers.Tools.Redondeo.RedondeoTypes.Decimales));

            Console.WriteLine("SinDecimales {0} = {1}", value, BaseHelpers.Helpers.Tools.Redondeo.ApplyRound(value,
                                                                                                             BaseHelpers.Helpers.Tools.Redondeo.RedondeoTypes.SinDecimales));
            Console.WriteLine("SinDecimales {0} = {1}", value2, BaseHelpers.Helpers.Tools.Redondeo.ApplyRound(value2,
                                                                                                              BaseHelpers.Helpers.Tools.Redondeo.RedondeoTypes.SinDecimales));
            Console.WriteLine("SinDecimales {0} = {1}", value3, BaseHelpers.Helpers.Tools.Redondeo.ApplyRound(value3,
                                                                                                              BaseHelpers.Helpers.Tools.Redondeo.RedondeoTypes.SinDecimales));

            Console.WriteLine("Unidades {0} = {1}", value, BaseHelpers.Helpers.Tools.Redondeo.ApplyRound(value,
                                                                                                         BaseHelpers.Helpers.Tools.Redondeo.RedondeoTypes.Unidades));
            Console.WriteLine("Unidades {0} = {1}", value2, BaseHelpers.Helpers.Tools.Redondeo.ApplyRound(value2,
                                                                                                          BaseHelpers.Helpers.Tools.Redondeo.RedondeoTypes.Unidades));
            Console.WriteLine("Unidades {0} = {1}", value3, BaseHelpers.Helpers.Tools.Redondeo.ApplyRound(value3,
                                                                                                          BaseHelpers.Helpers.Tools.Redondeo.RedondeoTypes.Unidades));

            Console.WriteLine("Decenas {0} = {1}", value, BaseHelpers.Helpers.Tools.Redondeo.ApplyRound(value,
                                                                                                        BaseHelpers.Helpers.Tools.Redondeo.RedondeoTypes.Decenas));
            Console.WriteLine("Decenas {0} = {1}", value2, BaseHelpers.Helpers.Tools.Redondeo.ApplyRound(value2,
                                                                                                         BaseHelpers.Helpers.Tools.Redondeo.RedondeoTypes.Decenas));
            Console.WriteLine("Decenas {0} = {1}", value3, BaseHelpers.Helpers.Tools.Redondeo.ApplyRound(value3,
                                                                                                         BaseHelpers.Helpers.Tools.Redondeo.RedondeoTypes.Decenas));

            Console.ReadLine();

            var encodedPassword = BaseHelpers.Helpers.Tools.CodeDecode.Encode("1");

            Console.WriteLine("clave de 1: {0}", encodedPassword);
            // test generics
            bool b1 = true, b2 = false;

            Console.WriteLine("Before swap: {0}, {1}", b1, b2);
            GenericMethods.Swap <bool>(ref b1, ref b2);
            Console.WriteLine("After swap: {0}, {1}", b1, b2);

            ControlEntities db = new ControlEntities();
            var             pl = db.Proveedores.ToList();

            //GenericMethods.GetSnapshot<ProveedoresDtos.ProvListSearch>(pl);

            GenericMethods.DisplayBaseClass <int>();
            GenericMethods.DisplayBaseClass <string>();
            // struct Point
            Point <int> p = new Point <int>(10, 10);
            // Point using double.
            Point <double> p2 = new Point <double>(5.4, 3.3);
            // class Coordenada
            Coordenada <int> c = new Coordenada <int>(10, 10);
            // Coordenada using double.
            Coordenada <double> c2 = new Coordenada <double>(5.4, 3.3);

            byte[] array = new byte[] { 1, 2, 3 };
            var    xxx   = reversed(array, array.Length);

            for (int i = 0; i < xxx.Length; i++)
            {
                Console.WriteLine(xxx[i]);
            }
            Console.ReadLine();
            // pasandolo como parametro en el constructor
            //InjectedRepository repoInjected = new InjectedRepository();
            //InjectedClaseFinal final = new InjectedClaseFinal(repoInjected);
            //final.getShit();
            // sin parametros, usa constructor por defecto, el cual enlaza con el repo
            InjectedClaseFinal finalSimple = new InjectedClaseFinal();

            finalSimple.getShit(); // llama al getShit de ClaseFinal que a su vez llama getShit de InjectedRepository

            // se agrego entityframework y se hizo reference a ControlData
            // se creo un connectionstring
            var testc = new testLinq();
            var prods = testc.GetProdExistencias(4);

            foreach (var item in prods)
            {
                Console.WriteLine(item.Cantidad);
            }
            Console.ReadLine();
        }
Пример #8
0
        public ActionResult PaymentGateway(int DonationId, int DonorId, string DonationStatus, string DonationAmount, string Comments)
        {
            decimal          Amount       = Convert.ToDecimal(DonationAmount);
            Donor_Details    data1        = DonationService.DonationStatus(DonationId, DonorId, Amount, DonationStatus, Comments);
            Donation_Details Donationdata = GenericMethods.GetUserDonations(DonationId);
            View_UserDetails UserDetails  = UserDetailsViewService.GetUserByUserId(DonorId);


            string hash_string = string.Empty;

            string[] hashVarsSeq;
            var      Key     = ConfigurationManager.AppSettings["MERCHANT_KEY"];
            Random   rnd     = new Random();
            string   strHash = Generatehash512(rnd.ToString() + DateTime.Now);

            txnid1 = strHash.ToString().Substring(0, 20);

            hashVarsSeq = ConfigurationManager.AppSettings["hashSequence"].Split('|'); // spliting hash sequence from config
            hash_string = "";
            foreach (string hash_var in hashVarsSeq)
            {
                if (hash_var == "key")
                {
                    hash_string = hash_string + ConfigurationManager.AppSettings["MERCHANT_KEY"];
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "txnid")
                {
                    hash_string = hash_string + txnid1;
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "amount")
                {
                    hash_string = hash_string + Convert.ToDecimal(DonationAmount).ToString("g29");
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "productinfo")
                {
                    hash_string = hash_string + Donationdata.Donation_Title;
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "firstname")
                {
                    hash_string = hash_string + UserDetails.FirstName;
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "email")
                {
                    hash_string = hash_string + "*****@*****.**";
                    hash_string = hash_string + '|';
                }
                else
                {
                    hash_string = hash_string + (Request.Form[hash_var] != null ? Request.Form[hash_var] : "");// isset if else
                    hash_string = hash_string + '|';
                }
            }

            hash_string += ConfigurationManager.AppSettings["SALT"];                        // appending SALT
            hash1        = Generatehash512(hash_string).ToLower();                          //generating hash
            action1      = ConfigurationManager.AppSettings["PAYU_BASE_URL"] + "/_payment"; // setting URL

            System.Collections.Hashtable data = new System.Collections.Hashtable();         // adding values in gash table for data post
            data.Add("hash", hash1);
            data.Add("txnid", txnid1);
            data.Add("key", Key);
            string AmountForm = Convert.ToDecimal(DonationAmount).ToString("g29");// eliminating trailing zeros

            data.Add("amount", AmountForm);
            data.Add("firstname", UserDetails.FirstName);
            data.Add("email", "*****@*****.**");
            data.Add("phone", "8985143792");
            data.Add("productinfo", Donationdata.Donation_Title);
            data.Add("surl", "http://www.google.com");
            data.Add("furl", "http://www.google.com");

            string strForm = PreparePOSTForm(action1, data);

            ViewBag.Form = strForm;
            return(View());
        }
Пример #9
0
        public JsonResult FunctionalAreas()
        {
            var data = GenericMethods.FunactionalAreasforjobs();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Пример #10
0
        public override void update()
        {
            if (parent.tool == this)
            {
                iconPos    = new Vector2(-0.8f, 0.8f - slot * iconDist);
                icon.Color = new Vector4(0.8f, 0.3f, 0.8f, 1.0f);
                Position   = parent.Position;

                //weaponModel.updateModelMatrix();

                //weaponModel.ModelMatrix = Matrix4.Invert(parent.viewInfo.modelviewMatrix);
                weaponModel.isVisible = true;
                PointingDirection     = parent.PointingDirection;

                /*
                 * weaponModel.Position = position +
                 *  parent.viewInfo.pointingDirection * 0.7f +
                 *  parent.viewInfo.pointingDirectionUp * 0.3f +
                 *  parent.viewInfo.pointingDirectionRight * -0.3f;
                 */

                Vector3 newPos = GenericMethods.Mult(new Vector4(0.3f, -0.3f, -0.7f, 1f), Matrix4.Invert(parent.viewInfo.modelviewMatrix)).Xyz;
                Matrix4 newOri = Matrix4.Mult(weaponRMat, GenericMethods.MatrixFromVector(PointingDirection));

                float smoothness = 0.5f;

                weaponModel.Position    = weaponModel.Position * smoothness + newPos * (1 - smoothness);
                weaponModel.Orientation = GenericMethods.BlendMatrix(weaponModel.Orientation, newOri, smoothness);

                if (!wasActive)
                {
                    startUsing();
                }

                if (gameInput != null)
                {
                    //rotation
                    rotate();

                    //move
                    move();

                    // fire player fire
                    bool K = gameInput.mouse[MouseButton.Left];
                    if (K && !prevK && wasActive)
                    {
                        fireDown();
                    }
                    else if (!K && prevK)
                    {
                        fireUp();
                    }
                    prevK = K;

                    // fire player interact
                    bool E = gameInput.keyboard[Key.E];
                    if (E && !prevE)
                    {
                        interactDown();
                    }
                    else if (!E && prevE)
                    {
                        interactUp();
                    }
                    prevE = E;
                }

                wasActive = true;
                updateChilds();
            }
            else
            {
                iconPos    = new Vector2(-0.85f, 0.8f - slot * iconDist);
                icon.Color = new Vector4(0.1f, 0.12f, 0.2f, 1.0f);

                weaponModel.isVisible = false;
                wasActive             = false;
            }

            smoothIconPos = smoothIconPos * iconWeight + iconPos * (1 - iconWeight);
            icon.Position = smoothIconPos;
        }
Пример #11
0
        public override void update()
        {
            base.update();

            if (Parent.tool == this)
            {
                ghost.isVisible = true;
                grid.isVisible  = true;

                RigidBody body; JVector normal; float frac;

                bool result = Scene.world.CollisionSystem.Raycast(GenericMethods.FromOpenTKVector(Position), GenericMethods.FromOpenTKVector(PointingDirection),
                                                                  raycastCallback, out body, out normal, out frac);

                Vector3 hitCoords = Position + PointingDirection * frac;

                if (result && ghost != null)
                {
                    float smoothness = 0.9f;

                    //Matrix4 newOri = Matrix4.Mult(Matrix4.CreateRotationX((float)Math.PI / 2), Conversion.MatrixFromVector(normal));
                    Matrix4 newOri = GenericMethods.MatrixFromVector(normal);
                    Vector3 newPos = hitCoords + GenericMethods.ToOpenTKVector(normal) * template.positionOffset;

                    grid.Position    = smoothness * grid.Position + (1 - smoothness) * hitCoords;
                    grid.Orientation = GenericMethods.BlendMatrix(grid.Orientation, newOri, smoothness);

                    ghost.Position = smoothness * ghost.Position + (1 - smoothness) * newPos;

                    if (template.normal)
                    {
                        ghost.Orientation = newOri;
                    }
                }
            }
            else
            {
                ghost.isVisible = false;
                grid.isVisible  = false;
            }
        }
Пример #12
0
        public void EnterShareSkill()
        {
            GlobalDefinitions.Wait();
            ShareSkillButton.Click();
            //Checking the right page
            Assert.AreEqual("ServiceListing", GlobalDefinitions.driver.Title);
            Base.test = Base.extent.StartTest("On Share Skill page");
            //Populate the Excel Sheet
            Global.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
            //Enter TITLE
            Title.SendKeys(ExcelLib.ReadData(2, "Title"));
            //Check Length of Title
            GenericMethods.CheckLength(4, 100, ExcelLib.ReadData(2, "Title"), "Title");
            //Enter Description
            Description.SendKeys(ExcelLib.ReadData(2, "Description"));
            GenericMethods.CheckLength(4, 600, ExcelLib.ReadData(2, "Description"), "Description");
            //Select Category form dropdown
            CategoryDropDown.SendKeys(ExcelLib.ReadData(2, "Category"));
            SubCategoryDropDown.SendKeys(ExcelLib.ReadData(2, "SubCategory"));
            //Enter tag
            TxtTags.SendKeys(ExcelLib.ReadData(2, "Tags"));
            TxtTags.SendKeys(Keys.Enter);
            //Select service Type
            IWebElement ServiceTypeOptions = GlobalDefinitions.driver.FindElement(By.XPath("//form/div[5]/div[@class='twelve wide column']/div/div[@class='field']"));

            ServiceTypeOptions.Click();
            //Select Location Type
            IWebElement LocationTypeOption = GlobalDefinitions.driver.FindElement(By.XPath("//div[6]//div[2]//div[1]//div[1]//div[1]//input[1]"));

            LocationTypeOption.Click();
            //Enter start Date and End date
            StartDateDropDown.SendKeys(ExcelLib.ReadData(2, "Startdate"));
            EndDateDropDown.SendKeys(ExcelLib.ReadData(2, "Enddate"));
            // Loop for no. of days available,Start time and End time
            for (int i = 2; i < 9; i++)
            {
                for (int j = 2; j < 9; j++)
                {
                    IWebElement StartTime = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + i + "]/div[2]/input"));
                    IWebElement EndTime   = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + j + "]/div[3]/input"));
                    if (i == 2 && j == 2)
                    {
                        GlobalDefinitions.driver.FindElement(By.XPath("//div[contains(@class,'twelve wide column')]//div[2]//div[1]//div[1]//input[1]")).Click();
                        StartTime.SendKeys("0230PM");
                        StartTime.SendKeys(Keys.Tab);
                        EndTime.SendKeys("3052PM");
                    }
                    if (i == 3 && j == 3)
                    {
                        GlobalDefinitions.driver.FindElement(By.XPath("//div[3]//div[1]//div[1]//input[1]")).Click();
                        StartTime.SendKeys("0530PM");
                        EndTime.SendKeys("0856PM");
                    }
                }
            }
            // Select Skill Trade
            IWebElement credit = GlobalDefinitions.driver.FindElement(By.XPath("//div[8]//div[2]//div[1]//div[2]//div[1]//input[1]"));

            //Checking if the radio is selected or not
            if (!SkillTradeOption.Selected)
            {
                SkillTradeOption.Click();
            }
            Boolean status = GlobalDefinitions.driver.FindElement(By.XPath("//input[@type='radio']")).Selected;

            //To Check Radiobutton is selected or not
            if (status)
            {
                Console.WriteLine("RadioButton is checked");
            }
            else
            {
                Console.WriteLine("RadioButton is unchecked");
            }
            //Enter SkillExchange
            SkillExchange.SendKeys(ExcelLib.ReadData(2, "Skill-Exchange"));
            SkillExchange.SendKeys(Keys.Enter);
            //Upload File Using Auto IT
            WorkSample.Click();

            AutoItX3 autoIt = new AutoItX3();

            autoIt.WinWait("Open", "File Upload", 1);

            autoIt.WinActivate("Open", "File Upload");


            autoIt.ControlFocus("Open", "File Upload", "[CLASS:Edit; INSTANCE:1]");

            autoIt.Send(Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..")) + "\\Test.txt");
            autoIt.Sleep(1000);
            autoIt.Send("{ENTER}");
            //	autoIt.Sleep(1000);
            //Select Active Type
            IWebElement ActiveOption = GlobalDefinitions.driver.FindElement(By.XPath("//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']"));

            ActiveOption.Click();
            GlobalDefinitions.Wait();
            Save.Click();
            GlobalDefinitions.Wait();

            Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Skills Added Successfully");
            //Assert.AreEqual("ServiceListing", GlobalDefinitions.driver.Title);

            //Assert on category / title / Service Type after adding the skill and displayed on Manage Listing Page
            string searchInput1 = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'Programming & Tech')]")).Text;

            Console.WriteLine(searchInput1);
            Assert.AreEqual(searchInput1, ExcelLib.ReadData(2, "Category"));

            string searchInput2 = GlobalDefinitions.driver.FindElement(By.XPath("//table[@class='ui striped table']//tbody//tr[1]//td[3]")).Text;

            Console.WriteLine(searchInput2);
            Assert.AreEqual(searchInput2, ExcelLib.ReadData(2, "Title").TrimEnd());

            //string searchInput3 = GlobalDefinitions.driver.FindElement(By.XPath("//table[@class='ui striped table']//tbody//tr[1]//td[5]")).Text;
            //Assert.AreEqual(searchInput3, ExcelLib.ReadData(2, "ServiceType"));
        }
Пример #13
0
        public Level Generate()
        {
            //init
            List <BlockRecord>    blockRecords      = new List <BlockRecord>();
            List <CreatureRecord> creatureRecords   = new List <CreatureRecord>();
            List <Vector2>        listFreePositions = new List <Vector2>();

            Vector2[]         containerFreePositions;
            List <CreatureID> allCreatureIDs = new List <CreatureID>();

            //Convert creatures to list
            for (int i1 = 0; i1 < creatures.Length; i1++)
            {
                for (int i2 = 0; i2 < creatures[i1].count; i2++)
                {
                    allCreatureIDs.Add(creatures[i1].id);
                }
            }


            //Make Upper Border
            for (int i = 0; i < width + 2; i++)
            {
                blockRecords.Add(new BlockRecord(BlockID.Undestroyable, oneTileSize * i, (height + 1) * oneTileSize));
            }

            //Make Bottom Border
            for (int i = 0; i < width + 2; i++)
            {
                blockRecords.Add(new BlockRecord(BlockID.Undestroyable, oneTileSize * i, 0));
            }

            //Make Left Border
            for (int i = 0; i < height; i++)
            {
                blockRecords.Add(new BlockRecord(BlockID.Undestroyable, 0, oneTileSize * (i + 1)));
            }

            //Make Right Border
            for (int i = 0; i < height; i++)
            {
                blockRecords.Add(new BlockRecord(BlockID.Undestroyable, (width + 1) * oneTileSize, oneTileSize * (i + 1)));
            }


            //Make Undestroyable Layer
            int counterH = 0, counterV = 0;

            for (int x = 0; x < width; x++)
            {
                for (int z = 0; z < height; z++)
                {
                    if (counterH % (widthBeetwenUndestroyableTiles + 1) == 0 && counterV % (widthBeetwenUndestroyableTiles + 1) == 0)
                    {
                        counterH = counterV = 0;
                        blockRecords.Add(new BlockRecord(BlockID.Undestroyable, GetPositionByIndex(x, z)));
                    }
                    else
                    {
                        listFreePositions.Add(GetPositionByIndex(x, z));
                    }

                    counterV++;
                }
                counterH++;
            }


            //randomly to mix the list of free positions
            GenericMethods.RandomizeList(listFreePositions);


            //make a warning about overcounting amount of creatures
            if (allCreatureIDs.Count > listFreePositions.Count)
            {
                Debug.LogWarning(string.Format("Not enough space for all CustomTiles. Needed {0} free spaces, but exist only {1} free spaces", allCreatureIDs.Count, listFreePositions.Count));
            }


            //Add creatures into the level
            containerFreePositions = listFreePositions.ToArray();
            int countCustomTiles = Mathf.Min(allCreatureIDs.Count, listFreePositions.Count);

            for (int i = 0; i < countCustomTiles; i++)
            {
                listFreePositions.Remove(containerFreePositions[i]);
                creatureRecords.Add(new CreatureRecord(allCreatureIDs[i], containerFreePositions[i]));
            }


            //Make Destroyable Layer
            containerFreePositions = listFreePositions.ToArray();
            for (int i = 0; i < containerFreePositions.Length; i++)
            {
                if (GenericMethods.TryRandomChance(chanceCreateDestroyableTile))
                {
                    listFreePositions.Remove(containerFreePositions[i]);
                    blockRecords.Add(new BlockRecord(BlockID.Destroyable, containerFreePositions[i]));
                }
            }

            return(new Level(blockRecords.ToArray(), creatureRecords.ToArray()));
        }
Пример #14
0
        public JsonResult AuctocompleteEventsearch(string EventTitle)
        {
            var data = GenericMethods.GetAllEventsonserach(EventTitle);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
        private void OnButtonClickedCommand(Item ShoppingItem)
        {
            if (IsBusy)
            {
                return;
            }

            try
            {
                IsBusy = true;

                if (!ShoppingItem.Status)
                {
                    ButtonName = "Remove from cart";
                }
                else
                {
                    ButtonName = "Add to cart";
                }

                var index = ShoppingItem.Index;
                if (index == 1)
                {
                    Settings.ItemStatus1 = !Settings.ItemStatus1;
                }
                if (index == 2)
                {
                    Settings.ItemStatus2 = !Settings.ItemStatus2;
                }
                if (index == 3)
                {
                    Settings.ItemStatus3 = !Settings.ItemStatus3;
                }
                if (index == 4)
                {
                    Settings.ItemStatus4 = !Settings.ItemStatus4;
                }
                if (index == 5)
                {
                    Settings.ItemStatus5 = !Settings.ItemStatus5;
                }
                if (index == 6)
                {
                    Settings.ItemStatus6 = !Settings.ItemStatus6;
                }
                if (index == 7)
                {
                    Settings.ItemStatus7 = !Settings.ItemStatus7;
                }
                if (index == 8)
                {
                    Settings.ItemStatus8 = !Settings.ItemStatus8;
                }
                if (index == 9)
                {
                    Settings.ItemStatus9 = !Settings.ItemStatus9;
                }
                if (index == 10)
                {
                    Settings.ItemStatus10 = !Settings.ItemStatus10;
                }
                if (index == 11)
                {
                    Settings.ItemStatus11 = !Settings.ItemStatus11;
                }
                if (index == 12)
                {
                    Settings.ItemStatus12 = !Settings.ItemStatus12;
                }
                if (index == 13)
                {
                    Settings.ItemStatus13 = !Settings.ItemStatus13;
                }
                if (index == 14)
                {
                    Settings.ItemStatus14 = !Settings.ItemStatus14;
                }
                if (index == 15)
                {
                    Settings.ItemStatus15 = !Settings.ItemStatus15;
                }

                ShoppingItem.Status = !ShoppingItem.Status;

                GenericMethods.CartCount();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception is " + ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Пример #16
0
        protected override void fireDown()
        {
            RigidBody body; JVector normal; float frac;

            bool result = Scene.world.CollisionSystem.Raycast(GenericMethods.FromOpenTKVector(Position), GenericMethods.FromOpenTKVector(PointingDirection),
                                                              raycastCallback, out body, out normal, out frac);

            muzzleModel.Color = new Vector4(0.8f, 0.3f, 0.8f, 1.0f) * 2;

            if (body != null)
            {
                PhysModel selectedMod = (PhysModel)body.Tag;

                if (selectedMod != null)
                {
                    selectedMod.dissolve();
                }
            }
        }
Пример #17
0
        protected override void interactDown()
        {
            if (selectedMod == null)
            {
                RigidBody body; JVector normal; float frac;

                bool result = Scene.world.CollisionSystem.Raycast(GenericMethods.FromOpenTKVector(Position), GenericMethods.FromOpenTKVector(PointingDirection),
                                                                  raycastCallback, out body, out normal, out frac);

                if (result && body.Tag != null)
                {
                    PhysModel curMod = (PhysModel)body.Tag;

                    if (curMod.grabable)
                    {
                        curMod.IsStatic       = !curMod.IsStatic;
                        curMod.selectedSmooth = 1;
                    }
                }
            }
        }
Пример #18
0
        /// <summary>
        /// Set a static image to be displayed on the touchpad.
        /// </summary>
        /// <param name="image">Path to image.</param>
        /// <param name="interval">The interval (in milliseconds) at which to redraw the image file.</param>
        public override void Set(string image, int interval = 42)
        {
            image = GenericMethods.GetAbsolutePath(image);

            Renderer = new TouchpadImageRenderer(image, interval);
        }
Пример #19
0
        protected override void fireDown()
        {
            RigidBody body; JVector normal; float frac;

            bool result = Scene.world.CollisionSystem.Raycast(GenericMethods.FromOpenTKVector(Position), GenericMethods.FromOpenTKVector(PointingDirection),
                                                              raycastCallback, out body, out normal, out frac);

            Vector4 gpos = new Vector4(Position + PointingDirection * frac, 1);

            JVector hitCoords = GenericMethods.FromOpenTKVector(gpos.Xyz);

            weaponLocalHitCoords  = GenericMethods.Mult(gpos, Matrix4.Invert(weaponModel.ModelMatrix)).Xyz;
            arcModel.Orientation2 = Matrix4.CreateTranslation(weaponLocalHitCoords - new Vector3(0, 0, -5));

            muzzleModel.isVisible = true;

            if (result && body.Tag != null)
            {
                PhysModel curMod = (PhysModel)body.Tag;

                if (curMod.grabable)
                {
                    arcModel.isVisible = true;

                    grabDist = frac;

                    selectedBody            = body;
                    selectedMod             = (PhysModel)body.Tag;
                    selectedMod.selected    = 1;
                    selectedMod.Forceupdate = true;

                    Matrix4 localMaker = Matrix4.Invert(Matrix4.Mult(selectedMod.Orientation, selectedMod.ModelMatrix));
                    modelLocalHitCoords = GenericMethods.Mult(gpos, localMaker);

                    if (body.IsStatic)
                    {
                        selModRelPos = body.Position - hitCoords;
                    }
                    else
                    {
                        JVector lanchor = hitCoords - body.Position;
                        lanchor = JVector.Transform(lanchor, JMatrix.Transpose(body.Orientation));

                        body.IsActive = true;

                        //body.SetMassProperties(JMatrix.Identity, 0.1f, false);
                        //body.AffectedByGravity = false;

                        mConst            = new Jitter.Dynamics.Constraints.SingleBody.PointOnPoint(body, lanchor);
                        mConst.Softness   = 0.02f;
                        mConst.BiasFactor = 0.1f;
                        Scene.world.AddConstraint(mConst);
                    }
                }
            }
        }
Пример #20
0
        public JsonResult GetEventTypesOnId(int EventId)
        {
            var data = GenericMethods.EventTypes(EventId);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Пример #21
0
        public ActionResult Index(WhiteBoardModel WhiteBoards, IEnumerable <HttpPostedFileBase> Images, IEnumerable <HttpPostedFileBase> Files)
        {
            if (Session["UserId"] != null)
            {
                List <YearsforFaculty> Years = new List <YearsforFaculty>();
                int UserId = Convert.ToInt32(Session["UserId"]);
                View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(UserId));
                List <Batches>   Batches     = new List <Batches>();
                int PostId = 0;
                if (ModelState.IsValid)
                {
                    if (WhiteBoards.selections == "Visible To All")
                    {
                        UserPost UserPosts = new UserPost()
                        {
                            EventId     = WhiteBoards.EventId,
                            ViewBy      = WhiteBoards.selections,
                            UserId      = UserId,
                            UserMessage = WhiteBoards.Message,
                            Status      = true,
                            CreatedOn   = DateTime.Now
                        };
                        PostId = UserPostService.InsertUserPosts(UserPosts);

                        UserPosts_Visisble UserPostVisible = new UserPosts_Visisble()
                        {
                            PostId    = PostId,
                            Batch     = WhiteBoards.selections,
                            Branch    = WhiteBoards.Degree,
                            Degreee   = Userdetails.CourseId,
                            CreatedOn = DateTime.Now,
                            Status    = true,
                            BatchTo   = (WhiteBoards.WorkFromTo)
                        };
                        UserPostVisibleServices.Create(UserPostVisible);
                    }
                    else
                    {
                        UserPost UserPosts = new UserPost()
                        {
                            EventId     = WhiteBoards.EventId,
                            UserId      = UserId,
                            UserMessage = WhiteBoards.Message,
                            ViewBy      = WhiteBoards.Batchyear,
                            Status      = true,
                            CreatedOn   = DateTime.Now
                        };
                        PostId = UserPostService.InsertUserPosts(UserPosts);

                        UserPosts_Visisble UserPostVisible = new UserPosts_Visisble()
                        {
                            PostId  = PostId,
                            Batch   = WhiteBoards.WorkFromYear,
                            Branch  = WhiteBoards.Degree,
                            Degreee = Userdetails.CourseId,

                            CreatedOn = DateTime.Now,
                            Status    = true,
                            BatchTo   = (WhiteBoards.WorkFromTo)
                        };
                        UserPostVisibleServices.Create(UserPostVisible);
                    }
                    if (Images != null)
                    {
                        foreach (var Pictures in Images)
                        {
                            if (Pictures != null)
                            {
                                var fileName = Path.GetFileName(Pictures.FileName);
                                var path     = Path.Combine(Server.MapPath("~/UserPostingImages/" + fileName));
                                Pictures.SaveAs(path);
                                var             FilePath   = "/UserPostingImages/" + fileName;
                                UserPost_Images UserImages = new UserPost_Images()
                                {
                                    PostId    = PostId,
                                    ImagePath = FilePath,
                                    CreatedOn = DateTime.Now,
                                    Status    = true
                                };
                                UserpostPictureServices.Create(UserImages);
                            }
                        }
                    }
                    ViewBag.Userdata = GenericMethods.GetUserdetailsonFaculty(UserId, Convert.ToString(Userdetails.Batch));
                    return(RedirectToAction("Index", "WhiteBoard", new { area = "Faculty" }));
                }

                if (Userdetails.RoleId == "2")
                {
                    for (int?i = Userdetails.WorkingFrom; i <= Userdetails.WorkingTo; i++)
                    {
                        Years.Add(new YearsforFaculty {
                            Year = Convert.ToString(i)
                        });
                    }
                }
                WhiteBoardModel WhiteBoard = new WhiteBoardModel()
                {
                    Viewdetails     = Batches,
                    RoleId          = Userdetails.RoleId,
                    Batch           = Userdetails.Batch,
                    Stream          = Userdetails.CourseName,
                    Events          = EventCategoryService.GetCategorys(),
                    yearsList       = Years,
                    Coursecategorys = CategoryServices.GetAllCourseCategories(),
                };
                ViewBag.Userdata = GenericMethods.GetUserdetailsonFaculty(UserId, Convert.ToString(Userdetails.Batch));
                return(View(WhiteBoard));
            }
            return(RedirectToAction(LoginPages.Login, LoginPages.Account, new { area = "" }));
        }
Пример #22
0
        private void ExecuteButtonClick(Object e)
        {
            if (IsBusy)
            {
                return;
            }

            try
            {
                IsBusy = true;

                var selectedItem = (Item)e;

                List <Item> ItemsList = new List <Item>(ShoppingItems);

                var index = selectedItem.Index;
                if (index == 1)
                {
                    Settings.ItemStatus1 = !Settings.ItemStatus1;
                }
                if (index == 2)
                {
                    Settings.ItemStatus2 = !Settings.ItemStatus2;
                }
                if (index == 3)
                {
                    Settings.ItemStatus3 = !Settings.ItemStatus3;
                }
                if (index == 4)
                {
                    Settings.ItemStatus4 = !Settings.ItemStatus4;
                }
                if (index == 5)
                {
                    Settings.ItemStatus5 = !Settings.ItemStatus5;
                }
                if (index == 6)
                {
                    Settings.ItemStatus6 = !Settings.ItemStatus6;
                }
                if (index == 7)
                {
                    Settings.ItemStatus7 = !Settings.ItemStatus7;
                }
                if (index == 8)
                {
                    Settings.ItemStatus8 = !Settings.ItemStatus8;
                }
                if (index == 9)
                {
                    Settings.ItemStatus9 = !Settings.ItemStatus9;
                }
                if (index == 10)
                {
                    Settings.ItemStatus10 = !Settings.ItemStatus10;
                }
                if (index == 11)
                {
                    Settings.ItemStatus11 = !Settings.ItemStatus11;
                }
                if (index == 12)
                {
                    Settings.ItemStatus12 = !Settings.ItemStatus12;
                }
                if (index == 13)
                {
                    Settings.ItemStatus13 = !Settings.ItemStatus13;
                }
                if (index == 14)
                {
                    Settings.ItemStatus14 = !Settings.ItemStatus14;
                }
                if (index == 15)
                {
                    Settings.ItemStatus15 = !Settings.ItemStatus15;
                }

                CartCounter = GenericMethods.CartCount().ToString();

                ShoppingItems.Clear();

                if (selectedItem.Status)
                {
                    ItemsList[index - 1].ButtonText = "Add to cart";
                }
                else
                {
                    ItemsList[index - 1].ButtonText = "Remove";
                }

                selectedItem.Status = !selectedItem.Status;

                ShoppingItems.ReplaceRange(ItemsList);

                ShoppingItemsGrouped = new ObservableRangeCollection <Grouping <string, Item> >(GroupItems(ShoppingItems));
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception is " + ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Пример #23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     GenericMethods.CheckXSRF(this.Page, CSRFToken);
 }
Пример #24
0
 public void updateMatrix()
 {
     Position    = GenericMethods.ToOpenTKVector(Body.Position);
     Orientation = GenericMethods.ToOpenTKMatrix(Body.Orientation);
 }
Пример #25
0
        public ActionResult Index(int?Type)
        {
            var            defaultPageSize = 5;
            int?           page            = 1;
            List <Batches> batches         = new List <Batches>();

            if (Session["UserId"] != null)
            {
                int UserId = Convert.ToInt32(Session["UserId"]);
                View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(UserId));
                switch (Convert.ToInt32(Userdetails.RoleId))
                {
                case 1:
                    batches.Add(new Batches {
                        Batch = UtilitiesClass.BatchVisibleToAll, BatchName = UtilitiesClass.BatchVisibleToAll
                    });
                    batches.Add(new Batches {
                        Batch = Convert.ToString(Userdetails.Batch), BatchName = UtilitiesClass.BatchName
                    });
                    break;

                case 2:
                    batches.Add(new Batches {
                        Batch = UtilitiesClass.BatchVisibleToAll, BatchName = UtilitiesClass.BatchVisibleToAll
                    });
                    batches.Add(new Batches {
                        Batch = Convert.ToString(Userdetails.Batch), BatchName = UtilitiesClass.BatchName
                    });
                    break;
                }
                if (Userdetails.RoleId == "4")
                {
                }
                WhiteBoardModel WhiteBoard = new WhiteBoardModel()
                {
                    Viewdetails = batches,
                    RoleId      = Userdetails.RoleId,
                    Batch       = Userdetails.Batch,
                    Stream      = Userdetails.CourseName,
                    Events      = EventCategoryService.GetCategorys()
                };

                if (Type == 1)
                {
                    if ((Userdetails.RoleId == Convert.ToString(1) && Userdetails.Batch == Userdetails.Batch) || (Userdetails.RoleId == Convert.ToString(1) && Convert.ToString(Userdetails.Batch) == UtilitiesClass.BatchVisibleToAll))
                    {
                        ViewBag.Userdata = GenericMethods.GetUserDataserach(UserId, Convert.ToString(Userdetails.Batch), Convert.ToInt32(Userdetails.Years), Userdetails.CourseCategoryName, Type);
                    }
                }
                else if (Type == 2)
                {
                    if ((Userdetails.RoleId == Convert.ToString(1) && Userdetails.Batch == Userdetails.Batch) || (Userdetails.RoleId == Convert.ToString(1) && Convert.ToString(Userdetails.Batch) == UtilitiesClass.BatchVisibleToAll))
                    {
                        ViewBag.Userdata = GenericMethods.GetUserDataserach(UserId, Convert.ToString(Userdetails.Batch), Convert.ToInt32(Userdetails.Years), Userdetails.CourseCategoryName, Type);
                    }
                }
                else
                {
                    if ((Userdetails.RoleId == Convert.ToString(1) && Userdetails.Batch == Userdetails.Batch) || (Userdetails.RoleId == Convert.ToString(1) && Convert.ToString(Userdetails.Batch) == UtilitiesClass.BatchVisibleToAll))
                    {
                        ViewBag.Userdata = GenericMethods.GetUserPostsonId(UserId, Convert.ToString(Userdetails.Batch), Convert.ToInt32(Userdetails.Years), Userdetails.CourseCategoryName, page, defaultPageSize);
                    }
                }

                return(View(WhiteBoard));
            }
            return(RedirectToAction(LoginPages.Login, LoginPages.Account, new { area = "" }));
        }
 public void Clear()
 {
     CodeQueries.Clear();
     XmlQueries.Clear();
     GenericMethods.Clear();
 }
Пример #27
0
 public static void UserNamePassWord()
 {
     Common.ExcelDataReader.PopulateInCollection(CommonFeatures.ExcelPath, "Login");
     GenericMethods.TextBox(GlobalDefinition.driver, "XPath", "//*[@id='email']", Common.ExcelDataReader.ReadData(2, "UserName"));
     GenericMethods.TextBox(GlobalDefinition.driver, "Id", "pass", Common.ExcelDataReader.ReadData(2, "PassWord"));
 }
Пример #28
0
 public static void BackNavigation()
 {
     myDriver.Navigate().Back();
     GenericMethods.ValidateTitle("Dashboard", myDriver.Title, "Back Navigation Successful", "Back Navigation Failed");
 }
Пример #29
0
        public void Listings()
        {
            GlobalDefinitions.Wait();
            ManageListingsLink.Click();
            //Checking the right page
            Assert.AreEqual("ListingManagement", GlobalDefinitions.driver.Title);
            Base.test = Base.extent.StartTest("On Share Manage Listing page");
            edit.Click();
            //Populate the Excel Sheet
            Global.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
            Title.SendKeys(ExcelLib.ReadData(3, "Title"));
            GenericMethods.CheckLength(4, 100, ExcelLib.ReadData(3, "Title"), "Title");
            Description.SendKeys(ExcelLib.ReadData(3, "Description"));
            GenericMethods.CheckLength(4, 600, ExcelLib.ReadData(3, "Description"), "Description");
            CategoryDropDown.SendKeys(ExcelLib.ReadData(3, "Category"));
            SubCategoryDropDown.SendKeys(ExcelLib.ReadData(3, "SubCategory"));

            TxtTags.SendKeys(ExcelLib.ReadData(3, "Tags"));
            TxtTags.SendKeys(Keys.Enter);
            IWebElement ServiceTypeOptions = GlobalDefinitions.driver.FindElement(By.XPath("//div[5]//div[2]//div[1]//div[2]//div[1]//input[1]"));

            ServiceTypeOptions.Click();

            IWebElement LocationTypeOption = GlobalDefinitions.driver.FindElement(By.XPath("//div[6]//div[2]//div[1]//div[2]//div[1]//input[1]"));

            LocationTypeOption.Click();

            StartDateDropDown.SendKeys(ExcelLib.ReadData(2, "Startdate"));
            EndDateDropDown.SendKeys(ExcelLib.ReadData(2, "Enddate"));

            for (int i = 2; i < 9; i++)
            {
                for (int j = 2; j < 9; j++)
                {
                    IWebElement StartTime = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + i + "]/div[2]/input"));
                    IWebElement EndTime   = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + j + "]/div[3]/input"));
                    if (i == 2 && j == 2)
                    {
                        GlobalDefinitions.driver.FindElement(By.XPath("//div[contains(@class,'twelve wide column')]//div[2]//div[1]//div[1]//input[1]")).Click();
                        StartTime.SendKeys("0230PM");
                        StartTime.SendKeys(Keys.Tab);
                        EndTime.SendKeys("3052PM");
                    }
                    if (i == 3 && j == 3)
                    {
                        GlobalDefinitions.driver.FindElement(By.XPath("//div[3]//div[1]//div[1]//input[1]")).Click();
                        StartTime.SendKeys("0530PM");
                        EndTime.SendKeys("0856PM");
                    }
                }
            }

            IWebElement credit = GlobalDefinitions.driver.FindElement(By.XPath("//div[8]//div[2]//div[1]//div[2]//div[1]//input[1]"));

            if (!credit.Selected)
            {
                credit.Click();
                CreditAmount.SendKeys("9");
            }


            WorkSample.Click();

            AutoItX3 autoIt = new AutoItX3();

            autoIt.WinWait("Open", "File Upload", 1);

            autoIt.WinActivate("Open", "File Upload");

            autoIt.ControlFocus("Open", "File Upload", "[CLASS:Edit; INSTANCE:1]");

            autoIt.Send(Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..")) + "\\Test.txt");                                 //autoIt

            autoIt.Send("{ENTER}");
            autoIt.Sleep(1000);

            IWebElement ActiveOption = GlobalDefinitions.driver.FindElement(By.XPath("//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']"));

            ActiveOption.Click();
            GlobalDefinitions.Wait();
            Save.Click();
            GlobalDefinitions.Wait();
            Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Skills edited succesfully");
            string searchInput1 = GlobalDefinitions.driver.FindElement(By.XPath("//tbody//tr[1]//td[2]")).Text;

            Assert.AreEqual(searchInput1, ExcelLib.ReadData(3, "Category"));
            string searchInput2 = GlobalDefinitions.driver.FindElement(By.XPath("//tbody//tr[1]//td[3]")).Text;

            Assert.AreEqual(searchInput2, ExcelLib.ReadData(3, "Title"));
            string searchInput3 = GlobalDefinitions.driver.FindElement(By.XPath("//tbody//tr[1]//td[5]")).Text;

            Assert.AreEqual(searchInput3, ExcelLib.ReadData(3, "ServiceType"));
        }
Пример #30
0
        public static void AddNewProperties()
        {
            //finding the excle path for input
            Global.ExcelData.PopulateInCollection(CommonFeatures.ExcelPath, "Add Property");

            //To skip the alert
            GenericMethods.ButtonClick(myDriver, "XPath", "/html/body/div[5]/div/div[5]/a[1]");

            Thread.Sleep(1500);

            //loop for multiple properties getting added at single shot
            int loopNum = CommonFeatures.RowCount + 2;

            for (int rowNum = 2; rowNum < loopNum; rowNum++)
            {
                //navigate to Owners>Properties
                GenericMethods.ButtonClick(myDriver, "XPath", "/html/body/div[1]/div/div[2]/div[1]");
                GenericMethods.ButtonClick(myDriver, "XPath", "/html/body/div[1]/div/div[2]/div[1]/div/a[1]");

                //Checking the right page
                Assert.AreEqual("Properties | Property Community", myDriver.Title);
                //CommonFeatures.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, "In My Properties page");

                //clicking add new properties
                Thread.Sleep(1000);
                GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div/div/div[2]/div/div[2]/a[2]");

                // Adding property details
                GenericMethods.TextBox(myDriver, "XPath", "//body/div[2]/section/form/fieldset/div/div/div/input", Global.ExcelData.ReadData(rowNum, "PropertyName"));
                GenericMethods.CheckLength(4, 30, Global.ExcelData.ReadData(rowNum, "PropertyName"), "Property Name");

                GenericMethods.ButtonClick(myDriver, "XPath", "//fieldset/div/div[2]/div");
                GenericMethods.ButtonClick(myDriver, "XPath", "//fieldset/div/div[2]/div");
                GenericMethods.TextBox(myDriver, "XPath", "//body/div[2]/section/form/fieldset/div[3]/div/div[2]/div/div/input", Global.ExcelData.ReadData(rowNum, "Number"));
                GenericMethods.TextBox(myDriver, "XPath", "//body/div[2]/section/form/fieldset/div[3]/div/div[2]/div[2]/div/input", Global.ExcelData.ReadData(rowNum, "Street"));
                GenericMethods.TextBox(myDriver, "XPath", "//body/div[2]/section/form/fieldset/div[3]/div/div[3]/div/div[2]/div/input", Global.ExcelData.ReadData(rowNum, "City"));
                //postcode
                GenericMethods.TextBox(myDriver, "XPath", "//input[@placeholder='PostCode']", Global.ExcelData.ReadData(rowNum, "Postcode"));
                GenericMethods.ValidNumeric(Global.ExcelData.ReadData(rowNum, "Postcode"), "Postcode");

                //Region
                GenericMethods.TextBox(myDriver, "Id", "region", Global.ExcelData.ReadData(rowNum, "Region"));

                //year built
                GenericMethods.TextBox(myDriver, "XPath", "//input[@placeholder = 'Year Built']", Global.ExcelData.ReadData(rowNum, "Yearbuilt"));
                GenericMethods.ValidYear(1900, Global.ExcelData.ReadData(rowNum, "Yearbuilt"), "Year Built");

                //rent
                GenericMethods.TextBox(myDriver, "XPath", "//input[@placeholder='Rent Amount']", Global.ExcelData.ReadData(rowNum, "targetrent"));

                //bedroom , bathroom, carpark
                GenericMethods.TextBox(myDriver, "XPath", "//input[@placeholder='Number of Bedrooms']", Global.ExcelData.ReadData(rowNum, "bedroom"));
                GenericMethods.ValidNumeric(Global.ExcelData.ReadData(rowNum, "bedroom"), "Bedroom");
                GenericMethods.TextBox(myDriver, "XPath", "//input[@placeholder='Number of Bathrooms']", Global.ExcelData.ReadData(rowNum, "bathroom"));
                GenericMethods.ValidNumeric(Global.ExcelData.ReadData(rowNum, "bathroom"), "Bathroom");
                GenericMethods.TextBox(myDriver, "XPath", "//input[@placeholder='Number of car parks']", Global.ExcelData.ReadData(rowNum, "carpark"));
                GenericMethods.ValidNumeric(Global.ExcelData.ReadData(rowNum, "carpark"), "Carpark");

                //description of the property
                GenericMethods.TextBox(myDriver, "XPath", "//textarea[@class='add-prop-desc']", Global.ExcelData.ReadData(rowNum, "description"));
                GenericMethods.CheckLength(10, 100, Global.ExcelData.ReadData(rowNum, "description"), "Description");

                //picture of the property
                Thread.Sleep(2000);
                GenericMethods.TextBox(myDriver, "Id", "file-upload", CommonFeatures.PhotoPath);

                //navigating to financce page
                Thread.Sleep(2000);
                GenericMethods.ButtonClick(myDriver, "XPath", "//button[@class='ui teal button']");
                Assert.AreEqual("Properties | Add New Property", myDriver.Title);
                //CommonFeatures.test.Log(RelevantCodes.ExtentReports.LogStatus.Info,"In Finance Page");

                //entering details in finance page
                GenericMethods.TextBox(myDriver, "XPath", "//form/fieldset[2]/div/div/div/input", Global.ExcelData.ReadData(rowNum, "purchaseprice"));
                GenericMethods.TextBox(myDriver, "XPath", "//form/fieldset[2]/div/div[2]/div/input", Global.ExcelData.ReadData(rowNum, "mortgage"));
                GenericMethods.TextBox(myDriver, "XPath", "//form/fieldset[2]/div/div[3]/div/input", Global.ExcelData.ReadData(rowNum, "homevalue"));

                //navigating to tenant screen
                GenericMethods.ButtonClick(myDriver, "XPath", "//fieldset[2]/div[8]/button[3]");
                Assert.AreEqual("Properties | Add New Property", myDriver.Title);
                //CommonFeatures.test.Log(RelevantCodes.ExtentReports.LogStatus.Info,"In Tenant Page");

                //entering details in tenant page
                GenericMethods.TextBox(myDriver, "XPath", "//section/form/fieldset[3]/div/div/div/input", Global.ExcelData.ReadData(rowNum, "tenantmail"));
                GenericMethods.TextBox(myDriver, "Id", "fname", Global.ExcelData.ReadData(rowNum, "firstname"));
                GenericMethods.TextBox(myDriver, "Id", "lname", Global.ExcelData.ReadData(rowNum, "lastname"));
                GenericMethods.TextBox(myDriver, "Id", "ramount", Global.ExcelData.ReadData(rowNum, "rentamount"));

                GenericMethods.TextBox(myDriver, "Id", "sdate", Global.ExcelData.ReadData(rowNum, "sdate"));
                GenericMethods.TextBox(myDriver, "Id", "sdate", (Keys.Tab));
                GenericMethods.TextBox(myDriver, "Id", "sdate", "0105AM");

                GenericMethods.TextBox(myDriver, "Id", "edate", Global.ExcelData.ReadData(rowNum, "enddate"));
                GenericMethods.TextBox(myDriver, "Id", "edate", (Keys.Tab));
                GenericMethods.TextBox(myDriver, "Id", "edate", "0105AM");

                GenericMethods.TextBox(myDriver, "Id", "psdate", Global.ExcelData.ReadData(rowNum, "psdate"));
                GenericMethods.TextBox(myDriver, "Id", "psdate", (Keys.Tab));
                GenericMethods.TextBox(myDriver, "Id", "psdate", "0105AM");

                //save property
                GenericMethods.ButtonClick(myDriver, "Id", "saveProperty");
                //Verification
                Thread.Sleep(500);
                Assert.AreEqual("Properties | Add New Property", Global.GlobalDriver.driver.Title);
                CommonFeatures.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Property Added Successfully");
            }
        }
Пример #31
0
        public ActionResult Index(WhiteBoardModel WhiteBoards, IEnumerable <HttpPostedFileBase> Images, IEnumerable <HttpPostedFileBase> Files)
        {
            var            defaultPageSize = 5;
            int?           Page            = 1;
            List <Batches> Batches         = new List <Batches>();

            if (Session["UserId"] != null)
            {
                int UserId = Convert.ToInt32(Session["UserId"]);
                View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(UserId));
                if (Userdetails.RoleId == "4")
                {
                    Batches.Add(new Batches {
                        Batch = "Visible To All", BatchName = "Visible To All"
                    });
                    Batches.Add(new Batches {
                        Batch = Convert.ToString(Userdetails.Batch), BatchName = "My BatchMates"
                    });
                }
                WhiteBoardModel WhiteBoard = new WhiteBoardModel()
                {
                    Viewdetails = Batches,
                    RoleId      = Userdetails.RoleId,
                    Batch       = Userdetails.Batch,
                    Stream      = Userdetails.CourseName,
                    Events      = EventCategoryService.GetCategorys()
                };


                if (ModelState.IsValid)
                {
                    int?EventId = null;
                    if (WhiteBoard.EventId == null || WhiteBoard.EventId == 0)
                    {
                        EventId = 5;
                    }
                    UserPost UserPosts = new UserPost()
                    {
                        EventId     = EventId,
                        UserId      = UserId,
                        UserMessage = WhiteBoards.Message,
                        ViewBy      = WhiteBoards.Batchyear,
                        Status      = true,
                        CreatedOn   = DateTime.Now
                    };
                    int    PostId    = UserPostService.InsertUserPosts(UserPosts);
                    string Batch     = "";
                    Int64  BatchFrom = 0;
                    Int64  BatchTo   = 0;
                    if (WhiteBoards.Batchyear == "Visible To All")
                    {
                        Batch = "Visible To All";
                    }
                    else
                    {
                        BatchFrom = Convert.ToInt64(WhiteBoards.Batchyear);
                        BatchTo   = Convert.ToInt64(WhiteBoards.Batchyear) - (Convert.ToInt64(Userdetails.Years));
                    }
                    if (Batch == "Visible To All")
                    {
                        UserPosts_Visisble UserPostVisible = new UserPosts_Visisble()
                        {
                            PostId    = PostId,
                            Batch     = Batch,
                            Branch    = Userdetails.CourseCategoryName,
                            Degreee   = Userdetails.CourseId,
                            CreatedOn = DateTime.Now,
                            Status    = true
                        };
                        UserPostVisibleServices.Create(UserPostVisible);
                    }
                    else
                    {
                        UserPosts_Visisble UserPostVisible = new UserPosts_Visisble()
                        {
                            PostId    = PostId,
                            Batch     = Convert.ToString(BatchTo),
                            BatchTo   = Convert.ToString(BatchFrom),
                            Branch    = Userdetails.CourseCategoryName,
                            Degreee   = Userdetails.CourseId,
                            CreatedOn = DateTime.Now,
                            Status    = true
                        };
                        UserPostVisibleServices.Create(UserPostVisible);
                    }


                    if (Images != null)
                    {
                        foreach (var Pictures in Images)
                        {
                            if (Pictures != null)
                            {
                                var fileName = Path.GetFileName(Pictures.FileName);
                                var path     = Path.Combine(Server.MapPath("~/UserPostingImages/" + fileName));
                                Pictures.SaveAs(path);
                                var             FilePath   = "/UserPostingImages/" + fileName;
                                UserPost_Images UserImages = new UserPost_Images()
                                {
                                    PostId    = PostId,
                                    ImagePath = FilePath,
                                    CreatedOn = DateTime.Now,
                                    Status    = true
                                };
                                UserpostPictureServices.Create(UserImages);
                            }
                        }
                    }
                    ViewBag.Userdata = GenericMethods.GetUserPostsonId(UserId, Convert.ToString(Userdetails.Batch), Convert.ToInt32(Userdetails.Years), Userdetails.CourseCategoryName, Page, defaultPageSize);
                    return(RedirectToAction("Index", "WhiteBoard", new { area = "AlumniFaculty" }));
                }
                return(View(WhiteBoard));
            }
            return(RedirectToAction(LoginPages.Login, LoginPages.Account, new { area = "" }));
        }