public JsonResult DeleteEnrollment(string ID)
        {
            //get the result using ignition web service
            var result = GroupEquipmentModels.DeleteEnrollment(ID);

            //return the json data
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult UpdateEnrollment(string ID, string username, string groupID, string hostID)
        {
            //get the result using ignition web service
            var result = GroupEquipmentModels.UpdateEnrollment(ID, username, groupID, hostID);

            //return the json data
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult ValidateEntryForUpdateWithHost(string username, string groupID, int ID, string host)
        {
            int count = 0;

            //get the result
            count = GroupEquipmentModels.CheckEntryForUpdateWithHost(username, groupID, ID, host);

            return(Json(count, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetAllGroup()
        {
            //get the result using ignition web service
            var groups = GroupEquipmentModels.GetAllGroup();

            string json = "";

            try
            {
                //serialize the object so that javascript can read the data
                json = JsonConvert.SerializeObject(groups);
            }
            catch
            {
                json = "";
            }

            //return the json data
            return(Json(json, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetGroupIDConnection()
        {
            List <string> result = GroupEquipmentModels.GetGroupIDConnection();

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#6
0
    public static List <EnrolledEquipment> GetChildEquipment(string groupID, string userID)
    {
        var result = GroupEquipmentModels.GetChildEquipment(groupID, userID);

        return(result);
    }
示例#7
0
    public static bool GroupHasChild(string groupID)
    {
        var result = GroupEquipmentModels.hasChildGroup(groupID);

        return(result);
    }
示例#8
0
    public static List <EquipmentGroupObject> GetEnrolledGroup()
    {
        var result = GroupEquipmentModels.GetEnrolledGroup();

        return(result);
    }
        public JsonResult GetGroupEquipmentList()
        {
            //create a dictionary that will contain the column + datafied config for the grid
            Dictionary <string, object> result_config = new Dictionary <string, object>();

            //get columns
            Dictionary <string, string> columns = GroupEquipmentModels.GetCols();

            //check for filters
            string where = "";
            Dictionary <string, string> filters = new Dictionary <string, string>();

            if (Request["filterscount"] != null && Int32.Parse(Request["filterscount"]) > 0)
            {
                for (int i = 0; i < Int32.Parse(Request["filterscount"]); i++)
                {
                    filters.Add("filtervalue" + i, Request["filtervalue" + i]);
                    filters.Add("filtercondition" + i, Request["filtercondition" + i]);
                    filters.Add("filterdatafield" + i, Request["filterdatafield" + i]);
                    filters.Add("filteroperator" + i, Request["filteroperator" + i]);
                }
                where = custom_helper.FormatFilterConditions(filters, Int32.Parse(Request["filterscount"]), columns);
            }

            //check for sorting ops
            string sorting = "";

            if (Request["sortdatafield"] != null)
            {
                sorting = Request["sortdatafield"].ToString() + " " + Request["sortorder"].ToString().ToUpper();
            }

            //determine if cols_only
            if (Request["cols_only"] != null && bool.Parse(Request["cols_only"]) == true)
            {
                //get total row count
                int totalRows = GroupEquipmentModels.GetCount(where, ((Request["searchStr"] == null) ? "" : Request["searchStr"].ToString()));

                //prepare column config
                var cols = new List <string>();
                foreach (var item in columns)
                {
                    cols.Add(item.Value);
                }

                Dictionary <string, object> cols_arr = custom_helper.PrepareStaticColumns(cols);
                result_config.Add("column_config", custom_helper.PrepareColumns(cols_arr));
                result_config.Add("TotalRows", totalRows);
            }
            else
            {
                //pagination initialization
                int pagenum  = Request["pagenum"] == null ? 0 : Int32.Parse(Request["pagenum"].ToString());
                int pagesize = Request["pagesize"] == null ? 0 : Int32.Parse(Request["pagesize"].ToString());
                int start    = pagenum * pagesize;

                //get data
                DataTable transactions = new DataTable();
                if (Request["showAll"] != null && bool.Parse(Request["showAll"]) == true)
                {
                    transactions = GroupEquipmentModels.GetData(0, 0, where, sorting, ((Request["searchStr"] == null) ? "" : Request["searchStr"].ToString()));
                }
                else
                {
                    transactions = GroupEquipmentModels.GetData(start, pagesize, where, sorting, ((Request["searchStr"] == null) ? "" : Request["searchStr"].ToString()));
                }

                //convert data into json object
                var data = custom_helper.DataTableToJson(transactions);

                result_config.Add("data", data);

                //prepare column config
                var cols = new List <string>();
                foreach (DataColumn column in transactions.Columns)
                {
                    cols.Add(column.ColumnName);
                }
                Dictionary <string, object> cols_arr = custom_helper.PrepareStaticColumns(cols);
                result_config.Add("column_config", custom_helper.PrepareColumns(cols_arr));
                result_config.Add("TotalRows", GroupEquipmentModels.GetCount(where, ((Request["searchStr"] == null) ? "" : Request["searchStr"].ToString())));
            }
            string temp = Request["searchStr"];

            response.Add("success", true);
            response.Add("error", false);
            response.Add("message", result_config);

            return(Json(response, JsonRequestBehavior.AllowGet));
        }