//public static StringBuilder CreateTressInfo() //{ // StringBuilder sb = new StringBuilder(); // sb.Append("User Is : " + VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName); // sb.AppendLine(); // sb.Append("Peer Type is : " + VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType.ToString()); // sb.AppendLine(); // sb.Append("User's SuperNode is : " + VMuktiAPI.VMuktiInfo.CurrentPeer.SuperNodeIP); // sb.AppendLine(); // sb.Append("User's Machine Ip Address : " + VMuktiAPI.GetIPAddress.ClsGetIP4Address.GetIP4Address()); // sb.AppendLine(); // sb.AppendLine("----------------------------------------------------------------------------------------"); // return sb; //} private void btnSave_Click(object sender, RoutedEventArgs e) { ClsCRMs objSaveCRM = new ClsCRMs(); //Checks wheather textbox containing CRMname is left blank or not. if (txtName.Text.Trim() == "") { System.Windows.MessageBox.Show("CRM Name Can't Be Left Blank", "-> CRM Name", MessageBoxButton.OK, MessageBoxImage.Exclamation); txtName.Focus(); txtName.Text = txtName.Text.Trim(); return; } //Check wheather to edit existing record or add new record. if (varState == 0) { //Add new Record. objSaveCRM.ID = -1; } else { //Edit existing Record. objSaveCRM.ID = varID; } //Set the object of the ClsCRM. objSaveCRM.CRMName = txtName.Text; objSaveCRM.IsActive = (bool)chkIsActive.IsChecked; objSaveCRM.CreatedBy = VMuktiAPI.VMuktiInfo.CurrentPeer.ID; //Call the save method of ClsCRM class of Vmukti.Business. int gID = objSaveCRM.Save(); //Check wheather record is saved successfully or not. if (gID == 0) { MessageBox.Show("Duplicate Entry For CRM Name Is Not Allowed !!", "-> CRM ", MessageBoxButton.OK, MessageBoxImage.Information); } else { System.Windows.MessageBox.Show("Record Saved Successfully!!"); funSetGrid(); varState = 0; FncClearAll(); } }
private void CtlGrid_btnDeleteClicked(int rowID) { try { //Get the id of the selected row. varID = Convert.ToInt32(objCRMCollection[rowID].ID); //Gets the confirmation from the user for deleting record. MessageBoxResult r = System.Windows.MessageBox.Show("Do You Really Want To Delete This Record ?", "->Delete CRM", MessageBoxButton.YesNo, MessageBoxImage.Question); if (r == MessageBoxResult.Yes) { //Calls the method of ClsCRM class of CRM.Business to delete the record. ClsCRMs.Delete(varID); System.Windows.MessageBox.Show("Record Deleted!!", "->CRM Deleted", MessageBoxButton.OK, MessageBoxImage.Information); //Refersh the Grid. funSetGrid(); } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "CtlGrid_btnDeleteClicked()", "CtlCRM.xaml.cs"); } }