public void funSetGrid() { try { CtlGrid.Cols = 4; //CtlGrid.CanEdit = true; //CtlGrid.CanDelete = true; CtlGrid.Columns[0].Header = "ID"; CtlGrid.Columns[1].Header = "RoleName"; CtlGrid.Columns[2].Header = "Description"; CtlGrid.Columns[3].Header = "IsAdmin"; CtlGrid.Columns[3].IsIcon = true; //CtlGrid.Columns[4].Header = "CreatedBy"; //CtlGrid.Columns[5].Header = "ModifiedBy"; //CtlGrid.Columns[6].Header = "CreatedDate"; //CtlGrid.Columns[7].Header = "ModifiedDate"; CtlGrid.Columns[0].BindTo("ID"); CtlGrid.Columns[1].BindTo("RoleName"); CtlGrid.Columns[2].BindTo("Description"); CtlGrid.Columns[3].BindTo("IsAdmin"); //CtlGrid.Columns[4].BindTo("CreatedBy"); //CtlGrid.Columns[5].BindTo("ModifiedBy"); //CtlGrid.Columns[6].BindTo("CreatedDate"); //CtlGrid.Columns[7].BindTo("ModifiedDate"); objRoleCollection = ClsRoleCollection.GetAll(); CtlGrid.Bind(objRoleCollection); } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "FncSetGrid", "CtlRole.xaml.cs"); } }
public void funSetCombo() { try { // No Roles So Initially Displaying // cmbRoleAssigned.Items.Clear(); objRoleCollection = ClsRoleCollection.GetAll(); for (int i = 0; i < objRoleCollection.Count; i++) { ComboBoxItem l = new ComboBoxItem(); l.Content = objRoleCollection[i].RoleName; l.Tag = objRoleCollection[i].ID; cmbRoleAssigned.Items.Add(l); } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "fncSetCombo", "CtlUserInfo.xaml.cs"); } }
void btnUpload_Click(object sender, RoutedEventArgs e) { try { if (!Directory.Exists(ass.Location.Replace("VMukti.Presentation.exe", @"Temp"))) { di = Directory.CreateDirectory(ass.Location.Replace("VMukti.Presentation.exe", @"Temp")); } else { di = new DirectoryInfo(ass.Location.Replace("VMukti.Presentation.exe", @"Temp")); } DirectoryInfo[] dinew = di.GetDirectories(); for (int i = 0; i < dinew.Length; i++) { dinew[i].Delete(true); } ofd.Filter = "Zip Files|*.zip"; if (ofd.ShowDialog() == DialogResult.OK) { FastZip fz = new FastZip(); fz.ExtractZip(ofd.FileName, di.FullName, null); txtUpload.Text = ofd.FileName; txtZip.Text = ofd.SafeFileName; DirectoryInfo[] diSub = di.GetDirectories()[0].GetDirectories(); for (int m = 0; m < diSub.Length; m++) { if (diSub[m].Name.ToLower() == "control") { ShowDirectory(diSub[m]); break; } } for (int j = 0; j < al.Count; j++) { using (FileStream fs = File.Open(al[j].ToString(), FileMode.Open)) { using (MemoryStream ms = new MemoryStream()) { byte[] buffer = new byte[1024]; int read = 0; while ((read = fs.Read(buffer, 0, 1024)) > 0) { ms.Write(buffer, 0, read); } try { a = Assembly.Load(ms.ToArray()); } catch (Exception ex) { VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "btnUpload_Click()", "Controls\\CtlUploadModule.xaml.cs"); } } } typecontrol = a.GetTypes(); for (int n = 0; n < typecontrol.Length; n++) { if (typecontrol[n].BaseType != null) { if (typecontrol[n].BaseType.Name.ToLower() == "usercontrol") { int z = 0; for (z = 0; z < cmbAssembly.Items.Count; z++) { if (((ComboBoxItem)cmbAssembly.Items[z]).Content.ToString() == typecontrol[n].Module.ToString()) { break; } } if (z == cmbAssembly.Items.Count) { ComboBoxItem cbiNew = new ComboBoxItem(); lstAss.Add(a); cbiNew.Content = typecontrol[n].Module.ToString(); cmbAssembly.Items.Add(cbiNew); } } if (typecontrol[n].BaseType.Name.ToLower() == "enum") { if (typecontrol[n].Name == "ModulePermissions") { grid1.IsEnabled = true; scrollViewer1.IsEnabled = true; string[] str = Enum.GetNames(typecontrol[n]); for (int enumValues = 0; enumValues < typecontrol[n].GetFields().Length; enumValues++) { if (typecontrol[n].GetFields()[enumValues].FieldType.Name == "ModulePermissions") { strValues.Add(typecontrol[n].GetFields()[enumValues].GetRawConstantValue().ToString()); } } ClsRoleCollection crc = ClsRoleCollection.GetAll(); for (int i = 0; i < str.Length + 1; i++) { ColumnDefinition col = new ColumnDefinition(); grid1.ColumnDefinitions.Add(col); } for (int roleCount = 0; roleCount < crc.Count + 1; roleCount++) { RowDefinition row = new RowDefinition(); grid1.RowDefinitions.Add(row); } for (int k = 0; k < str.Length; k++) { System.Windows.Controls.Label l = new System.Windows.Controls.Label(); l.Content = str[k]; l.Background = System.Windows.Media.Brushes.Snow; grid1.Children.Add(l); Grid.SetColumn(l, k + 1); Grid.SetRow(l, 0); } for (int r = 0; r < crc.Count; r++) { System.Windows.Controls.Label lRow = new System.Windows.Controls.Label(); lRow.Content = crc[r].RoleName; lRow.Background = System.Windows.Media.Brushes.Beige; grid1.Children.Add(lRow); Grid.SetColumn(lRow, 0); Grid.SetRow(lRow, r + 1); } for (int roleCount = 0; roleCount < crc.Count; roleCount++) { for (int perCount = 0; perCount < str.Length; perCount++) { System.Windows.Controls.CheckBox chk = new System.Windows.Controls.CheckBox(); chk.Margin = new Thickness(5, 5, 0, 0); chk.Height = 14; chk.Width = 14; chk.Tag = str[perCount] + "," + strValues[perCount] + "," + crc[roleCount].ID; chk.BorderThickness = new Thickness(2, 2, 2, 2); grid1.Children.Add(chk); Grid.SetColumn(chk, perCount + 1); Grid.SetRow(chk, roleCount + 1); } } System.Windows.Controls.Label lblPermissions = new System.Windows.Controls.Label(); lblPermissions.Height = 23; lblPermissions.Width = 80; lblPermissions.Content = "Permissions"; grid1.Children.Add(lblPermissions); Grid.SetColumn(lblPermissions, 0); Grid.SetRow(lblPermissions, 0); } } } } } } al.Clear(); } catch (Exception ex) { VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "btnUpload_Click()--1", "Controls\\CtlUploadModule.xaml.cs"); } }