Exemplo n.º 1
0
        public void AuthorizedFiscalCode_Changed(object sender, XmlEventArgs e)
        {
            XPathNavigator mainSourceNav = this.MainDataSource.CreateNavigator();

            Bol.WebServices.Client.Client client = new Bol.WebServices.Client.Client();

            client.Url = ConfigurationManager.AppSettings["Bol.Webservices.Client.Url"];//"http://srv-app/bol.webservices/client.asmx";

            XmlNode retNode = client.GetClientInfoByFiscalCode(mainSourceNav.SelectSingleNode("/my:myFields/my:Procures/my:AuthorizedFiscalCode", NamespaceManager).InnerXml);

            if (retNode.SelectSingleNode("/ClientExist").InnerText != "0")
            {
                mainSourceNav.SelectSingleNode("/my:myFields/my:Procures/my:AuthorizedFirstName", NamespaceManager).SetValue(retNode.SelectSingleNode("/FirstName").InnerText);
                mainSourceNav.SelectSingleNode("/my:myFields/my:Procures/my:AuthorizedLastName", NamespaceManager).SetValue(retNode.SelectSingleNode("/LastName").InnerText);
                mainSourceNav.SelectSingleNode("/my:myFields/my:Procures/my:AuthorizedPatronimyc", NamespaceManager).SetValue(retNode.SelectSingleNode("/Patronymic").InnerText);
            }
        }
Exemplo n.º 2
0
        public void BtnProcessing_Clicked(object sender, ClickedEventArgs e)
        {
            XPathNavigator mainSourceNav = this.MainDataSource.CreateNavigator();

            SPSite site = new SPSite(_mainListUrl,SPUserToken.SystemAccount);
            SPWeb web = site.OpenWeb();
            SPList list = web.GetListFromUrl(_mainListUrl);
            string fieldFiscalCodeTitle = list.Fields["FiscalCode"].InternalName;

            SPQuery query = new SPQuery();
            query.Query = string.Format(
            @"<Where>
              <Eq>
             <FieldRef Name='{0}' />
             <Value Type='Text'>{1}</Value>
              </Eq>
               </Where>", fieldFiscalCodeTitle, mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:FiscalCode", NamespaceManager));
            SPListItemCollection items = list.GetItems(query);

            XPathNavigator vars = DataSources["Vars"].CreateNavigator();

            if (items.Count > 0)
            {
                vars.SelectSingleNode("/Root/Err1").SetValue("1");
                vars.SelectSingleNode("/Root/Link").SetValue(string.Format(Resource.BigLinkFormat, ServerInfo.SharePointSiteUrl, items[0].File.ServerRelativeUrl, _mainListUrl));
            }
            else
            {
                Bol.WebServices.Client.Client client = new Bol.WebServices.Client.Client();

                client.Url = ConfigurationManager.AppSettings["Bol.Webservices.Client.Url"];//"http://srv-app/bol.webservices/client.asmx";

                XmlNode retNode = client.GetClientInfoByFiscalCode(mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:FiscalCode", NamespaceManager).InnerXml);

                vars.SelectSingleNode("/Root/Err2").SetValue("");

                if (retNode.SelectSingleNode("/ClientExist").InnerText == "0")
                {
                    vars.SelectSingleNode("/Root/Err2").SetValue(@"*Daca clientul nu este inregistrat in BOL (numai in Directia Carduri),introduceti manual NPP, altfel iesiti din program, intrati din nou si introduceti corect codul fiscal.");
                }
                else
                {
                    mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:FirstName", NamespaceManager).SetValue(retNode.SelectSingleNode("/FirstName").InnerText);
                    mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:LastName", NamespaceManager).SetValue(retNode.SelectSingleNode("/LastName").InnerText);
                    mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:Patronymic", NamespaceManager).SetValue(retNode.SelectSingleNode("/Patronymic").InnerText);
                    DataSources["Vars"].CreateNavigator().SelectSingleNode("/Root/GeneralFieldAccess").SetValue("1");
                }
            }
            vars.SelectSingleNode("/Root/BtnProcessingAccess").SetValue("0");
        }
Exemplo n.º 3
0
        public void BtnProcessing_Clicked(object sender, ClickedEventArgs e)
        {
            XPathNavigator mainSourceNav = this.MainDataSource.CreateNavigator();

            SPSite site = new SPSite(_mainListUrl, SPUserToken.SystemAccount);
            SPWeb web = site.OpenWeb();
            SPList list = web.GetListFromUrl(_mainListUrl);
            string fieldFiscalCodeTitle = list.Fields["FiscalCode"].InternalName;

            SPQuery query = new SPQuery();
            query.Query = string.Format(
            @"<Where>
              <Eq>
             <FieldRef Name='{0}' />
             <Value Type='Text'>{1}</Value>
              </Eq>
               </Where>", fieldFiscalCodeTitle, mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:FiscalCode", NamespaceManager));
            SPListItemCollection items = list.GetItems(query);

            XPathNavigator vars = DataSources["Vars"].CreateNavigator();

            if (items.Count > 0)
            {
                vars.SelectSingleNode("/Root/Link").SetValue(string.Format(Resource.BigLinkFormat, ServerInfo.SharePointSiteUrl, items[0].File.ServerRelativeUrl, _mainListUrl));
            }
            else
            {
                Bol.WebServices.Client.Client client = new Bol.WebServices.Client.Client();

                client.Url = ConfigurationManager.AppSettings["Bol.Webservices.Client.Url"];//"http://srv-app/bol.webservices/client.asmx";

                XmlNode retNode = client.GetClientInfoByFiscalCode(mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:FiscalCode", NamespaceManager).InnerXml);

                if (retNode.SelectSingleNode("/ClientExist").InnerText != "0")
                {
                    mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:FirstName", NamespaceManager).SetValue(retNode.SelectSingleNode("/FirstName").InnerText);
                    mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:LastName", NamespaceManager).SetValue(retNode.SelectSingleNode("/LastName").InnerText);
                    mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:Patronymic", NamespaceManager).SetValue(retNode.SelectSingleNode("/Patronymic").InnerText);
                    mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:DocumentType", NamespaceManager).SetValue(retNode.SelectSingleNode("/DocumentType").InnerText);
                    mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:DocumentNumber", NamespaceManager).SetValue(retNode.SelectSingleNode("/IDSeriaNumber").InnerText);
                    mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:IssueOffice", NamespaceManager).SetValue(retNode.SelectSingleNode("/IDEmitter").InnerText);
                    if (retNode.SelectSingleNode("/IDDate").InnerText != "")
                    {
                        DeleteNil(mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:IssueDate", NamespaceManager));
                        mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:IssueDate", NamespaceManager).SetValue(retNode.SelectSingleNode("/IDDate").InnerText);
                    }
                    if (retNode.SelectSingleNode("/IDExpireDate").InnerText != "")
                    {
                        DeleteNil(mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:ExpireDate", NamespaceManager));
                        mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:ExpireDate", NamespaceManager).SetValue(retNode.SelectSingleNode("/IDExpireDate").InnerText);
                    }
                    mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:Address", NamespaceManager).SetValue(
                        retNode.SelectSingleNode("/MainAddrLocation").InnerText + ", " +
                        retNode.SelectSingleNode("/MainAddrStreet").InnerText + " " +
                        retNode.SelectSingleNode("/MainAddrBuilding").InnerText + "/ " +
                        retNode.SelectSingleNode("/MainAddrBlock").InnerText + ", ap." +
                        retNode.SelectSingleNode("/MainAddrApartment").InnerText);
                    mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:Phone", NamespaceManager).SetValue(retNode.SelectSingleNode("/Phone").InnerText);
                    mainSourceNav.SelectSingleNode("/my:myFields/my:ClientInfo/my:Email", NamespaceManager).SetValue(retNode.SelectSingleNode("/Email").InnerText);

                    vars.SelectSingleNode("/Root/BtnProcessingAccess").SetValue("1");
                }
            }
        }