private void ogdPlant_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { mlPlant oPlant = new mlPlant(); try { oPlant.tML_PlantCode = ogdPlant.CurrentRow.Cells[0].Value.ToString(); oPlant.tML_DbName = ogdPlant.CurrentRow.Cells[2].Value.ToString(); oPlant.tML_UserName = ogdPlant.CurrentRow.Cells[3].Value.ToString(); oPlant.tML_UserPwd = ogdPlant.CurrentRow.Cells[4].Value.ToString(); oPlant.tML_Server = ogdPlant.CurrentRow.Cells[5].Value.ToString(); W_SETxSetting(oPlant); Close(); oW_Main.W_GETxStatusBar(); } catch (Exception oEx) { MessageBox.Show("wPlant : ogdPlant_CellDoubleClick // " + oEx.Message); log.Error(oEx.Message); } }
private void W_SETxSetting(mlPlant poPlant) { XmlDocument oXmlDoc = new XmlDocument(); try { var tSavePath = "AdaDbSetting.xml"; var oRootNode = oXmlDoc.CreateElement("Setting"); //ส่วน root node oXmlDoc.AppendChild(oRootNode); var oServer = oXmlDoc.CreateElement("Server"); // child node oServer.InnerText = poPlant.tML_Server; //ข้อมูลใน child node oRootNode.AppendChild(oServer); var oUserDb = oXmlDoc.CreateElement("UserDb"); // child node oUserDb.InnerText = poPlant.tML_UserName; //ข้อมูลใน child node oRootNode.AppendChild(oUserDb); var oPwdDb = oXmlDoc.CreateElement("PwdDb"); // child node oPwdDb.InnerText = poPlant.tML_UserPwd; //ข้อมูลใน child node oRootNode.AppendChild(oPwdDb); var oDbName = oXmlDoc.CreateElement("DbName"); // child node oDbName.InnerText = poPlant.tML_DbName; //ข้อมูลใน child node oRootNode.AppendChild(oDbName); var oPlantCode = oXmlDoc.CreateElement("PlantCode"); // child node oPlantCode.InnerText = poPlant.tML_PlantCode; //ข้อมูลใน child node oRootNode.AppendChild(oPlantCode); oXmlDoc.Save(tSavePath); } catch (Exception oEx) { MessageBox.Show("wPlant : W_SETxSetting //" + oEx.Message); log.Error(oEx.Message); } }