private void btnOK_Click(object sender, EventArgs e) { if (!this.DesignMode) { EFClientTools.DesignClientUtility.ClientInfo.Database = jqSecurity.DBAlias; EFClientTools.DesignClientUtility.ClientInfo.UseDataSet = true; int count = infoDataGridView1.Rows.Count; for (int i = 0; i < count; i++) { if (infoDataGridView1.Rows[i].Cells["ControlName"].Value != null) { List<object> menuIds = new List<object>(); EFClientTools.EFServerReference.MENUTABLECONTROL aMENUTABLECONTROL = new EFClientTools.EFServerReference.MENUTABLECONTROL(); aMENUTABLECONTROL.MENUID = jqSecurity.MenuID; //infoDataGridView1.Rows[i].Cells["MenuID"].Value.ToString(); if (infoDataGridView1.Rows[i].Cells["ControlName"].Value == null) { MessageBox.Show("You have to set the ControlName first"); return; } aMENUTABLECONTROL.CONTROLNAME = infoDataGridView1.Rows[i].Cells["ControlName"].Value.ToString(); if (infoDataGridView1.Rows[i].Cells["Descriptions"].Value != null) aMENUTABLECONTROL.DESCRIPTION = infoDataGridView1.Rows[i].Cells["Descriptions"].Value.ToString(); if (infoDataGridView1.Rows[i].Cells["Type"].Value != null) aMENUTABLECONTROL.TYPE = infoDataGridView1.Rows[i].Cells["Type"].Value.ToString(); if (String.IsNullOrEmpty(aMENUTABLECONTROL.TYPE)) aMENUTABLECONTROL.TYPE = "HTML"; menuIds.Add(aMENUTABLECONTROL); EFClientTools.DesignClientUtility.SaveDataToTable(menuIds, "MENUTABLECONTROL"); } } EFClientTools.DesignClientUtility.ClientInfo.Database = String.Empty; this.Close(); } }
private void btnDel_Click(object sender, EventArgs e) { EFClientTools.DesignClientUtility.ClientInfo.Database = jqSecurity.DBAlias; EFClientTools.DesignClientUtility.ClientInfo.UseDataSet = true; int count = infoDataGridView1.Rows.Count; for (int i = 0; i < count; i++) { for (int j = 0; j < infoDataGridView1.Rows[i].Cells.Count; j++) { if (infoDataGridView1.Rows[i].Selected == true || infoDataGridView1.Rows[i].Cells[j].Selected == true) { EFClientTools.EFServerReference.MENUTABLECONTROL aMENUTABLECONTROL = new EFClientTools.EFServerReference.MENUTABLECONTROL(); aMENUTABLECONTROL.MENUID = infoDataGridView1.Rows[i].Cells["MenuID"].Value.ToString(); aMENUTABLECONTROL.CONTROLNAME = infoDataGridView1.Rows[i].Cells["ControlName"].Value.ToString(); aMENUTABLECONTROL.DESCRIPTION = infoDataGridView1.Rows[i].Cells["Descriptions"].Value.ToString(); aMENUTABLECONTROL.TYPE = infoDataGridView1.Rows[i].Cells["Type"].Value.ToString(); EFClientTools.DesignClientUtility.DeleteDataFromTable(aMENUTABLECONTROL, "MENUTABLECONTROL"); } } } EFClientTools.DesignClientUtility.ClientInfo.Database = String.Empty; int x = 0; for (int i = 0; i < infoDataGridView1.Rows.Count; i++) for (int j = 0; j < infoDataGridView1.Rows[i].Cells.Count; j++) if (infoDataGridView1.Rows[i].Selected == true || infoDataGridView1.Rows[i].Cells[j].Selected == true) { x = i; break; } if (infoDataGridView1.Rows[x].Cells["ControlName"].Value != null) { infoDataGridView1.Rows.Remove(infoDataGridView1.Rows[x]); } }