Skip to content

Commit f46abad

Browse files
author
alansangeeths
authored
Merge pull request #1 from ponselvajeganathan/patch-1
Changes
2 parents 47136af + 2afef27 commit f46abad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+29801
-2
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29311.281
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteSave", "RemoteSave\RemoteSave.csproj", "{BBEA5C46-0766-4E32-9105-0C838CD55A56}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{BBEA5C46-0766-4E32-9105-0C838CD55A56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{BBEA5C46-0766-4E32-9105-0C838CD55A56}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{BBEA5C46-0766-4E32-9105-0C838CD55A56}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{BBEA5C46-0766-4E32-9105-0C838CD55A56}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {656160AF-AFCE-4E5E-AE3F-097D07991DDE}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System.Web;
2+
using System.Web.Optimization;
3+
4+
namespace RemoteSave
5+
{
6+
public class BundleConfig
7+
{
8+
// For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862
9+
public static void RegisterBundles(BundleCollection bundles)
10+
{
11+
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
12+
"~/Scripts/jquery-{version}.js"));
13+
14+
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
15+
"~/Scripts/jquery.validate*"));
16+
17+
// Use the development version of Modernizr to develop with and learn from. Then, when you're
18+
// ready for production, use the build tool at https://modernizr.com to pick only the tests you need.
19+
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
20+
"~/Scripts/modernizr-*"));
21+
22+
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
23+
"~/Scripts/bootstrap.js"));
24+
25+
bundles.Add(new StyleBundle("~/Content/css").Include(
26+
"~/Content/bootstrap.css",
27+
"~/Content/site.css"));
28+
}
29+
}
30+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System.Web;
2+
using System.Web.Mvc;
3+
4+
namespace RemoteSave
5+
{
6+
public class FilterConfig
7+
{
8+
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
9+
{
10+
filters.Add(new HandleErrorAttribute());
11+
}
12+
}
13+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Web.Mvc;
6+
using System.Web.Routing;
7+
8+
namespace RemoteSave
9+
{
10+
public class RouteConfig
11+
{
12+
public static void RegisterRoutes(RouteCollection routes)
13+
{
14+
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
15+
16+
routes.MapRoute(
17+
name: "Default",
18+
url: "{controller}/{action}/{id}",
19+
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
20+
);
21+
}
22+
}
23+
}
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Web.Mvc;
6+
using RemoteSave.Models;
7+
using Syncfusion.EJ2.Base;
8+
using System.Collections;
9+
using Syncfusion.EJ2.Linq;
10+
using Syncfusion.EJ2.Navigations;
11+
12+
namespace RemoteSave.Controllers
13+
{
14+
public class HomeController : Controller
15+
{
16+
public ActionResult Index()
17+
{
18+
return View();
19+
}
20+
public ActionResult UrlDatasource(DataManagerRequest dm)
21+
{
22+
if (TreeData.tree.Count == 0)
23+
TreeData.GetTree();
24+
IEnumerable DataSource = TreeData.tree;
25+
26+
DataOperations operation = new DataOperations();
27+
if (dm.Where != null && dm.Where.Count > 0)
28+
{
29+
DataSource = operation.PerformFiltering(DataSource, dm.Where, "and");
30+
}
31+
List<string> str = new List<string>();
32+
33+
if (dm.Sorted != null && dm.Sorted.Count > 0)
34+
{
35+
DataSource = operation.PerformSorting(DataSource, dm.Sorted);
36+
}
37+
var count = DataSource.ToList<TreeData>().Count();
38+
if (dm.Skip != 0)
39+
{
40+
DataSource = operation.PerformSkip(DataSource, dm.Skip); //Paging
41+
}
42+
if (dm.Take != 0)
43+
{
44+
DataSource = operation.PerformTake(DataSource, dm.Take);
45+
}
46+
return dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource);
47+
}
48+
49+
public ActionResult Update(TreeData value)
50+
{
51+
var val = TreeData.tree.Where(ds => ds.TaskID == value.TaskID).FirstOrDefault();
52+
val.TaskName = value.TaskName;
53+
val.StartDate = value.StartDate;
54+
val.Duration = value.Duration;
55+
val.Priority = value.Priority;
56+
val.Progress = value.Progress;
57+
return Json(value);
58+
}
59+
60+
public void Insert(TreeData value, int relationalKey)
61+
{
62+
var i = 0;
63+
for (; i < TreeData.tree.Count; i++)
64+
{
65+
if (TreeData.tree[i].TaskID == relationalKey)
66+
{
67+
break;
68+
}
69+
}
70+
i += FindChildRecords(relationalKey);
71+
TreeData.tree.Insert(i + 1, value);
72+
}
73+
public int FindChildRecords(int? id)
74+
{
75+
var count = 0;
76+
for (var i = 0; i < TreeData.tree.Count; i++)
77+
{
78+
if (TreeData.tree[i].ParentItem == id)
79+
{
80+
count++;
81+
count += FindChildRecords(TreeData.tree[i].TaskID);
82+
}
83+
}
84+
return count;
85+
}
86+
87+
public void Delete(int key)
88+
{
89+
TreeData.tree.Remove(TreeData.tree.Where(ds => ds.TaskID == key).FirstOrDefault());
90+
}
91+
92+
// Remove method (batchUrl) will be triggered when we delete parent record.
93+
94+
public void Remove(List<TreeData> changed, List<TreeData> added, List<TreeData> deleted)
95+
{
96+
for (var i = 0; i < deleted.Count; i++)
97+
{
98+
TreeData.tree.Remove(TreeData.tree.Where(ds => ds.TaskID == deleted[i].TaskID).FirstOrDefault());
99+
}
100+
}
101+
102+
public class CustomBind : TreeData
103+
{
104+
public TreeData parentItem;
105+
}
106+
107+
public class ICRUDModel
108+
{
109+
public TreeData value;
110+
public int key;
111+
public string action;
112+
}
113+
}
114+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%@ Application Codebehind="Global.asax.cs" Inherits="RemoteSave.MvcApplication" Language="C#" %>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Web.Mvc;
6+
using System.Web.Optimization;
7+
using System.Web.Routing;
8+
9+
namespace RemoteSave
10+
{
11+
public class MvcApplication : System.Web.HttpApplication
12+
{
13+
protected void Application_Start()
14+
{
15+
AreaRegistration.RegisterAllAreas();
16+
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
17+
RouteConfig.RegisterRoutes(RouteTable.Routes);
18+
BundleConfig.RegisterBundles(BundleTable.Bundles);
19+
}
20+
}
21+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
6+
namespace RemoteSave.Models
7+
{
8+
public class TreeData
9+
{
10+
public static List<TreeData> tree = new List<TreeData>();
11+
[System.ComponentModel.DataAnnotations.Key]
12+
public int TaskID { get; set; }
13+
public string TaskName { get; set; }
14+
public DateTime StartDate { get; set; }
15+
public DateTime EndDate { get; set; }
16+
public String Progress { get; set; }
17+
public String Priority { get; set; }
18+
public int Duration { get; set; }
19+
public int? ParentItem { get; set; }
20+
public bool? isParent { get; set; }
21+
public TreeData() { }
22+
public static List<TreeData> GetTree()
23+
{
24+
if (tree.Count == 0)
25+
{
26+
int root = -1;
27+
for (var t = 1; t <= 5; t++)
28+
{
29+
Random ran = new Random();
30+
string math = (ran.Next() % 3) == 0 ? "High" : (ran.Next() % 2) == 0 ? "Release Breaker" : "Critical";
31+
string progr = (ran.Next() % 3) == 0 ? "Started" : (ran.Next() % 2) == 0 ? "Open" : "In Progress";
32+
root++;
33+
int rootItem = tree.Count + root + 1;
34+
tree.Add(new TreeData() { TaskID = rootItem, TaskName = "Parent Task " + rootItem.ToString(), StartDate = new DateTime(1992, 06, 07), EndDate = new DateTime(1994, 08, 25), isParent = true, ParentItem = null, Progress = progr, Priority = math, Duration = (ran.Next(1, 50) * 5) });
35+
int parent = tree.Count;
36+
for (var c = 0; c < 3; c++)
37+
{
38+
root++;
39+
string val = ((parent + c + 1) % 3 == 0) ? "Low" : "Critical";
40+
int parn = parent + c + 1;
41+
progr = (ran.Next() % 3) == 0 ? "In Progress" : (ran.Next() % 2) == 0 ? "Open" : "Validated";
42+
int iD = tree.Count + root + 1;
43+
tree.Add(new TreeData() { TaskID = iD, TaskName = "Child Task " + iD.ToString(), StartDate = new DateTime(1992, 06, 07), EndDate = new DateTime(1994, 08, 25), isParent = false, ParentItem = rootItem, Progress = progr, Priority = val, Duration = ran.Next(1, 50) });
44+
if ((((parent + c + 1) % 2) == 0))
45+
{
46+
int immParent = tree.Count;
47+
for (var s = 0; s < 2; s++)
48+
{
49+
root++;
50+
string Prior = (immParent % 2 == 0) ? "Validated" : "Normal";
51+
tree.Add(new TreeData() { TaskID = tree.Count + root + 1, TaskName = "Sub Task " + (tree.Count + root + 1).ToString(), StartDate = new DateTime(1992, 06, 07), EndDate = new DateTime(1994, 08, 25), isParent = false, ParentItem = iD, Progress = (immParent % 2 == 0) ? "On Progress" : "Closed", Priority = Prior, Duration = ran.Next(1, 50) });
52+
}
53+
}
54+
}
55+
}
56+
}
57+
return tree;
58+
}
59+
}
60+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("RemoteSave")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("RemoteSave")]
13+
[assembly: AssemblyCopyright("Copyright © 2019")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("eb63781e-c7f3-4762-818b-b3bfb0025568")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Revision and Build Numbers
33+
// by using the '*' as shown below:
34+
[assembly: AssemblyVersion("1.0.0.0")]
35+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)