private void ResolveSubTree(DataRow dataRow, FineUIPro.TreeNode treeNode) { DataRow[] rows = dataRow.GetChildRows("TreeRelation"); if (rows.Length > 0) { // 如果是目录,则默认展开 treeNode.Expanded = true; foreach (DataRow row in rows) { FineUIPro.TreeNode node = new FineUIPro.TreeNode(); node.NodeID = row["dptId"].ToString(); node.Text = row["dptName"].ToString(); node.EnableCheckBox = true; node.EnableCheckEvent = true; treeNode.Nodes.Add(node); ResolveSubTree(row, node); } } }
protected StringBuilder GetTreeNode(FineUIPro.TreeNode nodes, StringBuilder strTree, bool first) { if (first) { strTree.Append(nodes.NodeID.Trim() + ","); } for (int i = 0; i < nodes.Nodes.Count; i++) { if (nodes.Nodes[i].Leaf) { strTree.Append(nodes.Nodes[i].NodeID.Trim() + ","); } else { GetTreeNode(nodes.Nodes[i], strTree, true); } } return(strTree); }
protected void btnMpci_Click(object sender, EventArgs e) { FineUIPro.TreeNode treenode = firsttree.SelectedNode; editclassID.Text = treenode.NodeID; pd_kidclass_main ul = new pd_kidclass_main(); DataTable dt = ul.getEditdata(treenode.NodeID); if (dt != null && dt.Rows.Count > 0) { mainmpicWindow.Hidden = false; mainmpicweditID.Text = treenode.NodeID; setPageContent(1); } else { secondrecWin.Hidden = false; secondrecWineditID.Text = treenode.NodeID; setPageContent1(1); } }
private void ResolveSubTree(DataRow dataRow, FineUIPro.TreeNode treeNode) { DataRow[] rows = dataRow.GetChildRows("TreeRelation"); if (rows.Length > 0) { // 如果是目录,则默认展开 treeNode.Expanded = true; foreach (DataRow row in rows) { FineUIPro.TreeNode node = new FineUIPro.TreeNode(); node.Text = row["nodetext"].ToString(); string strnodeid = row["nodeid"].ToString(); node.NodeID = strnodeid; node.NavigateUrl = strnodeid.Replace("_", "/") + ".aspx"; node.EnableCheckEvent = true; treeNode.Nodes.Add(node); ResolveSubTree(row, node); } } }
protected void BindTree() { TreeDpt.Nodes.Clear(); BLL.tDepartMent BLL = new BLL.tDepartMent(); DataSet ds = BLL.GetAllList(); ds.Relations.Add("TreeRelation", ds.Tables[0].Columns["dptId"], ds.Tables[0].Columns["dptFatherId"], false); foreach (DataRow row in ds.Tables[0].Rows) { if (row.IsNull("dptFatherId")) { FineUIPro.TreeNode node = new FineUIPro.TreeNode(); node.NodeID = row["dptId"].ToString(); node.Text = row["dptName"].ToString(); node.EnableClickEvent = true; TreeDpt.Nodes.Add(node); ResolveSubTree(row, node); } } }
protected void cadLookup_Click(object sender, EventArgs e) { FineUIPro.TreeNode treenode = firsttree.SelectedNode; if (treenode.Attributes["nodemenu"].ToString().Trim() == "2") { pd_cad pc = new pd_cad(); string strfilename = pc.isExistdata("pd_cad", "pid", treenode.NodeID, "filename"); //GrapkTabStrip.ActiveTabIndex = 2; if (strfilename.Trim() != "") { PageContext.RegisterStartupScript("openwebcad('http://" + Request.Url.Authority.Trim() + "/resources/cad/" + strfilename + "')"); } else { PageContext.RegisterStartupScript("clearcad()"); } } }
private void ResolveSubTree(DataRow dataRow, FineUIPro.TreeNode treeNode) { string Id = Request.QueryString["Id"]; DataRow[] rows = dataRow.GetChildRows("TreeRelation"); if (rows.Length > 0) { // 如果是目录,则默认展开 treeNode.Expanded = true; foreach (DataRow row in rows) { FineUIPro.TreeNode node = new FineUIPro.TreeNode(); node.NodeID = row["dptId"].ToString(); node.Text = ("[" + GetIsSave(int.Parse(Id), int.Parse(node.NodeID)) + "]"); node.Text += row["dptName"].ToString(); node.EnableClickEvent = true; treeNode.Nodes.Add(node); ResolveSubTree(row, node); } } }
protected void BindTree() { TreeDpt.Nodes.Clear(); BLL.tMenu BLL = new BLL.tMenu(); DataSet ds = BLL.GetAllList(); ds.Relations.Add("TreeRelation", ds.Tables[0].Columns["mCode"], ds.Tables[0].Columns["mFaherId"], false); foreach (DataRow row in ds.Tables[0].Rows) { if (row.IsNull("mFaherId")) { FineUIPro.TreeNode node = new FineUIPro.TreeNode(); node.NodeID = row["mCode"].ToString(); node.Text = row["mName"].ToString(); node.Icon = (Icon)Enum.Parse(typeof(Icon), row["mIcon"].ToString(), true); node.EnableClickEvent = true; TreeDpt.Nodes.Add(node); ResolveSubTree(row, node); } } }
private void inittree() { // 模拟从数据库返回数据表 systemMenu sm = new systemMenu(); DataTable table = sm.getBindTreeDataAsdt(); DataSet ds = new DataSet(); ds.Tables.Add(table); ds.Relations.Add("TreeRelation", ds.Tables[0].Columns["id"], ds.Tables[0].Columns["pid"]); foreach (DataRow row in ds.Tables[0].Rows) { if (row.IsNull("pid")) { FineUIPro.TreeNode node = new FineUIPro.TreeNode(); node.Text = row["nodetext"].ToString(); node.NodeID = row["id"].ToString(); node.EnableCheckEvent = true; firsttree.Nodes.Add(node); ResolveSubTree(row, node); } } }
private void ResolveSubTree(DataRow dataRow, FineUIPro.TreeNode treeNode) { DataRow[] rows = dataRow.GetChildRows("TreeRelation"); if (rows.Length > 0) { // 如果是目录,则默认展开 treeNode.Expanded = true; foreach (DataRow row in rows) { FineUIPro.TreeNode node = new FineUIPro.TreeNode(); node.Text = row["nodetext"].ToString(); node.NodeID = row["id"].ToString(); node.Attributes.Add("nodemenu", row["nodemenu"].ToString().Trim()); node.Attributes.Add("isclick", row["isclick"].ToString().Trim()); node.EnableClickEvent = true; treeNode.Nodes.Add(node); ResolveSubTree(row, node); } } }
private void inittree() { firsttree.Nodes.Clear(); // 模拟从数据库返回数据表 pd_machinekit pm = new pd_machinekit(); DataTable table = pm.getBindTreeDataAsdt(); DataSet ds = new DataSet(); ds.Tables.Add(table); ds.Relations.Add("TreeRelation", ds.Tables[0].Columns["id"], ds.Tables[0].Columns["pid"]); foreach (DataRow row in ds.Tables[0].Rows) { if (row.IsNull("pid")) { FineUIPro.TreeNode node = new FineUIPro.TreeNode(); node.Text = row["nodetext"].ToString(); node.NodeID = row["id"].ToString(); node.Attributes.Add("nodemenu", row["nodemenu"].ToString().Trim()); if (row["isclick"].ToString().Trim() == "2") { node.EnableClickEvent = true; } firsttree.Nodes.Add(node); ResolveSubTree(row, node); } } getnodesum(firsttree.Nodes[0]); setrepeat(); }
protected void BindTree() { TreeDpt.Nodes.Clear(); int dptId = GetIdentityUser().dptId; IDataParameter[] parameters = new IDataParameter[] { new SqlParameter("@dptId", dptId) }; DataSet ds = DbHelperSQL.RunProcedure("GetChildrenDptTree", parameters, "dptTree"); ds.Relations.Add("TreeRelation", ds.Tables[0].Columns["dptId"], ds.Tables[0].Columns["dptFatherId"], false); foreach (DataRow row in ds.Tables[0].Rows) { if (row["dptId"].ToString() == dptId.ToString()) { FineUIPro.TreeNode node = new FineUIPro.TreeNode(); node.NodeID = row["dptId"].ToString(); node.Text = row["dptName"].ToString(); node.EnableClickEvent = true; TreeDpt.Nodes.Add(node); ResolveSubTree(row, node); } } TreeDpt.SelectedNodeID = dptId.ToString(); }
private void inittreeMenu() { // 模拟从数据库返回数据表 userMenu um = new userMenu(); DataTable table = um.gettreeMenudata(SessionUserName); DataSet ds = new DataSet(); ds.Tables.Add(table); ds.Relations.Add("TreeRelation", ds.Tables[0].Columns["id"], ds.Tables[0].Columns["pid"]); foreach (DataRow row in ds.Tables[0].Rows) { if (row.IsNull("pid")) { FineUIPro.TreeNode node = new FineUIPro.TreeNode(); node.Text = row["nodetext"].ToString(); node.NodeID = row["nodeid"].ToString(); node.EnableCheckEvent = true; treeMenu.Nodes.Add(node); ResolveSubTree(row, node); } } }
protected void menuDelete_Click(object sender, EventArgs e) { FineUIPro.TreeNode treenode = firsttree.SelectedNode; string strID = treenode.NodeID.Trim(); //需检查零件在组件和产品表中是否存在 //未删除图片图纸 if (strID != "") { pd_compongall_compose pcc = new pd_compongall_compose(); pd_product_compose ppc = new pd_product_compose(); if (pcc.isExistdata("pd_compongall_compose", "composeID", strID, "ID").Trim() != "" && ppc.isExistdata("pd_product_compose", "ppid", strID, "ID").Trim() != "") { Alert.Show("当前零件不能删除"); return; } List <Dictionary <string, string> > listdic = new List <Dictionary <string, string> >(); List <string> listTablename = new List <string>(); Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("pd_machinekit", "cast(ID as varchar(36))='" + strID + "' "); listdic.Add(dic); listTablename.Add("pd_machinekit"); dic = new Dictionary <string, string>(); dic.Add("pd_machinekit_feature", "cast(pid as varchar(36))='" + strID + "' "); listdic.Add(dic); listTablename.Add("pd_machinekit_feature"); dic = new Dictionary <string, string>(); dic.Add("pd_3d", "cast(pid as varchar(36))='" + strID + "' "); listdic.Add(dic); listTablename.Add("pd_3d"); dic = new Dictionary <string, string>(); dic.Add("pd_blueprint", "cast(pid as varchar(36))='" + strID + "' "); listdic.Add(dic); listTablename.Add("pd_blueprint"); dic = new Dictionary <string, string>(); dic.Add("pd_photo", "cast(pid as varchar(36))='" + strID + "' "); listdic.Add(dic); listTablename.Add("pd_photo"); dic = new Dictionary <string, string>(); dic.Add("pd_cad", "cast(pid as varchar(36))='" + strID + "' "); listdic.Add(dic); listTablename.Add("pd_cad"); int intresult = 0; pd_machinekit pm = new pd_machinekit(); intresult = pm.deleteMutri(listdic, listTablename); inittree(); Alert alert = new Alert(); if (intresult > 0) { alert.Icon = Icon.Information; alert.Message = "数据删除成功"; } else { alert.MessageBoxIcon = MessageBoxIcon.Error; alert.Message = "数据删除失败"; } alert.Show(); } }
//图片 protected void filePhoto_FileSelected(object sender, EventArgs e) { FineUIPro.TreeNode treenode = firsttree.SelectedNode; if (treenode != null && treenode.Attributes["nodemenu"].ToString().Trim() == "2") { cd_thermal ct = new cd_thermal(); string strtid = ct.isExistdata("cd_thermal", "pid", treenode.NodeID.ToString().Trim(), "ID").Trim(); if (strtid == "") { Alert.Show("请先保存工艺卡基本信息"); return; } try { if (filePhoto.HasFile) { string fileName = filePhoto.ShortFileName; if (!commonLib.ValidateImgType(fileName)) { Alert.Show("无效的文件类型!"); return; } fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_"); int lastDotIndex = fileName.LastIndexOf("."); string strfiletype = fileName.Substring(lastDotIndex + 1).ToLower(); string strpname = fileName.Substring(0, lastDotIndex); fileName = DateTime.Now.Ticks.ToString() + fileName.Substring(lastDotIndex).Trim(); filePhoto.SaveAs(Server.MapPath("~/resources/photo/" + fileName)); imgPhoto.ImageUrl = "~/resources/photo/" + fileName; // 清空文件上传组件 filePhoto.Reset(); Dictionary <string, string> dic = initPhotodic(strtid, strpname, fileName, strfiletype); try { pd_photo pp = new pd_photo(); string strfilename = pp.isExistdata("pd_photo", "pid", strtid, "filename"); if (strfilename.Trim() != "") { strfilename = Server.MapPath("~/resources/photo/") + strfilename; if (File.Exists(strfilename)) { File.Delete(strfilename); } pp.update(dic, "pd_photo", "pid", strtid); } else { dic.Add("ID", Guid.NewGuid().ToString()); dic.Add("pid", strtid); pp.add(dic, "pd_photo"); } } catch { } } } catch { } } }
//CAD图纸 protected void filemxcad_FileSelected(object sender, EventArgs e) { FineUIPro.TreeNode treenode = firsttree.SelectedNode; if (treenode != null && treenode.Attributes["nodemenu"].ToString().Trim() == "2") { cd_thermal ct = new cd_thermal(); string strtid = ct.isExistdata("cd_thermal", "pid", treenode.NodeID.ToString().Trim(), "ID").Trim(); if (strtid == "") { Alert.Show("请先保存工艺卡基本信息"); return; } try { if (filemxcad.HasFile) { string fileName = filemxcad.ShortFileName; if (!commonLib.ValidateCADType(fileName)) { Alert.Show("无效的文件类型!"); return; } fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_"); int lastDotIndex = fileName.LastIndexOf("."); string strfiletype = fileName.Substring(lastDotIndex + 1).ToLower(); string strpname = fileName.Substring(0, lastDotIndex); fileName = DateTime.Now.Ticks.ToString() + fileName.Substring(lastDotIndex).Trim(); filemxcad.SaveAs(Server.MapPath("~/resources/cad/" + fileName)); // 清空文件上传组件 filemxcad.Reset(); Dictionary <string, string> dic = initCADdic(strtid, strpname, fileName, strfiletype); try { pd_cad pc = new pd_cad(); string strfilename = pc.isExistdata("pd_cad", "pid", strtid, "filename"); if (strfilename.Trim() != "") { strfilename = Server.MapPath("~/resources/cad/") + strfilename; if (File.Exists(strfilename)) { File.Delete(strfilename); } pc.update(dic, "pd_cad", "pid", strtid); } else { dic.Add("ID", Guid.NewGuid().ToString()); dic.Add("pid", strtid); pc.add(dic, "pd_cad"); } PageContext.RegisterStartupScript("openwebcad('http://" + Request.Url.Authority.Trim() + "/resources/cad/" + fileName + "')"); } catch { } } } catch { } } }
protected void menuDelete_Click(object sender, EventArgs e) { FineUIPro.TreeNode treenode = firsttree.SelectedNode; string strID = treenode.NodeID.Trim(); if (strID != "") { cd_thermal ct = new cd_thermal(); string strtid = ct.isExistdata("cd_thermal", "pid", strID, "ID").Trim(); if (strtid != "") { List <Dictionary <string, string> > listdic = new List <Dictionary <string, string> >(); List <string> listTablename = new List <string>(); Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("cd_thermal", "cast(pid as varchar(36))='" + strID + "' "); listdic.Add(dic); listTablename.Add("cd_thermal"); dic = new Dictionary <string, string>(); dic.Add("cd_thermal_batch", "cast(tid as varchar(36))='" + strtid + "' "); listdic.Add(dic); listTablename.Add("cd_thermal_batch"); dic = new Dictionary <string, string>(); dic.Add("cd_thermal_indicator", "cast(tid as varchar(36))='" + strtid + "' "); listdic.Add(dic); listTablename.Add("cd_thermal_indicator"); dic = new Dictionary <string, string>(); dic.Add("pd_3d", "cast(pid as varchar(36))='" + strtid + "' "); listdic.Add(dic); listTablename.Add("pd_3d"); dic = new Dictionary <string, string>(); dic.Add("pd_blueprint", "cast(pid as varchar(36))='" + strtid + "' "); listdic.Add(dic); listTablename.Add("pd_blueprint"); dic = new Dictionary <string, string>(); dic.Add("pd_photo", "cast(pid as varchar(36))='" + strtid + "' "); listdic.Add(dic); listTablename.Add("pd_photo"); dic = new Dictionary <string, string>(); dic.Add("pd_cad", "cast(pid as varchar(36))='" + strtid + "' "); listdic.Add(dic); listTablename.Add("pd_cad"); int intresult = 0; pd_machinekit pm = new pd_machinekit(); intresult = pm.deleteMutri(listdic, listTablename); Alert alert = new Alert(); if (intresult > 0) { alert.Icon = Icon.Information; alert.Message = "数据删除成功"; } else { alert.MessageBoxIcon = MessageBoxIcon.Error; alert.Message = "数据删除失败"; } alert.Show(); } } }
protected void btnDelete_Click(object sender, EventArgs e) { Alert alert = new Alert(); FineUIPro.TreeNode treenode = firsttree.SelectedNode; editclassID.Text = treenode.NodeID; int intresult = 0; string strID = treenode.NodeID; Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("ID", " cast(ID as varchar(36))='" + strID + "' "); pd_kidclass_main ul = new pd_kidclass_main(); DataTable dt = ul.getEditdata(strID); if (dt != null && dt.Rows.Count > 0) { intresult = ul.deletebycondition("pd_kidclass_main", dic); pd_kidclass_mainmpic ulpic = new pd_kidclass_mainmpic(); Dictionary <string, string> dic1 = new Dictionary <string, string>(); dic1.Add("mainID", " cast(mainID as varchar(36))='" + strID + "' "); ulpic.deletebycondition("pd_kidclass_mainmpic", dic1); if (intresult > 0) { alert.Icon = Icon.Information; alert.Message = "成功移除数据"; PageContext.RegisterStartupScript("preview();"); } alert.Show(); } else { if (ul.isExistdata("pd_machinekit", "mtypeid", strID, "mtypeid").Trim() != "") { Alert.Show("该类别存在下级零件不能删除!"); return; } else { pd_kidclass_secondary ul1 = new pd_kidclass_secondary(); intresult = ul1.deletebycondition("pd_kidclass_secondary", dic); pd_kidclass_secondrec ulpic = new pd_kidclass_secondrec(); Dictionary <string, string> dic1 = new Dictionary <string, string>(); dic1.Add("subID", " cast(subID as varchar(36))='" + strID + "' "); ulpic.deletebycondition("pd_kidclass_secondrec", dic1); if (intresult > 0) { alert.Icon = Icon.Information; alert.Message = "成功移除数据"; PageContext.RegisterStartupScript("preview();"); } alert.Show(); } } if (intresult > 0) { alert.Icon = Icon.Information; alert.Message = "成功移除数据"; PageContext.RegisterStartupScript("preview();"); } alert.Show(); }
protected void btnSave_Click(object sender, EventArgs e) { FineUIPro.TreeNode treenode = firsttree.SelectedNode; if (treenode != null && treenode.Attributes["nodemenu"].ToString().Trim() == "2") { string strID = treenode.NodeID.ToString().Trim(); string strmtypeid = treenode.ParentNode.NodeID.Trim(); Dictionary <string, string> dic = initDatadic(); dic.Add("mtypeid", strmtypeid); pd_machinekit pm = new pd_machinekit(); int intresult = 0; if (pm.isExistdata("pd_machinekit", "ID", strID, "ID").Trim() == "") { if (pm.isExistdata("mname", dic["mname"].ToString().Trim(), strID, false).Trim() == "" && pm.isExistdata("mcode", dic["mcode"].ToString().Trim(), strID, false).Trim() == "") { dic.Add("ID", strID); intresult = pm.add(dic, "pd_machinekit"); } else { Alert.Show("零件名称或零件编码已经存在"); return; } } else { if (pm.isExistdata("mname", dic["mname"].ToString().Trim(), strID, true).Trim() == "" && pm.isExistdata("mcode", dic["mcode"].ToString().Trim(), strID, true).Trim() == "") { pd_compongall_compose pcc = new pd_compongall_compose(); pd_product_compose ppc = new pd_product_compose(); if (pcc.isExistdata("pd_compongall_compose", "ID", strID, "ID").Trim() != "" && ppc.isExistdata("pd_product_compose", "ID", strID, "ID").Trim() != "") { Alert.Show("当前零件不能修改名称编码"); return; } intresult = pm.update(dic, "pd_machinekit", "cast(ID as varchar(36))", strID); } else { Alert.Show("零件名称或零件编码已经存在"); return; } } inittree(); Alert alert = new Alert(); if (intresult == 1) { alert.Icon = Icon.Information; alert.Message = "数据保存成功"; } else { alert.MessageBoxIcon = MessageBoxIcon.Error; alert.Message = "数据保存失败"; } alert.Show(); } }
protected void btnSavefeature_Click(object sender, EventArgs e) { FineUIPro.TreeNode treenode = firsttree.SelectedNode; if (treenode != null && treenode.Attributes["nodemenu"].ToString().Trim() == "2") { Dictionary <int, Dictionary <string, object> > modifiedDict = mainGrid.GetModifiedDict(); pd_machinekit_feature pmf = new pd_machinekit_feature(); List <Dictionary <string, string> > listdic = new List <Dictionary <string, string> >(); string strpid = treenode.NodeID; for (int i = 0; i < mainGrid.Rows.Count; i++) { Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("ID", Guid.NewGuid().ToString().Trim()); dic.Add("pid", strpid); dic.Add("featureid", mainGrid.DataKeys[i][0].ToString().Trim()); dic.Add("featurevalue", mainGrid.DataKeys[i][2].ToString().Trim()); dic.Add("operater", SessionUserName); foreach (int rowindex in modifiedDict.Keys) { if (i == rowindex) { Dictionary <string, object> row = modifiedDict[rowindex]; dic["featurevalue"] = row["featurevalue"].ToString().Trim(); break; } } listdic.Add(dic); } int intresult = 0; string[] sqltext = new string[listdic.Count + 1]; sqltext[0] = createSql.DeleteDatasql("pd_machinekit_feature", "pid", strpid); string[] tempsql = createSql.getinsrtsqlarray("pd_machinekit_feature", listdic); for (int i = 0; i < tempsql.Length; i++) { sqltext[i + 1] = tempsql[i]; } intresult = pmf.ExecMutri(sqltext); Alert alert = new Alert(); if (intresult > 0) { alert.Icon = Icon.Information; alert.Message = "数据保存成功"; } else { alert.MessageBoxIcon = MessageBoxIcon.Error; alert.Message = "数据保存失败"; } alert.Show(); } }