protected void cadLookup_Click(object sender, EventArgs e) { FineUIPro.TreeNode treenode = firsttree.SelectedNode; if (treenode.Attributes["nodemenu"].ToString().Trim() == "2") { cd_thermal ct = new cd_thermal(); string strtid = ct.isExistdata("cd_thermal", "pid", treenode.NodeID.Trim(), "ID").Trim(); if (strtid != "") { pd_cad pc = new pd_cad(); string strfilename = pc.isExistdata("pd_cad", "pid", strtid, "filename"); //GrapkTabStrip.ActiveTabIndex = 2; if (strfilename.Trim() != "") { PageContext.RegisterStartupScript("openwebcad('http://" + Request.Url.Authority.Trim() + "/resources/cad/" + strfilename + "')"); } else { PageContext.RegisterStartupScript("clearcad()"); } } } }
protected void firsttree_NodeCommand(object sender, TreeCommandEventArgs e) { FineUIPro.TreeNode treenode = firsttree.SelectedNode; setbtndisplay(true); if (treenode.Attributes["nodemenu"].ToString().Trim() == "2") { initbaseinfo(treenode.NodeID); cd_thermal ct = new cd_thermal(); string strtid = ct.isExistdata("cd_thermal", "pid", treenode.NodeID.Trim(), "ID").Trim(); if (strtid != "") { setbtndisplay(false); BindGrid(strtid); //初始化图片 initphoto(strtid); } else { tcode.Text = gettcode(); tname.Text = treenode.Text.Trim() + "热处理工艺卡"; } } }
protected void menuPaste_Click(object sender, EventArgs e) { FineUIPro.TreeNode treenode = firsttree.SelectedNode; if (treenode.Attributes["nodemenu"].ToString().Trim() == "2") { string strtid = cloneID.Text.Trim(); string strpid = treenode.NodeID.Trim(); cd_thermal ct = new cd_thermal(); //检查空才克隆并保存 if (strtid != "" && strpid != "") { if (ct.isExistdata("cd_thermal", "pid", strpid, "ID").Trim() != "") { Alert.Show("当前零件热处理工艺不为空"); } else { string strtcode = gettcode(); string strtname = treenode.Text.Trim() + "热处理工艺卡"; string[] sqltext = ct.clonethermal(Guid.NewGuid().ToString().Trim(), strtname, strtcode, strpid, SessionUserName.Trim(), strtid); int intresult = ct.ExecMutri(sqltext); Alert alert = new Alert(); if (intresult > 0) { alert.Icon = Icon.Information; alert.Message = "数据克隆成功"; } else { alert.MessageBoxIcon = MessageBoxIcon.Error; alert.Message = "数据克隆失败"; } alert.Show(); } } cloneID.Text = ""; btnmenuPaste.Enabled = false; } }
protected void menuClone_Click(object sender, EventArgs e) { FineUIPro.TreeNode treenode = firsttree.SelectedNode; cloneID.Text = ""; if (treenode.Attributes["nodemenu"].ToString().Trim() == "2") { cd_thermal ct = new cd_thermal(); string strtid = ct.isExistdata("cd_thermal", "pid", treenode.NodeID.Trim(), "ID").Trim(); if (strtid != "") { cloneID.Text = strtid; btnmenuPaste.Enabled = true; } } }
protected void btnSave_indicator_Click(object sender, EventArgs e) { FineUIPro.TreeNode treenode = firsttree.SelectedNode; if (treenode != null && treenode.Attributes["nodemenu"].ToString().Trim() == "2") { Dictionary <string, string> dic = initDatadic_indicator(); string strID = editID_indicator.Text.ToString().Trim(); cd_thermal_indicator cti = new cd_thermal_indicator(); int intresult = 0; cd_thermal ct = new cd_thermal(); string strtid = ct.isExistdata("cd_thermal", "pid", treenode.NodeID.ToString().Trim(), "ID").Trim(); if (strID == "") { dic.Add("ID", Guid.NewGuid().ToString()); dic.Add("tid", strtid); intresult = cti.add(dic, "cd_thermal_indicator"); } else { intresult = cti.update(dic, "cd_thermal_indicator", "ID", strID); } Alert alert = new Alert(); BindGrid(strtid); if (intresult == 1) { 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(); } } }