Esempio n. 1
0
        public void Update(string select, int typeId, string baseId, JArray GridAlarmPara_modifiedData)
        {
            DataTable dt_have   = Alarm_ParamDal.SearchHaveParmUpdate(select, typeId, baseId);
            Hashtable hasUpdate = new Hashtable();

            if (dt_have.Rows.Count > 0)
            {
                for (int i = 0; i < dt_have.Rows.Count; i++)
                {
                    string id = dt_have.Rows[i][0].ToString();
                    foreach (JObject item in GridAlarmPara_modifiedData)
                    {
                        Dictionary <string, object> rowDict = item.Value <JObject>("values").ToObject <Dictionary <string, object> >();
                        if (id.Equals(item.Value <string>("id")))
                        {
                            if (rowDict.Keys.Contains("FLev"))
                            {
                                hasUpdate["FLev"] = rowDict["FLev"];
                            }
                            if (rowDict.Keys.Contains("FSetMsg"))
                            {
                                hasUpdate["FSetMsg"] = rowDict["FSetMsg"];
                            }
                            hasUpdate["id"] = Convert.ToInt32(dt_have.Rows[i]["TimelyID"].ToString());
                            Alarm_ParamDal.UpdateTimely(hasUpdate);
                            continue;
                        }
                    }
                }
            }
        }
        public ActionResult MyCustomPostBack(string type, JArray gridFields, JObject typeParams, int gridIndex, int gridPageSize)
        {
            var    Grid1     = UIHelper.Grid("Grid1");
            string sql       = string.Empty;
            var    ttbSearch = UIHelper.TwinTriggerBox("ttbSearchMessage");

            if (type == "trigger1")
            {
                ttbSearch.Text(String.Empty);
                ttbSearch.ShowTrigger1(false);
            }
            else if (type == "trigger2")
            {
                ttbSearch.ShowTrigger1(true);
                var triggerValue = typeParams.Value <string>("triggerValue");
                sql = " and FMsg like '%" + triggerValue + "%'";
            }
            else if (type == "searchType")
            {
                var triggerValue = typeParams.Value <string>("searchType");
                sql = sql + " and FMarkerType = '" + triggerValue + "'";
            }

            Hashtable table = Alarm_ParamDal.Search(gridIndex, gridPageSize, "FMarkerType", "ASC", sql);

            Grid1.PageSize(gridPageSize);
            Grid1.DataSource(table["data"], gridFields);
            Grid1.RecordCount(Int32.Parse(table["total"].ToString()));

            return(UIHelper.Result());
        }
        public ActionResult Grid1_PageIndexChanged(JArray Grid1_fields, int Grid1_pageIndex, int gridPageSize, string searchType, string searchMessage)
        {
            var    grid1 = UIHelper.Grid("Grid1");
            string sql   = string.Empty;

            if (!searchType.Equals(""))
            {
                sql = sql + " and FMarkerType = '" + searchType + "'";
            }
            if (!searchMessage.Equals(""))
            {
                sql = sql + " and FMsg like '%" + searchMessage + "%'";
            }
            Hashtable table       = Alarm_ParamDal.Search(Grid1_pageIndex, gridPageSize, "FMarkerType", "ASC", sql);
            var       recordCount = Int32.Parse(table["total"].ToString());

            // 1.设置总项数(数据库分页回发时,如果总记录数不变,可以不设置RecordCount)
            grid1.RecordCount(recordCount);
            grid1.PageSize(gridPageSize);
            // 2.获取当前分页数据
            var dataSource = table["data"];

            grid1.DataSource(dataSource, Grid1_fields);

            return(UIHelper.Result());
        }
        public ActionResult Index()
        {
            Hashtable table = Alarm_ParamDal.Search(0, 1000, "FMarkerType", "ASC", " and FMarkerType = '1'");

            ViewBag.Grid1DataSource  = table["data"];
            ViewBag.Grid1RecordCount = Int32.Parse(table["total"].ToString());
            return(View());
        }
Esempio n. 5
0
        public void PumpTongBu(string baseId, int typeId)
        {
            DataTable dt_pump = Alarm_ParamDal.SearchPump_JZID(baseId);

            for (int i = 0; i < dt_pump.Rows.Count; i++)
            {
                Alarm_ParamDal.TongBu(baseId, dt_pump.Rows[i]["ID"].ToString(), typeId);
            }
        }
        public ActionResult btnSubmit_Click(JArray Grid1_fields, JArray Grid1_modifiedData, int Grid1_pageIndex, int gridPageSize, string searchType, string searchMessage)
        {
            Hashtable table  = Alarm_ParamDal.Search(0, 1000, "FMarkerType", "ASC", "");
            DataTable source = (DataTable)table["data"];

            foreach (JObject modifiedRow in Grid1_modifiedData)
            {
                string status = modifiedRow.Value <string>("status");
                string rowId  = modifiedRow.Value <string>("id");
                if (status == "modified")
                {
                    UpdateDataRow(modifiedRow, Convert.ToInt32(rowId), source);
                }
                else if (status == "newadded")
                {
                    DataRow rowData = CreateNewData(modifiedRow, source);
                    source.Rows.Add(rowData);
                }
                else if (status == "deleted")
                {
                    DeleteRowByID(source, Convert.ToInt32(rowId));
                }
            }

            var    grid1 = UIHelper.Grid("Grid1");
            string sql   = string.Empty;

            if (!searchType.Equals(""))
            {
                sql = sql + " and FMarkerType = '" + searchType + "'";
            }
            if (!searchMessage.Equals(""))
            {
                sql = sql + " and FMsg like '%" + searchMessage + "%'";
            }
            Hashtable table1      = Alarm_ParamDal.Search(Grid1_pageIndex, gridPageSize, "FMarkerType", "ASC", sql);
            var       recordCount = Int32.Parse(table1["total"].ToString());

            // 1.设置总项数(数据库分页回发时,如果总记录数不变,可以不设置RecordCount)
            grid1.RecordCount(recordCount);
            grid1.PageSize(gridPageSize);
            // 2.获取当前分页数据
            var dataSource = table1["data"];

            grid1.DataSource(dataSource, Grid1_fields);

            ShowNotify("数据保存成功!");

            return(UIHelper.Result());
        }
        private void UpdateDataRow(JObject modifiedRow, int rowId, DataTable source)
        {
            DataRow rowData = FindRowByID(source, rowId);

            UpdateDataRow(modifiedRow, rowData);

            Hashtable hasData = new Hashtable();

            hasData["id"]          = rowData["ID"];
            hasData["FMarkerType"] = rowData["FMarkerType"];
            hasData["FKey"]        = rowData["FKey"];
            hasData["FMsg"]        = rowData["FMsg"];
            hasData["FLev"]        = rowData["FLev"];
            Alarm_ParamDal.Update(hasData);
        }