Пример #1
0
        public string getDataExValue(string name)
        {
            DataEx res = getDataEx(name);

            if (res != null)
            {
                return(res.DataExtValue);
            }
            return(null);
        }
Пример #2
0
 public void AddDataEx(string name, string value, string OwnerID, string TxnID)
 {
     if (name != "" && value != "")
     {
         DataEx DE = new DataEx();
         DE.DataExtName       = name;
         DE.DataExtValue      = value;
         DE.ListDataExtType   = ObjectName;
         DE.ListObjRef_ListID = TxnID;
         DE.OwnerID           = OwnerID;
         DataExList.Add(DE);
     }
 }
Пример #3
0
        public DataEx getDataEx(string name)
        {
            DataEx res = null;

            for (int i = 0; i < DataExList.Count; i++)
            {
                if (DataExList[i].DataExtName == name)
                {
                    return(DataExList[i]);
                }
            }
            return(null);
        }
Пример #4
0
        public bool UpdateDataEx(string name, string value, ref string err)
        {
            bool result = false;

            DataEx CF = getDataEx(name);

            if (CF == null)
            {
                // Crear
                result = InsertDataEx(name, value, ref err);
                if (!result)
                {
                    err = "No se pudo crear el DataEx " + name + ". " + err;
                }
                return(result);
            }

            try
            {
                string xml = "";

                xml += "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
                xml += "<?qbxml version=\"13.0\"?>";
                xml += "<QBXML>";
                xml += "<QBXMLMsgsRq onError=\"stopOnError\">";
                xml += "<DataExtModRq>";
                xml += "<DataExtMod>";
                xml += "<OwnerID >" + CF.OwnerID + "</OwnerID>";
                xml += "<DataExtName >" + CF.DataExtName + "</DataExtName>";
                xml += "<TxnDataExtType >" + CF.ListDataExtType + "</TxnDataExtType>";
                xml += "<TxnID >" + CF.ListObjRef_ListID + "</TxnID>";
                xml += "<DataExtValue >" + value + "</DataExtValue>";
                xml += "</DataExtMod>";
                xml += "</DataExtModRq>";
                xml += "</QBXMLMsgsRq>";
                xml += "</QBXML>";



                if (Config.quickbooks.isOpen())
                {
                    string response = Config.quickbooks.sendRequest(xml);

                    XmlDocument res = new XmlDocument();
                    res.LoadXml(response);

                    string code          = "";
                    string statusMessage = "";

                    code          = res["QBXML"]["QBXMLMsgsRs"]["DataExtModRs"].Attributes["statusCode"].Value;
                    statusMessage = res["QBXML"]["QBXMLMsgsRs"]["DataExtModRs"].Attributes["statusMessage"].Value;

                    if (code == "0")
                    {
                        return(true);
                    }
                    else
                    {
                        err = statusMessage;
                    }
                    Config.quickbooks.Disconnect();
                }
                else
                {
                    err = "QuickBook no conecto";
                }
                return(false);
            }
            catch (Exception ex)
            {
                err = ex.Message;
            }

            return(result);
        }