Example #1
0
 //更新数据
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name="isRead">是从xml读还是写入xml</param>
 public void UpdateData(bool isRead)
 {
     //             if (dgvGYSX.Rows.Count != gongyi_items.Length)
     //             {
     //                 MessageBox.Show("属性表单不对应!");
     //                 return;
     //             }
     if (isRead)
     {
         //读xml到控件
         s_value = XML3DPPM.GetGongyi_Normal_Value(XmlFile);
         //工艺属性
         dgvGYSX[1, 0].Value = s_value.jianming;
         dgvGYSX[1, 1].Value = s_value.jianhao;
         dgvGYSX[1, 2].Value = s_value.xinghao;
         dgvGYSX[1, 3].Value = s_value.banci;
         dgvGYSX[1, 4].Value = s_value.danwei;
         dgvGYSX[1, 5].Value = s_value.cailiao;
         dgvGYSX[1, 6].Value = s_value.texingfuhao;
         dgvGYSX[1, 7].Value = s_value.suoyinhao;
         dgvGYSX[1, 8].Value = s_value.genggaidanhao;
         }
     else
     {
         //写入xml
         dgvGYSX.EndEdit();
         s_value.jianming = (string)dgvGYSX[1, 0].Value;
         s_value.jianhao = (string)dgvGYSX[1, 1].Value;
         s_value.xinghao = (string)dgvGYSX[1, 2].Value;
         s_value.banci = (string)dgvGYSX[1, 3].Value;
         s_value.danwei = (string)dgvGYSX[1, 4].Value;
         s_value.cailiao = (string)dgvGYSX[1, 5].Value;
         s_value.texingfuhao = (string)dgvGYSX[1, 6].Value;
         s_value.suoyinhao = (string)dgvGYSX[1, 7].Value;
         s_value.genggaidanhao = (string)dgvGYSX[1, 8].Value;
         XML3DPPM.SetGongyi_Normal_Value(s_value, XmlFile);
     }
 }
Example #2
0
 // �õ���ͨ����ֵ��
 /// <summary>
 /// �õ���ͨ����ֵ��
 /// </summary>
 /// <param name="xmlfile">����XML</param>
 /// <returns>��ͨ����ֵ��</returns>
 public static S_Gongyi_Normal_Value GetGongyi_Normal_Value(string xmlfile)
 {
     S_Gongyi_Normal_Value s_value = new S_Gongyi_Normal_Value();
     try
     {
         XmlDocument mydoc = new XmlDocument();
         mydoc.Load(xmlfile);
         string path = "/SYS_3DPPM/Gongyi";
         XmlElement xe = (XmlElement)mydoc.SelectSingleNode(path);
         if (xe.GetAttribute("Type") != E_GongyiNodeType.Gongyi_Normal.ToString())
         {
             NXFun.MessageBox("��ѯ������������ʵ���Ͳ�ƥ�䣡");
             return s_value;
         }
         XmlElement infor = xe.SelectSingleNode("Information") as XmlElement;
         //��������
         s_value.jianming = infor.GetAttribute("jianming");
         s_value.jianhao = infor.GetAttribute("jianhao");
         s_value.xinghao = infor.GetAttribute("xinghao");
         s_value.banci = infor.GetAttribute("banci");
         s_value.danwei = infor.GetAttribute("danwei");
         s_value.cailiao = infor.GetAttribute("cailiao");
         s_value.texingfuhao = infor.GetAttribute("texingfuhao");
         s_value.suoyinhao = infor.GetAttribute("suoyinhao");
         s_value.genggaidanhao = infor.GetAttribute("genggaidanhao");
         return s_value;
     }
     catch (System.Exception ex)
     {
         NXFun.MessageBox(ex.Message);
         return s_value;
     }
 }
Example #3
0
 // ������ͨ����ֵ��
 /// <summary>
 /// ������ͨ����ֵ��
 /// </summary>
 /// <param name="s_value">��ͨ����ֵ��</param>
 /// <param name="xmlfile">����xml</param>
 /// <returns>�ɹ���</returns>
 public static bool SetGongyi_Normal_Value(S_Gongyi_Normal_Value s_value, string xmlfile)
 {
     try
     {
         XmlDocument mydoc = new XmlDocument();
         mydoc.Load(xmlfile);
         string path = "/SYS_3DPPM/Gongyi";
         XmlElement xe = (XmlElement)mydoc.SelectSingleNode(path);
         if (xe.GetAttribute("Type") != E_GongyiNodeType.Gongyi_Normal.ToString())
         {
             NXFun.MessageBox("�޸Ĺ�����������ʵ���Ͳ�ƥ�䣡");
             return false;
         }
         //��������
         XmlElement infor = xe.SelectSingleNode("Information") as XmlElement;
         infor.SetAttribute("jianming", s_value.jianming);
         infor.SetAttribute("jianhao", s_value.jianhao);
         infor.SetAttribute("xinghao", s_value.xinghao);
         infor.SetAttribute("banci", s_value.banci);
         infor.SetAttribute("danwei", s_value.danwei);
         infor.SetAttribute("cailiao", s_value.cailiao);
         infor.SetAttribute("texingfuhao", s_value.texingfuhao);
         infor.SetAttribute("suoyinhao", s_value.suoyinhao);
         infor.SetAttribute("genggaidanhao", s_value.genggaidanhao);
         mydoc.Save(xmlfile);
         return true;
     }
     catch (System.Exception ex)
     {
         NXFun.MessageBox(ex.Message);
         return false;
     }
 }