public void Csoport_Changed(object sender, XmlEventArgs e) { DataConnections["Version"].Execute(); string validVerison = DataSources["Version"].CreateNavigator().SelectSingleNode("dataroot/Verzio/Bankjegy", NamespaceManager).Value; string currentVersion = MainDataSource.CreateNavigator().SelectSingleNode("/my:sajátMezők/my:Alapadatok/my:Version", NamespaceManager).Value; if (validVerison == currentVersion) { int szam = 1; Name = MainDataSource.CreateNavigator().SelectSingleNode("/my:sajátMezők/my:Alapadatok/my:Name", NamespaceManager).Value; csoport = MainDataSource.CreateNavigator().SelectSingleNode("/my:sajátMezők/my:Alapadatok/my:Csoport", NamespaceManager).Value; verzio = MainDataSource.CreateNavigator().SelectSingleNode("/my:sajátMezők/my:Alapadatok/my:Version", NamespaceManager).Value; if (szam == 1) { Form1 form1 = new Form1(); form1.ShowDialog(); } szam = 2; mentes(); } else { DialogResult dr_csc = MessageBox.Show("Megjelent az űrlap legújabb verziója!\n\nAmíg a frissítést nem végzed el, addig az adatokat sem tudod rögzíteni!", "Verziófrissítés szükséges!", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }
public void FormEvents_Submit(object sender, SubmitEventArgs e) { var UriBuilder = new UriBuilder("http://smsgateway.me/api/v3/messages/send/"); var parameters = HttpUtility.ParseQueryString(string.Empty); parameters["email"] = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:email", NamespaceManager).Value; parameters["password"] = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:password", NamespaceManager).Value; parameters["device"] = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:device", NamespaceManager).Value;; parameters["number"] = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:MobileNumber", NamespaceManager).Value; parameters["message"] = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:SMS_TO_BE_SENT", NamespaceManager).Value;; UriBuilder.Query = parameters.ToString(); //UriBuilder.Fragment = "some_fragment"; Uri finalUrl = UriBuilder.Uri; var request = WebRequest.Create(finalUrl); // Get the response. WebResponse result = request.GetResponse(); // Get the stream containing content returned by the server. Stream dataStream = result.GetResponseStream(); // Open the stream using a StreamReader for easy access. StreamReader reader = new StreamReader(dataStream); // Read the content. string responseFromServer = reader.ReadToEnd(); var successRoot = JsonConvert.DeserializeObject <RootObject>(responseFromServer); var isSuccess = successRoot.result.success != null && successRoot.result.success.Count > 0; var isFail = successRoot.result.fails != null && successRoot.result.fails.Count > 0; if (isSuccess) { var id = successRoot.result.success.First().id; var message = successRoot.result.success.First().message; // Display the content. string value = Convert.ToString(id); string value1 = Convert.ToString(message); System.Windows.Forms.MessageBox.Show("SMS " + value + " " + value1 + " Sent SuccessFully"); } else { //var messagefail = successRoot.result.fails.First().device; //string value = Convert.ToString(messagefail); System.Windows.Forms.MessageBox.Show("SMS Could Not Be Sent. Check Device"); } // Clean up the streams. reader.Close(); dataStream.Close(); result.Close(); }
private void AddUserToSelectedSiteGroups() { XPathNavigator root = MainDataSource.CreateNavigator(); List <string> selectedGroups = new List <string>(); XPathNodeIterator iter = root.Select("//my:EmployeeForm/my:SiteGroups/my:SiteGroup", NamespaceManager); string prevGroups = root.SelectSingleNode("/my:EmployeeForm/my:prevSiteGroups", NamespaceManager).Value; string[] prevSitegroups = new string[] { }; string[] currSitegroups = new string[] { }; if (prevGroups.Length > 0) { prevSitegroups = prevGroups.Split(','); // get all previously selected site groups } while (iter.MoveNext()) { string value = iter.Current.Value; if (value != null && value != "") { XPathNavigator siteGroups = DataSources["SiteGroupsRestService"].CreateNavigator(); XPathNavigator nav = siteGroups.SelectSingleNode("/ns2:feed/ns2:entry/ns2:content/m:properties/ns1:Title[../ns1:Id = '" + value + "']", NamespaceManager); if (!selectedGroups.Contains(nav.Value)) { selectedGroups.Add(nav.Value); } } } // while (iter.MoveNext()) if (selectedGroups.Count > 0) { if (prevSitegroups.Length > 0) { currSitegroups = selectedGroups.ToArray(); IEnumerable <string> deleteUserFromGroups = prevSitegroups.Except(currSitegroups); IEnumerable <string> addUserToGroups = currSitegroups.Except(prevSitegroups); AddOrRemoveUserToGroup(deleteUserFromGroups, UserOpType.RemoveUser); AddOrRemoveUserToGroup(addUserToGroups, UserOpType.AddUser); } else // Add user to site groups if there is no previously selected groups { AddOrRemoveUserToGroup(selectedGroups, UserOpType.AddUser); } } // if (groups.Count > 0) else if (prevSitegroups.Length > 0) // if enduser unselect all options, remove user from site group { AddOrRemoveUserToGroup(prevSitegroups, UserOpType.RemoveUser); } } // private void AddUserToSiteGroups()
private void DeleteDestinationRows() { XPathNavigator sas_OrgCountyArea = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:Sec04_PropAreaOfCaverageOrg/my:sas_OrgCountyArea", NamespaceManager); XPathNodeIterator OrgCountyAreaCoverageItems = sas_OrgCountyArea.Select("./my:OrgCountyAreaCoverage", NamespaceManager); if (OrgCountyAreaCoverageItems.Count > 0) { for (int i = OrgCountyAreaCoverageItems.Count; i > 0; i--) { XPathNavigator OrgCountyAreaCoverageItem = sas_OrgCountyArea.CreateNavigator().SelectSingleNode("my:OrgCountyAreaCoverage[position() = " + i + "]", NamespaceManager); OrgCountyAreaCoverageItem.DeleteSelf(); } } }
public void mentes() { //try //{ MainDataSource.CreateNavigator().SelectSingleNode("/my:sajátMezők/my:Alapadatok/my:SAP", NamespaceManager).SetValue(Form1.formSAP); MainDataSource.CreateNavigator().SelectSingleNode("/my:sajátMezők/my:Alapadatok/my:Posta", NamespaceManager).SetValue(Form1.posta); FileSubmitConnection fc = DataConnections["UpLoad"] as FileSubmitConnection; // adatok Sharepoint-ba küldéshez deklaráció fc.Execute(); // adatok Sharepoint-ba küldése DialogResult dr6 = MessageBox.Show("A mentés sikeresen megtörtént!", "Figyelem!", MessageBoxButtons.OK, MessageBoxIcon.Information); //this.Application.Quit(); //} //catch //{ // MessageBox.Show("Az iktatószám mentése sikertelen volt, ellenőrizd a hálózati kapcsolatod!", "Figyelem:"); // } }
public void FormEvents_Loading(object sender, LoadingEventArgs e) { // Write your code here. //DataConnection connection = this.DataConnections["EmpDesignation"]; //connection.Execute(); SharePointListRWQueryConnection spsConn = (SharePointListRWQueryConnection)this.DataSources["EmpDesignation"].QueryConnection; spsConn.Execute(); DataConnection connectionEmpCountry = this.DataConnections["EmpCountry"]; connectionEmpCountry.Execute(); DataConnection connectionSiteGroups = this.DataConnections["SiteGroupsRestService"]; connectionSiteGroups.Execute(); MainDataSource.CreateNavigator().SelectSingleNode("/my:EmployeeForm/my:siteUrl", NamespaceManager).SetValue(spsConn.SiteUrl.ToString()); LoadUserSiteGroups(); }
public bool GetMainDataSource_isForetak() { try { XPathNavigator mainData = MainDataSource.CreateNavigator(); XPathNavigator node = mainData.SelectSingleNode("/melding/Skjemadata/erForetak", NamespaceManager); if (string.Equals(node.InnerXml.ToString(), "true")) { return(true); } else { return(false); } } catch { return(false); } }
public void SetNodeToString(string xpath, string value, string nillValue) { XPathNavigator mainData = MainDataSource.CreateNavigator(); XPathNavigator node = mainData.SelectSingleNode(xpath, NamespaceManager); if (!String.IsNullOrEmpty(value)) { DeleteNil(node); node.SetValue(value); } else if (!String.IsNullOrEmpty(nillValue)) { DeleteNil(node); node.SetValue(nillValue); } else { DeleteNil(node); node.SetValue(""); } }
public void btnDeleteBody1_Clicked(object sender, ClickedEventArgs e) { DeleteDestinationRows(); XPathNavigator root = MainDataSource.CreateNavigator(); XPathNavigator sas_OrgCountyArea = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:SecUF_UpdatedFields/my:sas_OrgCountyAreaNew", NamespaceManager); XPathNodeIterator OrgCountyAreaCoverage = sas_OrgCountyArea.Select("./my:OrgCountyAreaCoverageNew", NamespaceManager); //for (int i = OrgCountyAreaCoverage.Count; i > 0; i--) for (int i = 1; i <= OrgCountyAreaCoverage.Count; i++) { XPathNavigator OrgCountyAreaCoverageItem = sas_OrgCountyArea.CreateNavigator().SelectSingleNode("my:OrgCountyAreaCoverageNew[position() = " + i + "]", NamespaceManager); //Text Field XPathNavigator sas_CountiesCoverage = OrgCountyAreaCoverageItem.SelectSingleNode("my:sas_CountiesCoverageNew", NamespaceManager); string sas_CountiesCoverageValue = sas_CountiesCoverage.Value; List <string[]> valuesArray = new List <string[]>(); //Repeating Table XPathNavigator AreaCoverageAddition = OrgCountyAreaCoverageItem.SelectSingleNode("my:AreaCoverageAdditionNew", NamespaceManager); XPathNodeIterator AreaCoverageAddTown = AreaCoverageAddition.Select("./my:AreaCoverageAddTownNew", NamespaceManager); for (int j = 1; j <= AreaCoverageAddTown.Count; j++) { XPathNavigator AreaCoverageAddTownItem = AreaCoverageAddition.CreateNavigator().SelectSingleNode("my:AreaCoverageAddTownNew[position() = " + j + "]", NamespaceManager); // Text Field XPathNavigator sas_AreaCoverageTowns = AreaCoverageAddTownItem.SelectSingleNode("my:sas_AreaCoverageTownsNew", NamespaceManager); XPathNavigator sas_AreaCoverageInfoNew = AreaCoverageAddTownItem.SelectSingleNode("my:sas_AreaCoverageInfoNew", NamespaceManager); string[] values = { sas_AreaCoverageTowns.Value, sas_AreaCoverageInfoNew.Value }; valuesArray.Add(values); } SaveSection4(sas_CountiesCoverageValue, valuesArray); //legislationItem.DeleteSelf(); } }
private void AddOrRemoveUserToGroup(IEnumerable <string> groups, UserOpType operationType) { XPathNavigator root = MainDataSource.CreateNavigator(); string siteUrl = root.SelectSingleNode("/my:EmployeeForm/my:siteUrl", NamespaceManager).Value; string userID = root.SelectSingleNode("/my:EmployeeForm/my:txtUserID", NamespaceManager).Value; if (groups.Count() > 0) { using (SPSite site = new SPSite(siteUrl)) { using (SPWeb web = site.RootWeb) { web.AllowUnsafeUpdates = true; SPUser user = web.EnsureUser(userID); foreach (string group in groups) { SPGroup spGroup = web.Groups[group]; if (spGroup != null) { if (operationType.Equals(UserOpType.AddUser)) { spGroup.AddUser(user); } else { spGroup.RemoveUser(user); } } } // foreach (string group web.AllowUnsafeUpdates = false; } } } // if (groups.Count() > 0) }