void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) { DataGridViewRow r = dataGridView1.Rows[e.RowIndex]; if (r.IsNewRow) { return; } string RMES_ID = r.Cells["RMES_ID"].Value as string; string EntityName = r.Cells["ENTITY_NAME"].Value as string; if (EntityName == null || EntityName.Equals(string.Empty)) { return; } if (RMES_ID == null || RMES_ID.Equals(string.Empty)) { return; } code_config_tables edititem = DB.GetInstance().First <code_config_tables>("where RMES_ID=@0", RMES_ID); if (edititem == null) { return; } if (edititem.ENTITY_NAME != null && edititem.ENTITY_NAME.Equals(EntityName)) { return; } edititem.ENTITY_NAME = EntityName; DB.GetInstance().Update(edititem); refreshdatagridview(); }
public int GenEntityFile(code_config_tables row) { if (row.TABLE_NAME_EN.Equals(string.Empty)) { return(0); } if (row.ENTITY_NAME == null || row.ENTITY_NAME.Equals(string.Empty)) { return(0); } string strFile = ""; strFile += generateHeader(); strFile += generateClass(row.TABLE_NAME_EN, row.ENTITY_NAME); string path = System.Windows.Forms.Application.StartupPath; Directory.SetCurrentDirectory(path); if (!Directory.Exists(path + "\\Entity")) { Directory.CreateDirectory("Entity"); } string destination = path + "\\Entity\\" + row.ENTITY_NAME + "Entity.cs"; FileStream desFS = new FileStream(destination, FileMode.Create); byte[] byteArray = System.Text.UnicodeEncoding.Default.GetBytes(strFile); int len = byteArray.Length; desFS.Write(byteArray, 0, len); desFS.Close(); row.LASTGEN_TIME = DB.GetServerTime(); return(DB.GetInstance().Update(row)); }