public ActionResult MyCustomPostBack(string type, JArray gridFields, JObject typeParams, int gridIndex, int gridPageSize, string FType) { var Grid1 = UIHelper.Grid("Grid1"); string sql = " and FType='" + FType + "'"; var ttbSearch = UIHelper.TwinTriggerBox("ttbSearchMessage"); if (type == "trigger1") { ttbSearch.Text(" "); ttbSearch.ShowTrigger1(false); } else if (type == "trigger2") { ttbSearch.ShowTrigger1(true); var triggerValue = typeParams.Value <string>("triggerValue"); sql = " and FName like '%" + triggerValue + "%'"; } Hashtable table = AddressSchemeDal.Search(gridIndex, gridPageSize, "FName", "ASC", sql); Grid1.DataSource(table["data"], gridFields); Grid1.RecordCount(Int32.Parse(table["total"].ToString())); Grid1.PageSize(gridPageSize); return(UIHelper.Result()); }
public ActionResult btnEdit_Click() { try { if (ModelState.IsValid) { Hashtable hasData = new Hashtable(); hasData["ID"] = Request["tbxID"]; hasData["FNumber"] = Request["tbxFNumber"]; hasData["FName"] = Request["tbxFName"]; hasData["FStartAddress"] = Request["tbxFStartAddress"]; hasData["FAddressLength"] = Convert.ToInt32(Request["tbxFAddressLength"]); hasData["FNote"] = Request["tbxFNote"]; hasData["FOrderBy"] = Convert.ToInt32(Request["tbxFOrderBy"]); hasData["FType"] = Request["ddlFType"]; hasData["FUpdUser"] = GetIdentityName(); hasData["FUpdDate"] = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); AddressSchemeDal.Update(hasData); ShowNotify("成功!"); // 关闭本窗体(触发窗体的关闭事件)' PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } } catch { ShowNotify("失败!"); } return(UIHelper.Result()); }
public ActionResult Index(string id) { ViewBag.FType = id; Hashtable table = AddressSchemeDal.Search(0, 20, "FName", "ASC", " and FType='" + id + "'"); ViewBag.Grid1DataSource = table["data"]; ViewBag.Grid1RecordCount = Int32.Parse(table["total"].ToString()); return(View()); }
private void UpdateGrid(JArray Grid1_fields, int gridIndex, int gridPageSize, string FType) { var Grid1 = UIHelper.Grid("Grid1"); string sql = " and FType='" + FType + "'"; Hashtable table = AddressSchemeDal.Search(gridIndex, gridPageSize, "FName", "ASC", sql); Grid1.DataSource(table["data"], Grid1_fields); Grid1.RecordCount(Int32.Parse(table["total"].ToString())); }
public ActionResult btnGetSelectedNode_Click(JObject selectedNode) { if (selectedNode.Count > 0) { int ID = Convert.ToInt32(selectedNode.Value <string>("id")); Hashtable hasData = new Hashtable(); hasData["ID"] = ID; hasData["FIsDelete"] = 1; hasData["FUpdDate"] = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ssss")); hasData["FUpdUser"] = GetIdentityName(); AddressSchemeDal.DeleteList(hasData); } return(RedirectToAction("Index", "AddressScheme")); }
public ActionResult btnCreate_Click() { try { if (ModelState.IsValid) { Hashtable hasData = new Hashtable(); hasData["FNumber"] = Request["tbxFNumber"]; hasData["FName"] = Request["tbxFName"]; hasData["FStartAddress"] = Request["tbxFStartAddress"]; hasData["FAddressLength"] = Convert.ToInt32(Request["tbxFAddressLength"]); hasData["FNote"] = Request["tbxFNote"]; hasData["FOrderBy"] = Convert.ToInt32(Request["tbxFOrderBy"]); hasData["FType"] = Request["ddlFType"]; hasData["FCreateUser"] = GetIdentityName(); hasData["FCreateDate"] = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); hasData["FIsDelete"] = 0; int id = AddressSchemeDal.Insert(hasData); if (id > 0) { DataTable table = AddressSchemeDal.SearchALL("", hasData["FType"].ToString()); for (int i = 0; i < table.Rows.Count; i++) { Hashtable hashtable = new Hashtable(); hashtable["FSchemeID"] = id; hashtable["FName"] = table.Rows[i]["FName"].ToString(); hashtable["FPLCAddress"] = table.Rows[i]["FPLCAddress"].ToString(); hashtable["FDBAddress"] = table.Rows[i]["FDBAddress"].ToString(); hashtable["FWorR"] = table.Rows[i]["FWorR"].ToString(); hashtable["FNote"] = table.Rows[i]["FNote"].ToString(); hashtable["FUnit"] = table.Rows[i]["FUnit"].ToString(); hashtable["FRate"] = table.Rows[i]["FRate"].ToString(); hashtable["FCreateDate"] = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); AddressSchemeEntryDal.Insert(hashtable); } } ShowNotify("成功!"); // 关闭本窗体(触发窗体的关闭事件)' PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } } catch { ShowNotify("失败!"); } return(UIHelper.Result()); }
public ActionResult Grid1_PageIndexChanged(JArray Grid1_fields, int Grid1_pageIndex, int gridPageSize, string searchMessage, string FType) { var Grid1 = UIHelper.Grid("Grid1"); string sql = " and FType='" + FType + "'"; if (!searchMessage.Equals("")) { sql = sql + " and FName like '%" + searchMessage + "%'"; } Hashtable table = AddressSchemeDal.Search(Grid1_pageIndex, gridPageSize, "FName", "ASC", sql); Grid1.DataSource(table["data"], Grid1_fields); Grid1.RecordCount(Int32.Parse(table["total"].ToString())); return(UIHelper.Result()); }
private void LoadData() { List <TreeNode> nodes = new List <TreeNode>(); TreeNode node1 = new TreeNode(); node1.Selectable = false; node1.Text = "泵站"; nodes.Add(node1); TreeNode node2 = new TreeNode(); node2.Text = "阀门"; node2.Selectable = false; nodes.Add(node2); TreeNode node3 = new TreeNode(); node3.Text = "流量"; node3.Selectable = false; nodes.Add(node3); TreeNode node4 = new TreeNode(); node4.Text = "水厂"; node4.Selectable = false; nodes.Add(node4); TreeNode node5 = new TreeNode(); node5.Text = "水源"; node5.Selectable = false; nodes.Add(node5); TreeNode node6 = new TreeNode(); node6.Text = "大表"; node6.Selectable = false; nodes.Add(node6); TreeNode node7 = new TreeNode(); node7.Text = "压力"; node7.Selectable = false; nodes.Add(node7); TreeNode node8 = new TreeNode(); node8.Text = "调峰"; node8.Selectable = false; nodes.Add(node8); TreeNode node9 = new TreeNode(); node9.Text = "水质"; node9.Selectable = false; nodes.Add(node9); Hashtable hashtable = AddressSchemeDal.Search(0, 1000, "FOrderBy", "ASC", " "); // 模拟从数据库返回数据表 DataTable table = (DataTable)hashtable["data"];; DataSet ds = new DataSet(); ds.Tables.Add(table); foreach (DataRow row in ds.Tables[0].Rows) { TreeNode node = new TreeNode(); node.Text = row["FName"].ToString(); node.NodeID = row["ID"].ToString(); node.Target = "treemainframe"; node.NavigateUrl = "~/BasicInfo/AddressScheme/AddressSchemeEntry?FSchemeID=" + row["ID"].ToString(); if (row["FType"].ToString() == "1") { node1.Nodes.Add(node); } else if (row["FType"].ToString() == "2") { node2.Nodes.Add(node); } else if (row["FType"].ToString() == "3") { node3.Nodes.Add(node); } else if (row["FType"].ToString() == "4") { node4.Nodes.Add(node); } else if (row["FType"].ToString() == "5") { node5.Nodes.Add(node); } else if (row["FType"].ToString() == "6") { node6.Nodes.Add(node); } else if (row["FType"].ToString() == "7") { node7.Nodes.Add(node); } else if (row["FType"].ToString() == "8") { node8.Nodes.Add(node); } else if (row["FType"].ToString() == "9") { node9.Nodes.Add(node); } } // 视图数据 ViewBag.Tree1Nodes = nodes.ToArray(); }