Exemplo n.º 1
0
        public static string UnitySendPost(UnityObjects.Data items)
        {
            string msg;

            if (items.Post() == true)
            {
                msg = ("ok");
            }
            else
            {
                if (items.ErrorCode != 0)
                {
                    msg = ("DBError(" + items.ErrorCode.ToString() + ")-" + items.ErrorDesc + items.DBErrorDesc);
                }
                else //if (items.ValidateErrors.Count > 0)
                {
                    string result = "XML ErrorList:";
                    for (int i = 0; i < items.ValidateErrors.Count; i++)
                    {
                        result += "(" + items.ValidateErrors[i].ID.ToString() + ") - " + items.ValidateErrors[i].Error;
                    }
                    msg = (result);
                }
            }
            return(msg);
        }
Exemplo n.º 2
0
        public string Try(string fNo)
        {
            UnityKeeper.Unitylogin();
            UnityObjects.IUnityApplication UnityAppTutucu = UnityKeeper.UnityApp;


            UnityObjects.Data items = UnityAppTutucu.NewDataObject(UnityObjects.DataObjectType.doMaterialSlip);
            items.New();
            items.DataFields.FieldByName("GROUP").Value      = 3;
            items.DataFields.FieldByName("TYPE").Value       = 13;
            items.DataFields.FieldByName("NUMBER").Value     = fNo;
            items.DataFields.FieldByName("DATE").Value       = "25.12.2019";
            items.DataFields.FieldByName("TIME").Value       = 271718400;
            items.DataFields.FieldByName("AUXIL_CODE").Value = "OPERP";
            //items.DataFields.FieldByName("SOURCE_WSCODE").Value = 001;
            items.DataFields.FieldByName("CREATED_BY").Value     = 1;
            items.DataFields.FieldByName("DATE_CREATED").Value   = "24.12.2019";
            items.DataFields.FieldByName("HOUR_CREATED").Value   = 16;
            items.DataFields.FieldByName("MIN_CREATED").Value    = 50;
            items.DataFields.FieldByName("SEC_CREATED").Value    = 40;
            items.DataFields.FieldByName("MODIFIED_BY").Value    = 1;
            items.DataFields.FieldByName("DATE_MODIFIED").Value  = "25.12.2019";
            items.DataFields.FieldByName("HOUR_MODIFIED").Value  = 17;
            items.DataFields.FieldByName("MIN_MODIFIED").Value   = 49;
            items.DataFields.FieldByName("SEC_MODIFIED").Value   = 24;
            items.DataFields.FieldByName("DATA_REFERENCE").Value = 50;

            UnityObjects.Lines transactions_lines = items.DataFields.FieldByName("TRANSACTIONS").Lines;
            transactions_lines.AppendLine();
            transactions_lines[transactions_lines.Count - 1].FieldByName("ITEM_CODE").Value      = "PT0950603000PSYG460654";
            transactions_lines[transactions_lines.Count - 1].FieldByName("LINE_TYPE").Value      = 0;
            transactions_lines[transactions_lines.Count - 1].FieldByName("LINE_NUMBER").Value    = 1;
            transactions_lines[transactions_lines.Count - 1].FieldByName("QUANTITY").Value       = 3;
            transactions_lines[transactions_lines.Count - 1].FieldByName("UNIT_CODE").Value      = "ADET";
            transactions_lines[transactions_lines.Count - 1].FieldByName("UNIT_CONV1").Value     = 1;
            transactions_lines[transactions_lines.Count - 1].FieldByName("UNIT_CONV2").Value     = 1;
            transactions_lines[transactions_lines.Count - 1].FieldByName("DATA_REFERENCE").Value = 76;
            transactions_lines[transactions_lines.Count - 1].FieldByName("EU_VAT_STATUS").Value  = 4;
            transactions_lines[transactions_lines.Count - 1].FieldByName("EDT_CURR").Value       = 1;
            items.DataFields.FieldByName("DOC_DATE").Value = "24.12.2019";
            items.DataFields.FieldByName("DOC_TIME").Value = 271722496;
            string msg;

            if (items.Post() == true)
            {
                msg = ("POST OK !");
            }
            else
            {
                if (items.ErrorCode != 0)
                {
                    msg = ("DBError(" + items.ErrorCode.ToString() + ")-" + items.ErrorDesc + items.DBErrorDesc);
                }
                else //if (items.ValidateErrors.Count > 0)
                {
                    string result = "XML ErrorList:";
                    for (int i = 0; i < items.ValidateErrors.Count; i++)
                    {
                        result += "(" + items.ValidateErrors[i].ID.ToString() + ") - " + items.ValidateErrors[i].Error;
                    }
                    msg = (result);
                }
            }
            return(msg);
        }