protected void deletesecondrec_Click(object sender, EventArgs e) { int[] intRowindexarray = Grid1.SelectedRowIndexArray; if (intRowindexarray.Length > 0) { pd_kidclass_secondrec ul = new pd_kidclass_secondrec(); object[] keys = Grid1.DataKeys[intRowindexarray[0]]; string strID = keys[0].ToString(); if (ul.isExistdata("pd_machinekit_feature", "featureid", strID, "featureid").Trim() != "") { Alert.Show("该特性已被零件使用不能删除!"); return; } else { Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("ID", " cast(ID as varchar(36))='" + strID + "' "); int intresult = ul.deletebycondition("pd_kidclass_secondrec", dic); setPageContent1(5); Alert alert = new Alert(); if (intresult > 0) { alert.Icon = Icon.Information; alert.Message = "成功移除数据"; } alert.Show(); } } }
private void displaydetailinfo(string NodeID) { pd_kidclass_main um = new pd_kidclass_main(); System.Data.DataTable dt = um.getEditdata(NodeID); string strhtml = "空白详细信息"; firsttree.UncheckAllNodes(); if (dt != null && dt.Rows.Count > 0) { strhtml = "<div style=\"line-height:27px;\">"; foreach (System.Data.DataRow r in dt.Rows) { strhtml += "类别名:" + r["mainname"] + "<br/>序号:" + r["orderint"].ToString().Trim() + "<br/>编码:" + r["maincode"].ToString().Trim() + "<br/>创建时间:" + r["adddate"].ToString().Trim() + ""; pd_kidclass_mainmpic mainpic = new pd_kidclass_mainmpic(); DataTable picdt = mainpic.getEditdata(r["ID"].ToString()); if (picdt != null && picdt.Rows.Count > 0) { strhtml += "<br/>主类别特性指标:"; foreach (DataRow r1 in picdt.Rows) { strhtml += r1["mpci"] + ","; } } } strhtml += "</div>"; } else { pd_kidclass_secondary second = new pd_kidclass_secondary(); System.Data.DataTable dt1 = second.getEditdata(NodeID); if (dt1 != null && dt1.Rows.Count > 0) { strhtml = "<div style=\"line-height:27px;\">"; foreach (System.Data.DataRow r in dt1.Rows) { strhtml += "类别名:" + r["classname"] + "<br/>序号:" + r["orderint"].ToString().Trim() + "<br/>编码:" + r["darycode"].ToString().Trim() + "<br/>创建时间:" + r["adddate"].ToString().Trim() + ""; pd_kidclass_secondrec mainpic = new pd_kidclass_secondrec(); DataTable picdt = mainpic.getEditdata(r["ID"].ToString()); if (picdt != null && picdt.Rows.Count > 0) { strhtml += "<br/>特性指标:"; foreach (DataRow r1 in picdt.Rows) { strhtml += r1["mpci"] + ","; } } } strhtml += "</div>"; } } detailinfo.Text = strhtml; }
private void BindGrid1() { Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("subID", secondrecWineditID.Text.Trim()); int intPageindex = Convert.ToInt32(CurPage1.Text.Trim()); int intPagesize = Convert.ToInt32(GridPageSize1.Text.Trim()); string strSort = Grid1.SortField; string strSortDirection = Grid1.SortDirection; pd_kidclass_secondrec ul = new pd_kidclass_secondrec(); DataTable dt = ul.getBindDataAsdt(dic, strSort, strSortDirection, intPagesize, intPageindex); DataTable dt1 = ul.getBindDataAsdt(dic, strSort, strSortDirection); TotalPage1.Text = dt1.Rows.Count.ToString(); Grid1.DataSource = dt; Grid1.DataBind(); }
protected void btnSavesecondrec_Click(object sender, EventArgs e) { string strID = textSavesecondrec.Text.Trim(); string str1 = secondrecWineditID.Text; int intresult = 0; if (secondrecmpci.SelectedValueArray.Length > 0) { string select = String.Join(", ", secondrecmpci.SelectedValueArray); pd_kidclass_secondrec secrec = new pd_kidclass_secondrec(); pd_kidclass_mainmpic pic = new pd_kidclass_mainmpic(); foreach (var sel in select.Split(',')) { string mpciID = pic.getCodedata(strID, sel.Trim()); Dictionary <string, string> dic1 = initDatadicsesecondrec(str1, mpciID); dic1.Add("ID", Guid.NewGuid().ToString()); secrec.add(dic1, "pd_kidclass_secondrec"); } intresult = 1; } if (CurPage1.Text.Trim() == "") { setPageContent1(1); } else { setPageContent1(5); } Alert alert = new Alert(); if (intresult == 1) { alert.Icon = Icon.Information; alert.Message = "数据保存成功"; } else { alert.MessageBoxIcon = MessageBoxIcon.Error; alert.Message = "数据保存失败"; } alert.Show(); }
protected void btnSave_Click(object sender, EventArgs e) { string strID = editID.Text.ToString().Trim(); int intresult = 0; if (strID == "systemmenu") { Dictionary <string, string> dic = initDatadicmain(mainname.Text.Trim(), orderint.Text.Trim(), code.Text.Trim()); pd_kidclass_main ul = new pd_kidclass_main(); dic.Add("ID", Guid.NewGuid().ToString()); string strmainname = dic["mainname"].ToString().Trim(); string strmaincode = dic["maincode"].ToString().Trim(); if (ul.isExistdata("pd_kidclass_main", "mainname", strmainname, "mainname").Trim() != "") { Alert.Show(strmainname + " 类别名称已经存在!"); return; } else if (ul.isExistdata("pd_kidclass_main", "maincode", strmaincode, "maincode").Trim() != "") { Alert.Show(strmaincode + " 编码已经存在!"); return; } else { intresult = ul.add(dic, "pd_kidclass_main"); string strmpic = mpci.Text.Trim(); if (strmpic != null && strmpic != "") { foreach (var str in strmpic.Split(',')) { Dictionary <string, string> dic1 = initDatadicmainmpic(str, dic["ID"].ToString().Trim(), ""); dic1.Add("ID", Guid.NewGuid().ToString()); ul.add(dic1, "pd_kidclass_mainmpic"); } } } } else { Dictionary <string, string> dic = initDatadicsecond(mainname.Text.Trim(), strID, orderint.Text.Trim(), code.Text.Trim()); pd_kidclass_secondary ul = new pd_kidclass_secondary(); dic.Add("ID", Guid.NewGuid().ToString()); string strmainname = dic["classname"].ToString().Trim(); string strdarycode = dic["darycode"].ToString().Trim(); DataTable dt = ul.getEditdatabyID(strID, strmainname); if (dt != null && dt.Rows.Count > 0) { Alert.Show(strmainname + " 类别名称已经存在!"); return; } else if (ul.isExistdata("pd_kidclass_secondary", "darycode", strdarycode, "darycode").Trim() != "") { Alert.Show(strdarycode + " 编码已经存在!"); return; } else { intresult = ul.add(dic, "pd_kidclass_secondary"); if (dartmpci.SelectedValueArray.Length > 0) { string select = String.Join(", ", dartmpci.SelectedValueArray); pd_kidclass_secondrec secrec = new pd_kidclass_secondrec(); pd_kidclass_mainmpic pic = new pd_kidclass_mainmpic(); foreach (var sel in select.Split(',')) { string mpciID = pic.getCodedata(strID, sel.Trim()); Dictionary <string, string> dic1 = initDatadicsesecondrec(dic["ID"], mpciID); dic1.Add("ID", Guid.NewGuid().ToString()); secrec.add(dic1, "pd_kidclass_secondrec"); } } } } Alert alert = new Alert(); if (intresult == 1) { alert.Icon = Icon.Information; alert.Message = "数据保存成功"; PageContext.RegisterStartupScript("preview();"); } 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(); }