public CtlVMuktiHelp() { try { InitializeComponent(); if (!System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory.ToString() + "HelpDocs")) { FastZip fz = new FastZip(); fz.ExtractZip(AppDomain.CurrentDomain.BaseDirectory.ToString() + "HelpDocs.zip", AppDomain.CurrentDomain.BaseDirectory.ToString() + "HelpDocs", null); } strBasePath = AppDomain.CurrentDomain.BaseDirectory; BitmapImage bmi = new BitmapImage(new Uri(strBasePath + "HelpDocs\\Help_0.JPG")); image1.Source = bmi; } catch { } }
public YatePBX() { try { if (VMuktiAPI.VMuktiInfo.strExternalPBX == "false") { if (!System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory.ToString() + "Assamblies")) { //new WebClient().DownloadFile("http://" + VMuktiAPI.VMuktiInfo.BootStrapIPs[0] + "/VMukti/Assamblies.zip", AppDomain.CurrentDomain.BaseDirectory.ToString() + "Assamblies.zip"); FastZip fz = new FastZip(); fz.ExtractZip(AppDomain.CurrentDomain.BaseDirectory.ToString() + "Assamblies.zip", AppDomain.CurrentDomain.BaseDirectory.ToString() + "Assamblies", null); } PBXCredential = new ClsCredential(); myProf = new VMukti.Profile.Ini(AppDomain.CurrentDomain.BaseDirectory.ToString() + @"\Assamblies\conf.d\ysipchan.conf"); } } catch (Exception exp) { exp.Data.Add("My Key", "YatePBX()--:--YatePBX.cs--:--" + exp.Message + " :--:--"); ClsException.LogError(exp); ClsException.WriteToErrorLogFile(exp); } }
void btnSubmit_Click(object sender, RoutedEventArgs e) { try { #region cheking if (ofd.FileName == null || ofd.FileName == "") { System.Windows.MessageBox.Show("Browse the File to Upload"); txtUpload.Focus(); return; } if (cmbAssembly.SelectedItem == null) { System.Windows.MessageBox.Show("Select the Assembly File"); cmbAssembly.Focus(); return; } if (cmbClass.SelectedItem == null) { System.Windows.MessageBox.Show("Select the Class Name"); cmbClass.Focus(); return; } if (txtModule.Text == "" || txtModule.Text == null) { System.Windows.MessageBox.Show("Enter Module Name"); txtModule.Focus(); return; } if (!new ClsModuleLogic().ModuleExists(txtModule.Text)) { System.Windows.MessageBox.Show("Specify another module name"); txtModule.Focus(); return; } if (!IsVersionValid()) { System.Windows.MessageBox.Show("Enter Valid Version Number"); txtVersion.Focus(); return; } #endregion try { DirectoryInfo diZip = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "\\Zip Files"); File.Copy(ofd.FileName, diZip.FullName + "\\" + ofd.SafeFileName); DirectoryInfo diModule = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "\\Modules"); VMukti.ZipUnzip.Zip.FastZip fz = new VMukti.ZipUnzip.Zip.FastZip(); if (!Directory.Exists(diModule.FullName + "\\" + ofd.SafeFileName.Split('.')[0])) { fz.ExtractZip(diZip.FullName + "\\" + ofd.SafeFileName, diModule.FullName, null); } // Upload the Zip file To bs System.IO.FileStream stream = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); RemoteFileInfo rfiUpload = new RemoteFileInfo(); rfiUpload.FileName = ofd.SafeFileName; rfiUpload.FolderNameToStore = ""; rfiUpload.FileByteStream = stream; rfiUpload.Length = stream.Length; clientHttpChannelFileTransfer.svcHTTPFileTransferServiceUploadFile(rfiUpload); stream.Flush(); stream.Close(); FileStream fs = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); rfiUpload.FileByteStream = fs; clientHttpChannelFileTransfer.svcHTTPFileTransferServiceUploadFileToInstallationDirectory(rfiUpload); fs.Flush(); fs.Close(); } catch (Exception ex) { System.Windows.MessageBox.Show("The Zip File is already uploaded please select another File"); VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "btnSubmit_Click()", "Controls\\CtlUploadModule.xaml.cs"); return; } ClsModuleLogic cml = new ClsModuleLogic(); TextRange tr = new TextRange(rtbDescription.Document.ContentStart, rtbDescription.Document.ContentEnd); #region Creating byte array of imagefile List <byte[]> ImageByte = new List <byte[]>(); if (!string.IsNullOrEmpty(txtModuleImage.Text)) { byte[] b = SetImage(txtModuleImage.Text); if (b != null) { ImageByte.Add(b); } else { b = SetImage(AppDomain.CurrentDomain.BaseDirectory + "\\Skins\\Images\\Help.png"); if (b != null) { ImageByte.Add(b); } } } else { byte[] b = SetImage(AppDomain.CurrentDomain.BaseDirectory + "\\Skins\\Images\\Help.png"); if (b != null) { ImageByte.Add(b); } } #endregion int intModId = -1; intModId = cml.AddModule(-1, txtModule.Text, txtVersion.Text, tr.Text, ((ComboBoxItem)cmbAssembly.SelectedItem).Content.ToString(), ((ComboBoxItem)cmbClass.SelectedItem).Content.ToString(), txtZip.Text, 1, ckbCollaborate.IsChecked.Value, ckbAuthentication.IsChecked.Value, ImageByte[0]); if (intModId == -1) { System.Windows.MessageBox.Show("Report this error to your administrator"); return; } ClsPermissionLogic cpl = new ClsPermissionLogic(); foreach (object chk in grid1.Children) { if (chk.GetType() == typeof(System.Windows.Controls.CheckBox) && ((System.Windows.Controls.CheckBox)chk).Tag != null) { int i = 0; string[] strPermission = (((System.Windows.Controls.CheckBox)chk).Tag).ToString().Split(','); for (i = 0; i < objModulePermissions.Count; i++) { if (objModulePermissions[i].PermissionName == strPermission[0]) { break; } } if (i == objModulePermissions.Count) { objModulePermissions.Add(new clsModulePermission(intModId, cpl.Add_Permission(-1, intModId, strPermission[0], int.Parse(strPermission[1])), strPermission[0], int.Parse(strPermission[1]))); } if (((System.Windows.Controls.CheckBox)chk).IsChecked == true) { for (int j = 0; j < objModulePermissions.Count; j++) { if (objModulePermissions[j].PermissionName == strPermission[0]) { cpl.Add_ModulePermission(objModulePermissions[j].PermissionID, int.Parse(strPermission[2])); ((System.Windows.Controls.CheckBox)chk).IsChecked = false; break; } } } } } System.Windows.MessageBox.Show("Module Uploaded"); txtUpload.Clear(); txtZip.Clear(); cmbAssembly.Items.Clear(); cmbClass.Items.Clear(); txtModule.Clear(); txtVersion.Clear(); ckbCollaborate.IsChecked = false; rtbDescription.SelectAll(); rtbDescription.Selection.Text = ""; ckbAuthentication.IsChecked = false; txtModuleImage.Text = ""; if (grid1.Children.Count > 0) { grid1.Children.Clear(); } objModulePermissions.Clear(); } catch (Exception ex) { VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "btnSubmit_Click()--1", "Controls\\CtlUploadModule.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"); } }
void btnSubmit_Click(object sender, RoutedEventArgs e) { try { #region cheking if (ofd.FileName == null || ofd.FileName == "") { System.Windows.MessageBox.Show("Browse the File to Upload"); txtUpload.Focus(); return; } if (cmbAssembly.SelectedItem == null) { System.Windows.MessageBox.Show("Select the Assembly File"); cmbAssembly.Focus(); return; } if (cmbClass.SelectedItem == null) { System.Windows.MessageBox.Show("Select the Class Name"); cmbClass.Focus(); return; } if (txtModule.Text == "" || txtModule.Text == null) { System.Windows.MessageBox.Show("Enter Module Name"); txtModule.Focus(); return; } if (!new ClsModuleLogic().ModuleExists(txtModule.Text)) { System.Windows.MessageBox.Show("Specify another module name"); txtModule.Focus(); return; } if (!IsVersionValid()) { System.Windows.MessageBox.Show("Enter Valid Version Number"); txtVersion.Focus(); return; } #endregion try { DirectoryInfo diZip = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "\\Zip Files"); File.Copy(ofd.FileName, diZip.FullName + "\\" + ofd.SafeFileName); DirectoryInfo diModule = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "\\Modules"); VMukti.ZipUnzip.Zip.FastZip fz = new VMukti.ZipUnzip.Zip.FastZip(); if (!Directory.Exists(diModule.FullName + "\\" + ofd.SafeFileName.Split('.')[0])) { fz.ExtractZip(diZip.FullName + "\\" + ofd.SafeFileName, diModule.FullName, null); } // Upload the Zip file To bs System.IO.FileStream stream = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); RemoteFileInfo rfiUpload = new RemoteFileInfo(); rfiUpload.FileName = ofd.SafeFileName; rfiUpload.FolderNameToStore = ""; rfiUpload.FileByteStream = stream; rfiUpload.Length = stream.Length; clientHttpChannelFileTransfer.svcHTTPFileTransferServiceUploadFile(rfiUpload); stream.Flush(); stream.Close(); FileStream fs = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); rfiUpload.FileByteStream = fs; clientHttpChannelFileTransfer.svcHTTPFileTransferServiceUploadFileToInstallationDirectory(rfiUpload); fs.Flush(); fs.Close(); } catch (Exception ex) { System.Windows.MessageBox.Show("The Zip File is already uploaded please select another File"); VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "btnSubmit_Click()", "Controls\\CtlUploadModule.xaml.cs"); return; } ClsModuleLogic cml = new ClsModuleLogic(); TextRange tr = new TextRange(rtbDescription.Document.ContentStart, rtbDescription.Document.ContentEnd); #region Creating byte array of imagefile List<byte[]> ImageByte = new List<byte[]>(); if (!string.IsNullOrEmpty(txtModuleImage.Text)) { byte[] b = SetImage(txtModuleImage.Text); if (b != null) { ImageByte.Add(b); } else { b = SetImage(AppDomain.CurrentDomain.BaseDirectory + "\\Skins\\Images\\Help.png"); if (b != null) { ImageByte.Add(b); } } } else { byte[] b = SetImage(AppDomain.CurrentDomain.BaseDirectory + "\\Skins\\Images\\Help.png"); if (b != null) { ImageByte.Add(b); } } #endregion int intModId = -1; intModId = cml.AddModule(-1, txtModule.Text, txtVersion.Text, tr.Text, ((ComboBoxItem)cmbAssembly.SelectedItem).Content.ToString(), ((ComboBoxItem)cmbClass.SelectedItem).Content.ToString(), txtZip.Text, 1, ckbCollaborate.IsChecked.Value, ckbAuthentication.IsChecked.Value, ImageByte[0]); if (intModId == -1) { System.Windows.MessageBox.Show("Report this error to your administrator"); return; } ClsPermissionLogic cpl = new ClsPermissionLogic(); foreach (object chk in grid1.Children) { if (chk.GetType() == typeof(System.Windows.Controls.CheckBox) && ((System.Windows.Controls.CheckBox)chk).Tag != null) { int i = 0; string[] strPermission = (((System.Windows.Controls.CheckBox)chk).Tag).ToString().Split(','); for (i = 0; i < objModulePermissions.Count; i++) { if (objModulePermissions[i].PermissionName == strPermission[0]) { break; } } if (i == objModulePermissions.Count) { objModulePermissions.Add(new clsModulePermission(intModId, cpl.Add_Permission(-1, intModId, strPermission[0], int.Parse(strPermission[1])), strPermission[0], int.Parse(strPermission[1]))); } if (((System.Windows.Controls.CheckBox)chk).IsChecked == true) { for (int j = 0; j < objModulePermissions.Count; j++) { if (objModulePermissions[j].PermissionName == strPermission[0]) { cpl.Add_ModulePermission(objModulePermissions[j].PermissionID, int.Parse(strPermission[2])); ((System.Windows.Controls.CheckBox)chk).IsChecked = false; break; } } } } } System.Windows.MessageBox.Show("Module Uploaded"); txtUpload.Clear(); txtZip.Clear(); cmbAssembly.Items.Clear(); cmbClass.Items.Clear(); txtModule.Clear(); txtVersion.Clear(); ckbCollaborate.IsChecked = false; rtbDescription.SelectAll(); rtbDescription.Selection.Text = ""; ckbAuthentication.IsChecked = false; txtModuleImage.Text = ""; if (grid1.Children.Count > 0) { grid1.Children.Clear(); } objModulePermissions.Clear(); } catch (Exception ex) { VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "btnSubmit_Click()--1", "Controls\\CtlUploadModule.xaml.cs"); } }
public CtlImportLeads(ModulePermissions[] MyPermissions) { try { InitializeComponent(); if (!System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory.ToString() + "ImportLead")) { FastZip fz = new FastZip(); fz.ExtractZip(AppDomain.CurrentDomain.BaseDirectory.ToString() + "ImportLead.zip", AppDomain.CurrentDomain.BaseDirectory.ToString() + "ImportLead", null); } btnSave.IsEnabled = false; _MyPermissions = MyPermissions; FncPermissionsReview(); // Format Name // ClsFileFormatCollection objColl = ClsFileFormatCollection.GetAll(); for (int i = 0; i < objColl.Count; i++) { ComboBoxItem cbiFormat = new ComboBoxItem(); cbiFormat.Content = objColl[i].LeadFormatName; cbiFormat.Tag = objColl[i].ID + "," + objColl[i].FormatType; cmbFormat.Items.Add(cbiFormat); } // Format Name // // Country Name // //dsLeadFormat = (new ImportLeads.DataAccess.ClsImportLeadsDataService().GetLeadFormat()); //for (int cnt = 0; cnt < dsLeadFormat.Tables[0].Rows.Count; cnt++) //{ // cmbFormat.Items.Add(dsLeadFormat.Tables[0].Rows[cnt][0].ToString()); //} ClsCountryCollection objCountry = ClsCountryCollection.GetAll(); for (int i = 0; i < objCountry.Count; i++) { ComboBoxItem cbiCountry = new ComboBoxItem(); cbiCountry.Content = objCountry[i].Name; cbiCountry.Tag = objCountry[i].CountryCode; cmbCountry.Items.Add(cbiCountry); } // Country Name // cmbCountry.SelectionChanged += new SelectionChangedEventHandler(cmbCountry_SelectionChanged); txtDNC.LostFocus += new RoutedEventHandler(txtDNC_LostFocus); cmbListType.MouseDown += new MouseButtonEventHandler(cmbListType_MouseDown); cmbListType.SelectionChanged += new SelectionChangedEventHandler(cmbListType_SelectionChanged); btnBrowse.Click += new RoutedEventHandler(btnBrowse_Click); btnSave.Click += new RoutedEventHandler(btnSave_Click); //shilpa code btnCancel.Click += new RoutedEventHandler(btnCancel_Click); // cmbFilterType.SelectionChanged += new SelectionChangedEventHandler(cmbFilterType_SelectionChanged); lstLists.SelectionChanged += new SelectionChangedEventHandler(lstLists_SelectionChanged); txtFile.LostFocus += new RoutedEventHandler(txtFile_LostFocus); cmbFormat.SelectionChanged += new SelectionChangedEventHandler(cmbFormat_SelectionChanged); //shilpa code objDelSaveLead = new DelSaveLead(import_leads); } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "CtlImportLeads()", "CtlImportLeads.xaml.cs"); } }
void DownloadVistaAudioBW_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { try { if (!System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory.ToString() + "VistaAudio.zip")) { new WebClient().DownloadFile(VMuktiAPI.VMuktiInfo.ZipFileDownloadLink + "VistaAudio.zip", AppDomain.CurrentDomain.BaseDirectory.ToString() + "VistaAudio.zip"); FastZip fz = new FastZip(); fz.ExtractZip(AppDomain.CurrentDomain.BaseDirectory.ToString() + "VistaAudio.zip", AppDomain.CurrentDomain.BaseDirectory.ToString() + "VistaAudio", null); } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "DownloadVistaAudioBW_DoWork()", "App.xaml.cs"); } }