private void BindGrid(string strmtypeid, string strtID) { pd_machinekit_feature pmf = new pd_machinekit_feature(); mainGrid.DataSource = pmf.getBindGridDataAsdt(strmtypeid, strtID); mainGrid.DataBind(); }
private void setrepeat() { pd_machinekit_feature pmf = new pd_machinekit_feature(); System.Data.DataTable dt = pmf.checkrepeat(); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow r in dt.Rows) { FineUIPro.TreeNode treenode = firsttree.FindNode(r["pid"].ToString().ToUpper().Trim()); treenode.CssClass = "repeatnode"; treenode.ParentNode.CssClass = "repeatnode"; } } }
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(); } }