public ActionResult DataSourceGetAll(DataManager dm)
        {
            OISTIModels obj   = new OISTIModels();
            IEnumerable data  = obj.GetAll(null, null, null).ToList();
            int         count = obj.GetAll(null, null, null).ToList().Count();

            DataOperations operation = new DataOperations();

            //Performing filtering operation
            if (dm.Where != null)
            {
                data = operation.PerformWhereFilter(data, dm.Where, "and");
                var filtered = (IEnumerable <object>)data;
                count = filtered.Count();
            }
            //Performing search operation
            if (dm.Search != null)
            {
                data = operation.PerformSearching(data, dm.Search);
                var searched = (IEnumerable <object>)data;
                count = searched.Count();
            }
            //Performing sorting operation
            if (dm.Sorted != null)
            {
                data = operation.PerformSorting(data, dm.Sorted);
            }

            //Performing paging operations
            if (dm.Skip != 0)
            {
                data = operation.PerformSkip(data, dm.Skip);
            }
            if (dm.Take != 0)
            {
                data = operation.PerformTake(data, dm.Take);
            }

            return(Json(new { result = data, count = count }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult PerfCatDataSource([FromBody] DataManagerRequest dm)
        {
            var         _data = context.PcPerformanceCategory.OrderByDescending(a => a.PcCategoryCode).Where(a => (a.DeletedCat == false) || (a.DeletedCat == null)).ToList();
            IEnumerable data  = _data;
            int         count = _data.Count;

            DataOperations operation = new DataOperations();

            //Performing filtering operation
            if (dm.Where != null)
            {
                data = operation.PerformFiltering(data, dm.Where, "and");
                var filtered = (IEnumerable <object>)data;
                count = filtered.Count();
            }
            //Performing search operation
            if (dm.Search != null)
            {
                data = operation.PerformSearching(data, dm.Search);
                var searched = (IEnumerable <object>)data;
                count = searched.Count();
            }
            //Performing sorting operation
            if (dm.Sorted != null)
            {
                data = operation.PerformSorting(data, dm.Sorted);
            }

            //Performing paging operations
            if (dm.Skip > 0)
            {
                data = operation.PerformSkip(data, dm.Skip);
            }
            if (dm.Take > 0)
            {
                data = operation.PerformTake(data, dm.Take);
            }

            return(Json(new { result = data, count = count }));
        }
        public ActionResult CriteriaSearchDataSource([FromBody] DataManagerRequest dm, int?PcCategoryCode)
        {
            var         _data = context.ViewPcCriteria.Where(a => (a.PcCategoryCode == PcCategoryCode)).ToList();
            IEnumerable data  = _data;
            int         count = _data.Count;

            DataOperations operation = new DataOperations();

            //Performing filtering operation
            if (dm.Where != null)
            {
                data = operation.PerformFiltering(data, dm.Where, "and");
                var filtered = (IEnumerable <object>)data;
                count = filtered.Count();
            }
            //Performing search operation
            if (dm.Search != null)
            {
                data = operation.PerformSearching(data, dm.Search);
                var searched = (IEnumerable <object>)data;
                count = searched.Count();
            }
            //Performing sorting operation
            if (dm.Sorted != null)
            {
                data = operation.PerformSorting(data, dm.Sorted);
            }

            //Performing paging operations
            if (dm.Skip > 0)
            {
                data = operation.PerformSkip(data, dm.Skip);
            }
            if (dm.Take > 0)
            {
                data = operation.PerformTake(data, dm.Take);
            }

            return(Json(new { result = data, count = count }));
        }
Exemplo n.º 4
0
 protected void createEvent_Click(object sender, EventArgs e)
 {
     if (coverImage.HasFile)
     {
         User           user    = (User)Session["loggedUser"];
         string         en      = eventName.Value;
         string         cn      = category.Value;
         string         pl      = place.Value;
         string         dt      = date.Value;
         int            st      = int.Parse(hours.Value.ToString());
         int            min     = int.Parse(minutes.Value.ToString());
         string         strtime = st + ":" + min;
         int            dr      = int.Parse(duration.Value.ToString());
         int            pr      = int.Parse(price.Value.ToString());
         string         desc    = description.Value;
         string         ci      = coverImage.FileName;
         int            user_id = user.id;
         DataOperations dop     = new DataOperations();
         string         path    = Server.MapPath("~/uploads/" + user_id);
         if (!Directory.Exists(path))
         {
             Directory.CreateDirectory(path);
         }
         coverImage.SaveAs(path + "/" + ci);
         Event eve = new Event(0, user_id, en, desc, cn, pl, dt, strtime, dr, pr, user_id + "/" + ci, 0);
         if (dop.createEvent(eve))
         {
             Session["eventCreated"] = "Event Created Successfully. Sent for admin Approval.";
             Response.Redirect("MyEvents.aspx");
         }
         else
         {
             errorMsg.InnerText = "Please try again";
         }
     }
     else
     {
         errorMsg.InnerText = "Please select a cover image";
     }
 }
Exemplo n.º 5
0
        public override object Read(DataManagerRequest dataManager, string key = null)
        {
            if (PLUserAccounts == null)
            {
                return(null);
            }

            if (dataManager.Search != null && dataManager.Search.Count > 0)
            {
                // Searching
                PLUserAccounts = DataOperations.PerformSearching(PLUserAccounts, dataManager.Search).ToList();
            }
            if (dataManager.Sorted != null && dataManager.Sorted.Count > 0)
            {
                // Sorting
                PLUserAccounts = DataOperations.PerformSorting(PLUserAccounts, dataManager.Sorted).ToList();
            }
            if (dataManager.Where != null && dataManager.Where.Count > 0)
            {
                // Filtering
                PLUserAccounts = DataOperations.PerformFiltering(PLUserAccounts, dataManager.Where, dataManager.Where[0].Operator).ToList();
            }

            int count = PLUserAccounts.Count();

            if (dataManager.Skip != 0)
            {
                //Paging
                PLUserAccounts = DataOperations.PerformSkip(PLUserAccounts, dataManager.Skip).ToList();
            }
            if (dataManager.Take != 0)
            {
                PLUserAccounts = DataOperations.PerformTake(PLUserAccounts, dataManager.Take).ToList();
            }

            return(dataManager.RequiresCounts ? new DataResult()
            {
                Result = PLUserAccounts, Count = count
            } : (object)PLUserAccounts);
        }
Exemplo n.º 6
0
        private static Dictionary <string, DataCommandConfig> GetAllDataCommandConfigInfos(out List <string> configFileList)
        {
            DataCommandFileList fileList = ConfigHelper.LoadSqlConfigListFile();

            if (fileList == null || fileList.FileList == null || fileList.FileList.Length <= 0)
            {
                configFileList = new List <string>(1);
                return(new Dictionary <string, DataCommandConfig>(0));
            }
            configFileList = new List <string>(fileList.FileList.Length + 1);
            Dictionary <string, DataCommandConfig> cache = new Dictionary <string, DataCommandConfig>();

            foreach (var file in fileList.FileList)
            {
                string path = file.FileName;
                string root = Path.GetPathRoot(path);
                if (root == null || root.Trim().Length <= 0)
                {
                    path = Path.Combine(ConfigHelper.ConfigFolder, path);
                }
                if (!string.IsNullOrWhiteSpace(path) && File.Exists(path))
                {
                    configFileList.Add(path);
                }
                DataOperations op = ConfigHelper.LoadDataCommandList(path);
                if (op != null && op.DataCommand != null && op.DataCommand.Length > 0)
                {
                    foreach (var da in op.DataCommand)
                    {
                        if (cache.ContainsKey(da.Name))
                        {
                            throw new ApplicationException("Duplicate name '" + da.Name + "' for data command in file '" + path + "'.");
                        }
                        cache.Add(da.Name, da);
                    }
                }
            }
            return(cache);
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            DataOperations ops = new DataOperations();

            ops.TestSqlConnection();
            if (ops.IsSuccessFul)
            {
                var foregroundColorColor = Console.ForegroundColor;
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine("Successfully connected!!!");
                Console.ForegroundColor = foregroundColorColor;
            }
            else
            {
                var foregroundColorColor = Console.ForegroundColor;
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Unsuccessful");
                Console.ForegroundColor = foregroundColorColor;
                Console.WriteLine(ops.LastExceptionMessage);
            }
            Console.ReadLine();
        }
Exemplo n.º 8
0
        public ActionResult DataSourceUserManagement(DataManager dm)
        {
            IEnumerable data  = db.View_UserManagement.OrderBy(a => a.Email).ToList();
            int         count = db.View_UserManagement.OrderBy(a => a.Email).ToList().Count;

            DataOperations operation = new DataOperations();

            //Performing filtering operation
            if (dm.Where != null)
            {
                data = operation.PerformWhereFilter(data, dm.Where, "and");
                var filtered = (IEnumerable <object>)data;
                count = filtered.Count();
            }
            //Performing search operation
            if (dm.Search != null)
            {
                data = operation.PerformSearching(data, dm.Search);
                var searched = (IEnumerable <object>)data;
                count = searched.Count();
            }
            //Performing sorting operation
            if (dm.Sorted != null)
            {
                data = operation.PerformSorting(data, dm.Sorted);
            }

            //Performing paging operations
            if (dm.Skip > 0)
            {
                data = operation.PerformSkip(data, dm.Skip);
            }
            if (dm.Take > 0)
            {
                data = operation.PerformTake(data, dm.Take);
            }

            return(Json(new { result = data, count = count }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 9
0
        public bool CheckAccessRights(int Id, int UserId, string ControllerName, string ActionName, int HasAccess)
        {
            DataOperations         DO  = new DataOperations();
            List <tbl_AccessRight> ARS = DO.GetAccessRights();
            int cnt;

            if (Id > 0 && HasAccess != 0)
            {
                cnt = ARS.Where(ar => ar.ID != Id && ar.UserId == UserId && ar.Controller == ControllerName && ar.Action == ActionName && ar.HasAccess == HasAccess).Count();
            }
            else if (Id > 0)
            {
                cnt = ARS.Where(ar => ar.ID != Id && ar.UserId == UserId && ar.Controller == ControllerName && ar.Action == ActionName).Count();
            }
            else
            {
                cnt = ARS.Where(ar => ar.UserId == UserId && ar.Controller == ControllerName && ar.Action == ActionName).Count();
            }
            bool result = cnt > 0 ? true : false;

            return(result);
        }
Exemplo n.º 10
0
 private void cmbUserName_SelectedValueChanged(object sender, EventArgs e)
 {
     try
     {
         if (cmbUserName.SelectedItem != null)
         {
             DataTable dtUserRoles = DataOperations.RetrieveUserRolesOnuserName(cmbUserName.SelectedItem.ToString());
             if (dtUserRoles != null)
             {
                 if (dtUserRoles.Rows.Count > 0)
                 {
                     ArrayList lstUserRoles = Validations.GetArrayListFromDataTable(dtUserRoles, 0);
                     cmbUserRole.DataSource = lstUserRoles;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         PepsiLiteErrorHandling.WriteErrorLog(ex.ToString());
     }
 }
Exemplo n.º 11
0
        public ActionResult Edit(int id)
        {
            PersonVM         viewModel        = new PersonVM();
            DataOperations   dataOperations   = new DataOperations();
            RegionRepository regionRepository = new RegionRepository();
            tbl_Person       tblItem          = dataOperations.GetPersonById(id);


            viewModel = populateDropDownList(viewModel);

            viewModel.ID          = id;
            viewModel.PIN         = tblItem.PIN;
            viewModel.FirstName   = tblItem.Name;
            viewModel.LastName    = tblItem.Surname;
            viewModel.FatherName  = tblItem.Fathername;
            viewModel.GenderType  = (int)tblItem.Gender;
            viewModel.PersonType  = (int)tblItem.PersonType;
            viewModel.Address     = tblItem.Address;
            viewModel.Description = tblItem.Description;

            return(View(viewModel));
        }
Exemplo n.º 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["loggedUser"] != null)
        {
            if (((User)Session["loggedUser"]).type.Equals("admin"))
            {
                Response.Redirect("index.aspx");
            }
            else
            {
            }
        }
        else
        {
            Response.Redirect("index.aspx");
        }
        int            eventId = int.Parse(Request["id"].ToString());
        DataOperations dop     = new DataOperations();

        dop.deleteEvent(eventId);
        Response.Redirect("MyEvents.aspx");
    }
Exemplo n.º 13
0
        private void ChangeCurrentOperation(DataOperations newState)
        {
            MenuItem item = findMenuItemByName("Вставить");

            switch (newState)
            {
            case DataOperations.none:
                currentOperation = DataOperations.none;
                item.IsEnabled   = false;
                break;

            case DataOperations.copy:
                currentOperation = DataOperations.copy;
                item.IsEnabled   = true;
                break;

            case DataOperations.cut:
                currentOperation = DataOperations.cut;
                item.IsEnabled   = true;
                break;
            }
        }
Exemplo n.º 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["loggedUser"] != null)
        {
            if (((User)Session["loggedUser"]).type.Equals("admin"))
            {
                Response.Redirect("index.aspx");
            }
            else
            {
            }
        }
        else
        {
            Response.Redirect("index.aspx");
        }
        DataOperations dop     = new DataOperations();
        int            eventId = int.Parse(Request["id"].ToString());

        eve = dop.getEvent(eventId);
        if (eve == null)
        {
            Response.Redirect("MyEvents.aspx");
        }
        else
        {
            if (!IsPostBack)
            {
                eventName.Value = eve.name;
                place.Value     = eve.place;
                category.Value  = eve.category_name;
                date.Value      = eve.date;
                hours.Value     = eve.start_time.Substring(0, eve.start_time.IndexOf(':'));
                minutes.Value   = eve.start_time.Substring(eve.start_time.IndexOf(':') + 1);
                duration.Value  = eve.duration.ToString();
                price.Value     = eve.price.ToString();
            }
        }
    }
        public void RowFitler_EqualsCaseSensitiveUsingNewView()
        {
            // arrange
            var bsContact = new BindingSource();
            var ops       = new DataOperations();

            bsContact.DataSource = ops.GetAll();

            // act
            var newView = bsContact.RowFilterNewView("ContactTitle", "Owner", true);

            // assert 1
            Assert.IsTrue(bsContact.Count == 19,
                          "Expected 19 records");

            // act 2
            bsContact.RowFilter("ContactTitle", "Order Administrator", true);

            // assert 2
            Assert.IsTrue(bsContact.Count == 2,
                          "Expected 2 records");
        }
Exemplo n.º 16
0
        public ActionResult DataSourceFacility(DataManager dm)
        {
            IEnumerable data  = _context.ViewAFacility.OrderBy(o => o.Facility).ToList();
            int         count = _context.ViewAFacility.ToList().Count();

            DataOperations operation = new DataOperations();

            //Performing filtering operation
            if (dm.Where != null)
            {
                data = operation.PerformWhereFilter(data, dm.Where, "and");
                var filtered = (IEnumerable <object>)data;
                count = filtered.Count();
            }
            //Performing search operation
            if (dm.Search != null)
            {
                data = operation.PerformSearching(data, dm.Search);
                var searched = (IEnumerable <object>)data;
                count = searched.Count();
            }
            //Performing sorting operation
            if (dm.Sorted != null)
            {
                data = operation.PerformSorting(data, dm.Sorted);
            }

            //Performing paging operations
            if (dm.Skip != 0)
            {
                data = operation.PerformSkip(data, dm.Skip);
            }
            if (dm.Take != 0)
            {
                data = operation.PerformTake(data, dm.Take);
            }

            return(Json(new { result = data, count = count }));
        }
Exemplo n.º 17
0
        public static float GetZoomAmountFromPinch(TouchState fingerOne, TouchState fingerTwo)
        {
            // Pinching
            if (DataOperations.IsPinching(ref fingerOne.Delta.X, ref fingerTwo.Delta.X, ref fingerOne.Delta.Y, ref fingerTwo.Delta.Y))
            {
                // Get delta distance between both touches
                double oldDistance   = DataOperations.GetDistance2D(fingerOne.LastPosition.X, fingerTwo.LastPosition.X, fingerOne.LastPosition.Y, fingerTwo.LastPosition.Y);
                double newDistance   = DataOperations.GetDistance2D(fingerOne.Position.X, fingerTwo.Position.X, fingerOne.Position.Y, fingerTwo.Position.Y);
                double deltaDistance = oldDistance - newDistance;

                // Precision control
                if (Math.Abs(deltaDistance) > pinchPrecision)
                {
                    float scale = (float)(newDistance / oldDistance);
                    float zoom  = (newDistance > oldDistance) ? scale : -scale;
                    zoom *= newDistance < oldDistance ? pinchSpeed * 2.0f : pinchSpeed;
                    return(zoom);
                }
            }

            return(0);
        }
Exemplo n.º 18
0
        public async Task GetProductsWithoutProjection()
        {
            var expectedProductName       = "Chai";
            var categoryIdentifier        = 1;
            var expectedProductIdentifier = 1;
            var expectedUnitsInStock      = 39;

            var result = await DataOperations.GetProductsWithoutProjection(categoryIdentifier);

            var firstProduct = result.FirstOrDefault();

            Assert.IsTrue(firstProduct is not null, "Expected a product");

            Assert.IsTrue(firstProduct.ProductName == expectedProductName,
                          $"Expected product-name {expectedProductName} got {firstProduct.ProductName}");

            Assert.IsTrue(firstProduct.ProductId == expectedProductIdentifier,
                          $"Expected product-id {expectedProductIdentifier} got {firstProduct.ProductId}");

            Assert.IsTrue(firstProduct.UnitsInStock == expectedUnitsInStock,
                          $"Expected units in stock {expectedUnitsInStock} got {firstProduct.UnitsInStock}");
        }
Exemplo n.º 19
0
        public ActionResult Create(BusinessCenterVM viewModel)
        {
            try
            {
                var UserProfile = (UserProfileSessionData)this.Session["UserProfile"];
                if (UserProfile != null)
                {
                    tbl_BusinessCenter item = new tbl_BusinessCenter()
                    {
                        Name        = viewModel.Name,
                        Description = viewModel.Description,
                        Address     = viewModel.Address,
                        InsertDate  = DateTime.Now,
                        InsertUser  = UserProfile.UserId
                    };

                    DataOperations     dataOperations = new DataOperations();
                    tbl_BusinessCenter dbItem         = dataOperations.AddBusinessCenter(item);
                    if (dbItem != null)
                    {
                        TempData["success"] = "Ok";
                        TempData["message"] = "Məlumatlar uğurla əlavə olundu";
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        TempData["success"] = "notOk";
                        TempData["message"] = "Məlumatlar əlavə olunarkən xəta baş verdi";
                        return(RedirectToAction("Index"));
                    }
                }
            }
            catch (ApplicationException ex)
            {
                return(View(viewModel));
            }
            throw new ApplicationException("Invalid model");
        }
Exemplo n.º 20
0
        /// <summary>
        /// Send email with a callback, not no using statement is used as
        /// doing so would circumvent the callback.
        /// </summary>
        /// <param name="pConfigurationSection"></param>
        /// <param name="pSendToo"></param>
        /// <returns></returns>
        public async Task ExampleSend3Async(string pConfigurationSection, string pSendToo, [CallerMemberName] string name = "")
        {
            var ops  = new DataOperations();
            var data = ops.Read(5);

            var mc = new MailConfiguration(pConfigurationSection);

            var mail = new MailMessage
            {
                Subject = $"Called from: {name}",
                From    = new MailAddress(mc.FromAddress)
            };

            mail.To.Add(pSendToo);
            mail.Priority   = MailPriority.High;
            mail.IsBodyHtml = true;

            mail.AlternateViews.PlainTextView(data.TextMessage);
            mail.AlternateViews.HTmlView(data.HtmlMessage);

            //send the message
            var smtp = new SmtpClient(mc.Host, mc.Port)
            {
                Credentials = new NetworkCredential(mc.UserName, mc.Password),
                EnableSsl   = mc.EnableSsl
            };


            smtp.SendCompleted += Smtp_SendCompleted;

            smtp.SendCompleted += (s, e) => {
                smtp.Dispose();
                mail.Dispose();
            };

            // ReSharper disable once AsyncConverter.AsyncAwaitMayBeElidedHighlighting
            await smtp.SendMailAsync(mail).ConfigureAwait(false);
        }
Exemplo n.º 21
0
        public static void Login(byte[] data, int length)
        {
            int offset        = 1;
            var reconnecting  = DataOperations.getByte(data, offset++);
            var clientVersion = DataOperations.getShort(data, offset);

            /* -- First bytes are always:
             *      75
             *      0
             *      0
             *      155
             *      41
             *      165
             *      20
             *      232
             *      64
             */


            /*
             *      Rest of packet is encrypted
             */
        }
Exemplo n.º 22
0
        protected void removeFriend(long arg0)
        {
            streamClass.createPacket(52);
            streamClass.addLong(arg0);
            streamClass.formatPacket();
            for (int i = 0; i < friendsCount; i++)
            {
                if (friendsList[i] != arg0)
                {
                    continue;
                }
                friendsCount--;
                for (int j = i; j < friendsCount; j++)
                {
                    friendsList[j]  = friendsList[j + 1];
                    friendsWorld[j] = friendsWorld[j + 1];
                }

                break;
            }

            displayMessage("@pri@" + DataOperations.hashToName(arg0) + " has been removed from your friends list");
        }
Exemplo n.º 23
0
        public ActionResult UrlDatasource([FromBody] DataManagerRequest dm)
        {
            IEnumerable DataSource = _context.Orders.ToList();

            DataOperations operation = new DataOperations();

            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting
            {
                DataSource = operation.PerformSorting(DataSource, dm.Sorted);
            }
            int count = DataSource.Cast <Orders>().Count();

            if (dm.Skip != 0)//Paging
            {
                DataSource = operation.PerformSkip(DataSource, dm.Skip);
            }
            if (dm.Take != 0)
            {
                DataSource = operation.PerformTake(DataSource, dm.Take);
            }

            return(Json(new { result = DataSource, count = count }));
        }
Exemplo n.º 24
0
        public IActionResult ForDropDown([FromBody] DataManagerRequest dm)
        {
            IEnumerable <Suppliers> DataSource = null;//= data.SqlQuery<Products>("select * from Products");
            DataOperations          operation  = new DataOperations();

            if (dm.Where != null && dm.Where.Count > 0) //Filtering
            {
                if (dm.Where.FirstOrDefault().value != null)
                {
                    // DataSource = operation.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator);
                    DataSource = data.SqlQuery <Suppliers>($"SELECT [Id], [Name] from Suppliers where " +
                                                           $"[Name] like CONCAT('%',@searching,'%') or " +
                                                           $"[Code] like CONCAT('%',@searching,'%') ORDER BY Id OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY", new { searching = dm.Where.FirstOrDefault().value });
                }
            }
            if (DataSource == null)
            {
                DataSource = data.SqlQuery <Suppliers>($"SELECT [Id], [Name] from Suppliers ORDER BY Id OFFSET 0 ROWS FETCH NEXT 20 ROWS ONLY");
            }
            int count = data.SqlQuery <int>("select count(*) from Suppliers").FirstOrDefault();

            return(dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource));
        }
Exemplo n.º 25
0
        /// <summary>
        /// Загрузить данные с API и с файла.
        /// </summary>
        /// <param name="connectionSettings">настройки подключения.</param>
        /// <returns>Результат операции.</returns>
        public async Task <bool> DownloadDataAsync(ConnectionSettings connectionSettings)
        {
            try
            {
                var dataOperation = new DataOperations(connectionSettings);
                var result        = await dataOperation.DownloadDataFromAPIAsync();

                if (result)
                {
                    await LoadDataAsync();

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch
            {
                return(false);
            }
        }
Exemplo n.º 26
0
        private void frmLogin_Load(object sender, EventArgs e)
        {
            try
            {
                GetUserNamesAndSetToUserNameTxtBox_AutoComplete();

                DataTable dtUserRoles = DataOperations.GetUserRoles();
                if (dtUserRoles != null)
                {
                    if (dtUserRoles.Rows.Count > 0)
                    {
                        UserRoleTbl = dtUserRoles;

                        cmbUserRoles.DataSource    = Validations.GetArrayListFromDataTable(dtUserRoles, 1);
                        cmbUserRoles.SelectedIndex = 1;
                    }
                }
            }
            catch (Exception ex)
            {
                PepsiLiteErrorHandling.WriteErrorLog(ex.ToString());
            }
        }
        public object Post([FromBody] DataManagerRequest dm)
        {
            BindDataSource();
            IEnumerable DataSource = Orders.ToList();

            if (dm.Search != null && dm.Search.Count > 0)
            {
                DataSource = DataOperations.PerformSearching(DataSource, dm.Search); //Search
            }
            if (dm.Sorted != null && dm.Sorted.Count > 0)                            //Sorting
            {
                DataSource = DataOperations.PerformSorting(DataSource, dm.Sorted);
            }
            if (dm.Where != null && dm.Where.Count > 0) //Filtering
            {
                DataSource = DataOperations.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator);
            }
            int count = DataSource.Cast <Order>().Count();

            if (dm.Skip != 0)
            {
                DataSource = DataOperations.PerformSkip(DataSource, dm.Skip);   //Paging
            }
            if (dm.Take != 0)
            {
                DataSource = DataOperations.PerformTake(DataSource, dm.Take);
            }
            if (dm.RequiresCounts)
            {
                return new { result = DataSource, count = count }
            }
            ;
            else
            {
                return new { result = DataSource }
            };
        }
Exemplo n.º 28
0
        /*
         *      SectionX and SectionY is basically
         *      Our starting X,Y. But with nothing better to go with
         *      The one that is default used is the one we get from starting pos in lumbridge
         *      (Grabbed from my XNA Client :P for quick ref)
         */



        public static void SetInventoryItems(sbyte[] packetData, int length)
        {
            var inv = Inventory.Instance;

            inv.Clear();

            int off = 1;
            var inventoryItemsCount = packetData[off++] & 0xff;

            for (int item = 0; item < inventoryItemsCount; item++)
            {
                int data = DataOperations.getShort(packetData, off);
                off += 2;

                var itemIndex = data & 0x7fff;
                var invItem   = new InventoryItem(itemIndex, data / 32768);

                invItem.ItemPictureIndex = DataLoader.baseItemPicture + Data.itemInventoryPicture[itemIndex];
                invItem.ItemPictureMask  = Data.itemPictureMask[itemIndex];

                // inventoryItems[item] = data & 0x7fff;
                // inventoryItemEquipped[item] = data / 32768;
                if (Data.itemStackable[data & 0x7fff] == 0)
                {
                    invItem.Amount = DataOperations.getInt(packetData, off);
                    // inventoryItemCount[item] = DataOperations.getInt(packetData, off);
                    off += 4;
                }
                else
                {
                    invItem.Amount = 1;
                    // inventoryItemCount[item] = 1;
                }

                inv.Add(invItem);
            }
        }
        public override object Read(DataManagerRequest dm, string key = null)
        {
            dummyProperty.InterfaceMethod();
            IEnumerable <Ord> DataSource = Orders;


            if (dm.Search != null && dm.Search.Count > 0)
            {
                // Searching
                DataSource = DataOperations.PerformSearching(DataSource, dm.Search);
            }
            if (dm.Sorted != null && dm.Sorted.Count > 0)
            {
                // Sorting
                DataSource = DataOperations.PerformSorting(DataSource, dm.Sorted);
            }
            if (dm.Where != null && dm.Where.Count > 0)
            {
                // Filtering
                DataSource = DataOperations.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator);
            }
            int count = DataSource.Cast <Ord>().Count();

            if (dm.Skip != 0)
            {
                //Paging
                DataSource = DataOperations.PerformSkip(DataSource, dm.Skip);
            }
            if (dm.Take != 0)
            {
                DataSource = DataOperations.PerformTake(DataSource, dm.Take);
            }
            return(dm.RequiresCounts ? new DataResult()
            {
                Result = DataSource, Count = count
            } : (object)DataSource);
        }
Exemplo n.º 30
0
 public ActionResult DataSource([FromBody] DataManagerRequest dm)
 {
     using (HttpClient client = new HttpClient())
     {
         client.BaseAddress = new Uri(iBaseURI);
         MediaTypeWithQualityHeaderValue contentType = new MediaTypeWithQualityHeaderValue("application/json");
         client.DefaultRequestHeaders.Accept.Add(contentType);
         HttpResponseMessage response = client.GetAsync("/api/VehicleTypes/?mdBID=" + mdBId).Result;
         var stringData = response.Content.ReadAsStringAsync().Result;
         List <VehicleType> acaSession = JsonConvert.DeserializeObject <List <VehicleType> >(stringData);
         DataOperations     operation  = new DataOperations();
         IEnumerable        data       = acaSession;
         var count = data.AsQueryable().Count();
         if (dm.Skip > 0)
         {
             data = operation.PerformSkip(data, dm.Skip);
         }
         if (dm.Take > 0)
         {
             data = operation.PerformTake(data, dm.Take);
         }
         return(Json(new { result = data, count = count }));
     }
 }