protected void Page_Load(object sender, EventArgs e)
        {
            string appID = Convert.ToString(Request.QueryString["appID"]);

            if (!string.IsNullOrEmpty(appID))
            {
                isEdit = true;
            }
            else
            {
                isEdit = false;
            }
            if (!IsPostBack)
            {
                appList = ComponentDb.GetAll();
                BindData();
                if (isEdit)
                {
                    Component application = ComponentLogic.GetByAppId(appID);
                    AppNameTxt.Value = application.AppName;
                    // AppIDTxt.Value = application.AppID;
                    if (application.ChildrenComponents != null && application.ChildrenComponents.Count > 0)
                    {
                        foreach (var item in application.ChildrenComponents)
                        {
                            ListItem listItem = new ListItem(item.AppName, item.Id.ToString());
                            listItem.Selected = true;
                            AppsDrpDown.Items.Add(listItem);
                        }
                    }
                    SaveButton.Text = "Update";
                    ID = application.Id.ToString();
                }
            }
        }
Example #2
0
 public static bool isExist(string appId, string appName, string exclusion, out string state)
 {
     try
     {
         state = string.Empty;
         var result = ComponentDb.GetByAppIdAndAppName(appId, appName, exclusion);
         if (result == null)
         {
             return(false);
         }
         else
         {
             if (result.AppName.ToLower().Trim().Equals(appName.ToLower().Trim()))
             {
                 state = "App Name";
             }
             else if (result.AppID == appId)
             {
                 state = "App ID";
             }
             return(true);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #3
0
 public static IList <Component> GetParentComponents(Component childComponent)
 {
     try
     {
         return(ComponentDb.GetParentComponents(childComponent));
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #4
0
 public static List <Component> GetAllComponents()
 {
     try
     {
         return(ComponentDb.GetAllComponents());
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #5
0
 public static Component GetByAppId(string appId)
 {
     try
     {
         return(ComponentDb.GetByAppId(appId));
     }
     catch (Exception)
     {
         throw;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            int    echo          = Int32.Parse(Request.Params["sEcho"]);
            int    displayLength = Int32.Parse(Request.Params["iDisplayLength"]);
            int    displayStart  = Int32.Parse(Request.Params["iDisplayStart"]);
            int    start         = displayStart;
            string search        = Request.Params["sSearch"];

            ///////////
            //SEARCH (filter)
            //- build the where clause
            ////////
            StringBuilder sb = new StringBuilder();

            /////////////
            /// JSON output
            /// - build JSON output from DB results
            /// ///////////

            sb.Clear();
            string           outputJson          = string.Empty;
            int              totalDisplayRecords = 0;
            int              totalRecords        = 0;
            List <Component> components          = ComponentDb.Find("", search, (displayStart / displayLength), displayLength, "DESC", "Default", out totalDisplayRecords);

            totalRecords = components.Count();
            foreach (var component in components)
            {
                start++;
                sb.Append("[");
                sb.Append("\"" + (start) + "\",");
                sb.Append("\"" + component.AppName + "\",");
                sb.Append("\"" + component.AppID + "\",");
                string buttonHtml = string.Format(@"<button type='button' onclick=editComponent('{0}'); class='btn btn-primary btn-xs' >Edit</button>", component.AppID);
                sb.Append("\"" + buttonHtml + "\"");
                sb.Append("],");
            }
            outputJson = sb.ToString();
            outputJson = outputJson.Remove(outputJson.Length - 1);
            sb.Clear();

            sb.Append("{");
            sb.Append("\"sEcho\": ");
            sb.Append(echo);
            sb.Append(",");
            sb.Append("\"iTotalRecords\": ");
            sb.Append(totalRecords);
            sb.Append(",");
            sb.Append("\"iTotalDisplayRecords\": ");
            sb.Append(totalDisplayRecords);
            sb.Append(",");
            sb.Append("\"aaData\": [");
            sb.Append(outputJson);
            sb.Append("]}");
            outputJson = sb.ToString();

            /////////////
            /// Write to Response
            /// - clear other HTML elements
            /// - flush out JSON output
            /// ///////////
            Response.Clear();
            Response.ClearHeaders();
            Response.ClearContent();
            Response.Write(outputJson);
            Response.Flush();
            Response.End();
        }