示例#1
0
        static public void SetGLNnumber(DCInvoice InvClient, DCAccount client, QueryAPI api)
        {
            var Comp            = api.CompanyEntity;
            var installation    = (WorkInstallation)Comp.GetCache(typeof(WorkInstallation), api)?.Get(InvClient._Installation);
            var deliveryAccount = (DCAccount)Comp.GetCache(typeof(Debtor), api)?.Get(InvClient._DeliveryAccount);
            var debtor          = client ?? (DCAccount)Comp.GetCache(typeof(Debtor), api)?.Get(InvClient._DCAccount);
            var contact         = (Contact)Comp.GetCache(typeof(Contact), api)?.Get(InvClient._ContactRef);

            InvClient._EAN = installation?._GLN ?? deliveryAccount?._EAN ?? contact?._EAN ?? debtor?._EAN;
        }
示例#2
0
        async void CallJoinTwoAccount(DCAccount fromAccount, DCAccount toAccount)
        {
            MaintableAPI tableApi = new MaintableAPI(api);
            ErrorCodes   res      = await tableApi.JoinTwoAccounts(fromAccount, toAccount);

            if (res == ErrorCodes.Succes)
            {
                this.DialogResult = true;
            }
            UtilDisplay.ShowErrorCode(res);
        }
        public static List <DCAccount> GetUnallotedDCAccounts(bool allOffices = false, bool showDeleted = false)
        {
            List <DCAccount> DCAccountList = new List <DCAccount>();

            DataTable DCAccountTable = DCAccountDataAccess.GetInstance.GetUnallotedDCAccounts(allOffices, showDeleted);

            foreach (DataRow dr in DCAccountTable.Rows)
            {
                DCAccount TheDCAccount = DataRowToObject(dr);

                DCAccountList.Add(TheDCAccount);
            }

            return(DCAccountList);
        }
示例#4
0
 private void OKButton_Click(object sender, RoutedEventArgs e)
 {
     if (leAccount.Visibility == Visibility.Visible)
     {
         if (string.IsNullOrWhiteSpace(leAccount.Text))
         {
             UnicontaMessageBox.Show(string.Format(Uniconta.ClientTools.Localization.lookup("MandatoryField"), (Uniconta.ClientTools.Localization.lookup("Account"))), Uniconta.ClientTools.Localization.lookup("Warning"));
             return;
         }
         DCAccount = cmbDCtype.SelectedIndex == 0 ? (DCAccount)DebtorCache?.Get(Account) : (DCAccount)CreditorCache?.Get(Account);
     }
     if (txtVat.Visibility == Visibility.Visible && string.IsNullOrWhiteSpace(leVat.Text))
     {
         UnicontaMessageBox.Show(string.Format(Uniconta.ClientTools.Localization.lookup("MandatoryField"), (Uniconta.ClientTools.Localization.lookup("Vat"))), Uniconta.ClientTools.Localization.lookup("Warning"));
         return;
     }
     this.DialogResult = true;
 }
示例#5
0
        public int DeleteDCAccount(DCAccount theDCAccount)
        {
            int ReturnValue = 0;

            using (SqlCommand DeleteCommand = new SqlCommand())
            {
                DeleteCommand.CommandType = CommandType.StoredProcedure;
                DeleteCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output;
                DeleteCommand.Parameters.Add(GetParameter("@DCAccountID", SqlDbType.Int, theDCAccount.DCAccountID));
                DeleteCommand.Parameters.Add(GetParameter("@ModifiedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID));
                DeleteCommand.CommandText = "pCRM_DCAccounts_Delete";

                ExecuteStoredProcedure(DeleteCommand);

                ReturnValue = int.Parse(DeleteCommand.Parameters[0].Value.ToString());

                return(ReturnValue);
            }
        }
        static public void SetDeliveryAdress(DCInvoice InvClient, DCAccount client, QueryAPI api)
        {
            SetGLNnumber(InvClient, client, api);

            if (InvClient._DeliveryAddress1 != null)
            {
                return;
            }

            if (InvClient._Installation != null)
            {
                var wInsCache    = api.GetCache(typeof(WorkInstallation)) ?? api.LoadCache(typeof(WorkInstallation)).GetAwaiter().GetResult();
                var installation = (WorkInstallation)wInsCache.Get(InvClient._Installation);
                if (installation == null)
                {
                    wInsCache    = api.LoadCache(typeof(WorkInstallation), true).GetAwaiter().GetResult();
                    installation = (WorkInstallation)wInsCache.Get(InvClient._Installation);
                }
                if (installation != null)
                {
                    InvClient._DeliveryName     = installation._Name;
                    InvClient._DeliveryAddress1 = installation._Address1;
                    InvClient._DeliveryAddress2 = installation._Address2;
                    InvClient._DeliveryAddress3 = installation._Address3;
                    InvClient._DeliveryZipCode  = installation._ZipCode;
                    InvClient._DeliveryCity     = installation._City;
                    if (api.CompanyEntity._Country != (byte)installation._Country)
                    {
                        InvClient._DeliveryCountry = installation._Country;
                    }
                }
            }
            else
            {
                DCAccount deb = null;
                string    ac;
                bool      UseDebAddress;
                if (InvClient._DeliveryAccount != null)
                {
                    ac            = InvClient._DeliveryAccount;
                    UseDebAddress = true;
                }
                else
                {
                    UseDebAddress = false;
                    if (client != null)
                    {
                        deb = client;
                        ac  = null;
                    }
                    else
                    {
                        ac = InvClient._DCAccount;
                    }
                }
                if (ac != null)
                {
                    var dctype  = InvClient.__DCType();
                    var t       = (dctype == 2 || dctype == 9) ? typeof(Uniconta.DataModel.Creditor) : typeof(Uniconta.DataModel.Debtor);
                    var dcCache = api.GetCache(t) ?? api.LoadCache(t).GetAwaiter().GetResult();
                    deb = (DCAccount)dcCache.Get(ac);
                    if (deb == null)
                    {
                        dcCache = api.LoadCache(t, true).GetAwaiter().GetResult();
                        deb     = (DCAccount)dcCache.Get(ac);
                    }
                }
                if (deb != null)
                {
                    if (deb._DeliveryAddress1 != null)
                    {
                        InvClient._DeliveryName     = deb._DeliveryName;
                        InvClient._DeliveryAddress1 = deb._DeliveryAddress1;
                        InvClient._DeliveryAddress2 = deb._DeliveryAddress2;
                        InvClient._DeliveryAddress3 = deb._DeliveryAddress3;
                        InvClient._DeliveryZipCode  = deb._DeliveryZipCode;
                        InvClient._DeliveryCity     = deb._DeliveryCity;
                        InvClient._DeliveryCountry  = deb._DeliveryCountry;
                    }
                    else if (UseDebAddress)
                    {
                        InvClient._DeliveryName     = deb._Name;
                        InvClient._DeliveryAddress1 = deb._Address1;
                        InvClient._DeliveryAddress2 = deb._Address2;
                        InvClient._DeliveryAddress3 = deb._Address3;
                        InvClient._DeliveryZipCode  = deb._ZipCode;
                        InvClient._DeliveryCity     = deb._City;
                        if (api.CompanyEntity._Country != (byte)deb._Country)
                        {
                            InvClient._DeliveryCountry = deb._Country;
                        }
                    }
                }
            }
        }
示例#7
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// DataEye登出
 /// </summary>
 public static void logout()
 {
     DCAccount.logout();
 }
示例#8
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// DataEye登陆
 /// </summary>
 /// <param name="acc_id"></param>
 public static void login(string acc_id)
 {
     DCAccount.login(acc_id);
 }
 public static int DeleteDcAccount(DCAccount theDcAccount)
 {
     return(DCAccountDataAccess.GetInstance.DeleteDCAccount(theDcAccount));
 }
 public static int InsertDcAccount(DCAccount theDCAccount)
 {
     return(DCAccountDataAccess.GetInstance.InsertDCAccount(theDCAccount));
 }
示例#11
0
        static public void SetDeliveryAdress(DCInvoice InvClient, DCAccount client, QueryAPI api)
        {
            SetGLNnumber(InvClient, client, api);

            if (InvClient._DeliveryAddress1 != null)
            {
                return;
            }

            var Comp = api.CompanyEntity;

            if (InvClient._Installation != null)
            {
                var installation = (WorkInstallation)Comp.GetCache(typeof(WorkInstallation), api)?.Get(InvClient._Installation);
                if (installation != null)
                {
                    InvClient._DeliveryName     = installation._Name;
                    InvClient._DeliveryAddress1 = installation._Address1;
                    InvClient._DeliveryAddress2 = installation._Address2;
                    InvClient._DeliveryAddress3 = installation._Address3;
                    InvClient._DeliveryZipCode  = installation._ZipCode;
                    InvClient._DeliveryCity     = installation._City;
                    if (Comp._Country != (byte)installation._Country)
                    {
                        InvClient._DeliveryCountry = installation._Country;
                    }
                }
            }
            else
            {
                DCAccount deb;
                bool      UseDebAddress;
                if (InvClient._DeliveryAccount != null)
                {
                    deb           = (DCAccount)Comp.GetCache(typeof(Debtor), api)?.Get(InvClient._DeliveryAccount);
                    UseDebAddress = true;
                }
                else
                {
                    deb           = client ?? (DCAccount)Comp.GetCache(typeof(Debtor), api)?.Get(InvClient._DCAccount);
                    UseDebAddress = false;
                }
                if (deb != null)
                {
                    if (deb._DeliveryAddress1 != null)
                    {
                        InvClient._DeliveryName     = deb._DeliveryName;
                        InvClient._DeliveryAddress1 = deb._DeliveryAddress1;
                        InvClient._DeliveryAddress2 = deb._DeliveryAddress2;
                        InvClient._DeliveryAddress3 = deb._DeliveryAddress3;
                        InvClient._DeliveryZipCode  = deb._DeliveryZipCode;
                        InvClient._DeliveryCity     = deb._DeliveryCity;
                        InvClient._DeliveryCountry  = deb._DeliveryCountry;
                    }
                    else if (UseDebAddress)
                    {
                        InvClient._DeliveryName     = deb._Name;
                        InvClient._DeliveryAddress1 = deb._Address1;
                        InvClient._DeliveryAddress2 = deb._Address2;
                        InvClient._DeliveryAddress3 = deb._Address3;
                        InvClient._DeliveryZipCode  = deb._ZipCode;
                        InvClient._DeliveryCity     = deb._City;
                        if (Comp._Country != (byte)deb._Country)
                        {
                            InvClient._DeliveryCountry = deb._Country;
                        }
                    }
                }
            }
        }
示例#12
0
 public int DeleteDCAccount(DCAccount theDCAccount)
 {
     return(DCAccountIntegration.DeleteDcAccount(theDCAccount));
 }
示例#13
0
 public int UpdateDCAccount(DCAccount theDCAccount)
 {
     return(DCAccountIntegration.UpdateDcAccount(theDCAccount));
 }
示例#14
0
 public int InsertDCAccount(DCAccount theDCAccount)
 {
     return(DCAccountIntegration.InsertDcAccount(theDCAccount));
 }