示例#1
0
        //private void SyncOrder(int id)
        //{
        //    SyncOrder(id, null, null);
        //}
        //private void SyncOrder(int id, DataTable cardhandle, DataTable operation)
        //{
        //    DateTime serverDateTime = SynchronizationManager.GetDate(ObjectNames.None, true);
        //    var header = Apothex.DataManagment.Sales.SalesManager.GetSalesOrderHeader(id, false);
        //    var detail = Apothex.DataManagment.Sales.SalesManager.GetSalesOrderDetail(id, false);


        //    if (cardhandle == null) cardhandle = CardManager.GetCardHandle(id, false);
        //    if (operation == null) operation = new DS_Operation.T_OperationDataTable();//OperationManager.Get(id, false);

        //    using (DataSet ds = new DataSet("root"))
        //    {
        //        DataSetHelper.RemoveColumns(header, true,
        //                                header.SalesOrderIDColumn,
        //                                header.BranchIDColumn,
        //                                header.OrderDateColumn,
        //                                header.OverheadNumberColumn,
        //                                header.CustomerIDColumn,
        //                                header.SubTotalColumn,
        //                                header.TaxAmtColumn,
        //                                header.FreightColumn,
        //                                header.CurrencyCodeColumn,
        //                                header.CurrencyRateIDColumn,
        //                                header.PaymentMethodIDColumn,
        //                                header.RevisionNumberColumn,
        //                                header.StatusColumn,
        //                                header.ModifiedUserIDColumn,
        //                                header.ModifiedDateColumn,
        //                                header.ApproverUserIDColumn,
        //                                header.rowguidColumn
        //                                );

        //        DataSetHelper.RemoveColumns(detail, true, detail.SalesOrderDetailIDColumn,
        //                                detail.SalesOrderIDColumn,
        //                                detail.ProductLocationIDColumn,
        //                                detail.SaleQtyColumn,
        //                                detail.UnitPriceColumn,
        //                                detail.UnitPriceDiscountColumn,
        //                                detail.OrdinalNumberColumn,
        //                                detail.ModifiedUserIDColumn,
        //                                detail.ModifiedDateColumn,
        //                                detail.ActionColumn
        //                                );
        //        ds.Tables.Add(header);
        //        ds.Tables.Add(detail);
        //        ds.Tables.Add(cardhandle);
        //        ds.Tables.Add(operation);

        //        DataSetHelper.SetColumnMappingType(ds);
        //        SynchronizationManager.Synchronize(ObjectNames.SalesOrderHeader, GlobalVariable.UserID, GlobalVariable.ServerDateTime, DatabaseAction.Synchronize, true, DataSetHelper.InnerBytesData(ds));

        //        ds.Tables.Remove(detail);
        //        ds.Tables.Remove(cardhandle);
        //        ds.Tables.Remove(operation);

        //        DataSetHelper.RemoveColumns(header, true, header.SalesOrderIDColumn);
        //        SynchronizationManager.Synchronize(ObjectNames.SalesOrderHeader, GlobalVariable.UserID, GlobalVariable.ServerDateTime, DatabaseAction.Synchronize, false, DataSetHelper.InnerBytesData(ds));
        //        BindGrid();
        //    }
        //}

        private void miSynchronize_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (!ConfigurationManagerEx.OfflineMode || !IsPermitted(ObjectNames.Synchronize, DatabaseAction.Add) || gridView.SelectedRowsCount != 1)
            {
                return;
            }

            if (XtraMessageBox.Show(this, "დარწმუნებული ხართ, რომ გინდათ მონიშნული ფაქტურების სინქრონიზაცია?", "სინქრონიზაცია", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }


            try
            {
                var id = ConvertHelper.ToInt32(OptionsGrid.SelectedRecordID);
                if (id == 0)
                {
                    return;
                }

                SynchronizationManager.SynchronizeSalesOrder(id);
                BindGrid();
                //SyncOrder(id);
            }
            catch (Exception ex)
            {
                ExceptionHelper.Show(this, ex, MessageBoxIcon.Error);
            }
        }
示例#2
0
        protected override bool SaveData()
        {
            foreach (CheckedListBoxItem item in chklstTable.Items)
            {
                if (item.CheckState != CheckState.Checked || !item.Enabled)
                {
                    continue;
                }
                var objectName   = (ObjectNames)ConvertHelper.ToInt32(item.Value);
                var modifiedDate = SynchronizationManager.GetDate(objectName, false);
                var table        = new DataTable();
                switch (objectName)
                {
                case ObjectNames.SynchronizeDate:
                    Win32Native.SetLocalTime(SynchronizationManager.GetDate(ObjectNames.None, true));
                    InitSynchronizedCheckedListBoxItem(item);
                    break;

                //case ObjectNames.SalesOrderHeader:
                //    DateTime serverDateTime = SynchronizationManager.GetDate(ObjectNames.None, true);
                //    DS_Sales.SP_GetSalesOrderHeaderDataTable header = Apothex.DataManagment.Sales.SalesManager.GetSalesOrderHeader(serverDateTime.Date, false);
                //    DS_Sales.SP_GetSalesOrderDetailDataTable detail = Apothex.DataManagment.Sales.SalesManager.GetSalesOrderDetail(serverDateTime.Date, false);
                //    DS_Card.T_CardHandleDataTable card = CardManager.GetCardHandle(serverDateTime.Date, false);
                //    using (DataSet ds = new DataSet("root"))
                //    {
                //        DataSetHelper.SetColumnMappingType(header);
                //        DataSetHelper.SetColumnMappingType(detail);
                //        DataSetHelper.SetColumnMappingType(card);

                //        DataSetHelper.RemoveColumns(header, true,
                //                                header.SalesOrderIDColumn,
                //                                header.BranchIDColumn,
                //                                header.OrderDateColumn,
                //                                header.OverheadNumberColumn,
                //                                header.CustomerIDColumn,
                //                                header.SubTotalColumn,
                //                                header.TaxAmtColumn,
                //                                header.FreightColumn,
                //                                header.CurrencyCodeColumn,
                //                                header.CurrencyRateIDColumn,
                //                                header.PaymentMethodIDColumn,
                //                                header.RevisionNumberColumn,
                //                                header.StatusColumn,
                //                                header.ModifiedUserIDColumn,
                //                                header.ModifiedDateColumn,
                //                                header.ApproverUserIDColumn,
                //                                header.rowguidColumn
                //                                );

                //        DataSetHelper.RemoveColumns(detail, true, detail.SalesOrderDetailIDColumn,
                //                                detail.SalesOrderIDColumn,
                //                                detail.ProductLocationIDColumn,
                //                                detail.SaleQtyColumn,
                //                                detail.UnitPriceColumn,
                //                                detail.UnitPriceDiscountColumn,
                //                                detail.OrdinalNumberColumn,
                //                                detail.ModifiedUserIDColumn,
                //                                detail.ModifiedDateColumn,
                //                                detail.ActionColumn
                //                                );
                //        ds.Tables.Add(header);
                //        ds.Tables.Add(detail);
                //        ds.Tables.Add(card);
                //        Synchronize(objectName, ds, true);
                //        ds.Tables.Remove(detail);
                //        ds.Tables.Remove(card);

                //        DataSetHelper.RemoveColumns(header, true, header.SalesOrderIDColumn);
                //        Synchronize(objectName, ds, false);
                //        InitSynchronizedCheckedListBoxItem(item);
                //    }
                //    break;
                case ObjectNames.SalesOrderHeader:
                    SynchronizationManager.SynchronizeSalesOrder(0);
                    InitSynchronizedCheckedListBoxItem(item);
                    break;

                case ObjectNames.ProductLocation:
                    table = SynchronizationManager.GetSyncProductLocation(0, 0, GlobalVariable.BranchID, modifiedDate, DatabaseAction.Synchronize);
                    Synchronize(objectName, table, false);
                    InitSynchronizedCheckedListBoxItem(item);
                    break;

                case ObjectNames.Currency:
                    table = SynchronizationManager.GetSyncCurrency(string.Empty, modifiedDate, DatabaseAction.Synchronize);
                    Synchronize(objectName, table, false);
                    InitSynchronizedCheckedListBoxItem(item);
                    break;

                case ObjectNames.CardUnitRate:
                    table = SynchronizationManager.GetSyncCardUnitRate();
                    Synchronize(objectName, table, false);
                    InitSynchronizedCheckedListBoxItem(item);
                    break;

                case ObjectNames.CardDiscountSchema:
                    table = SynchronizationManager.GetSyncCardDiscountSchema();
                    Synchronize(objectName, table, false);
                    InitSynchronizedCheckedListBoxItem(item);
                    break;

                case ObjectNames.MyCompany:
                    var mycompany = SynchronizationManager.GetSyncMyCompany(0, modifiedDate, DatabaseAction.Synchronize);
                    if (mycompany.Count > 0)
                    {
                        var branch = BranchManager.Get(GlobalVariable.BranchID);
                        if (branch.Count > 0 && !branch[0].IsCompanyIDNull())
                        {
                            var company = PersonManager.GetCompany(branch[0].CompanyID);
                            if (company.Count > 0)
                            {
                                mycompany[0].MyCompanyName = company[0].Name;
                                mycompany[0].TaxCode       = company[0].TaxCode;
                                mycompany[0].DirectorName  = string.Empty;
                                mycompany[0].CountryCode   = company[0].CountryCode;
                                mycompany[0].City          = string.Empty;
                                mycompany[0].Address       = company[0].Address;
                                mycompany[0].Phone         = company[0].Phone;
                                mycompany[0].Fax           = company[0].Fax;
                                if (!company[0].IsBankIDNull())
                                {
                                    mycompany[0].BankID = company[0].BankID;
                                }
                                else
                                {
                                    mycompany[0].SetBankIDNull();
                                }
                                mycompany[0].BankAccountNumber = company[0].BankAccountNumber;
                            }
                        }
                    }
                    table = mycompany;
                    Synchronize(objectName, table, false);
                    InitSynchronizedCheckedListBoxItem(item);
                    break;

                case ObjectNames.Branch:
                    table = SynchronizationManager.GetSyncBranch(0, modifiedDate, DatabaseAction.Synchronize);
                    Synchronize(objectName, table, false);
                    InitSynchronizedCheckedListBoxItem(item);
                    break;

                case ObjectNames.User:
                    table = SynchronizationManager.GetSyncUser(0, GlobalVariable.BranchID, modifiedDate, DatabaseAction.Synchronize);
                    Synchronize(objectName, table, false);
                    InitSynchronizedCheckedListBoxItem(item);
                    break;

                case ObjectNames.UserPermission:
                    table = SynchronizationManager.GetSyncUserPermission(0, GlobalVariable.BranchID, modifiedDate, DatabaseAction.Synchronize);
                    Synchronize(objectName, table, false);
                    InitSynchronizedCheckedListBoxItem(item);
                    break;

                case ObjectNames.PaymentMethod:
                    table = SynchronizationManager.GetSyncPaymentMethod(0, modifiedDate, DatabaseAction.Synchronize);
                    Synchronize(objectName, table, false);
                    InitSynchronizedCheckedListBoxItem(item);
                    break;

                case ObjectNames.OperationType:
                    table = SynchronizationManager.GetOperationType();
                    Synchronize(objectName, table, false);
                    InitSynchronizedCheckedListBoxItem(item);
                    break;
                }
            }

            return(true);
        }
示例#3
0
        private void iCardGift_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (gridView.SelectedRowsCount != 1)
            {
                return;
            }

            try
            {
                Application.DoEvents();
                Cursor = Cursors.WaitCursor;

                var rowguid = ((DS_Sales.VW_SalesOrderHeaderRow)gridView.GetDataRow(OptionsGrid.SelectedRowHandle)).rowguid;
                var id      = ConvertHelper.ToInt32(OptionsGrid.SelectedRecordID);
                if (id == 0)
                {
                    return;
                }

                using (var frm = new frmCardGiftEdit())
                {
                    frm.IsOnline   = IsOnline;
                    frm.PrimaryKey = id;
                    if (frm.ShowDialog(this) != DialogResult.OK)
                    {
                        return;
                    }

                    if (frm.IsOnline)
                    {
                        using (var ds = new DataSet("root"))
                        {
                            var t1 = DataSetHelper.PackAlternationDataTable(frm.T_CardHandle);
                            var t2 = DataSetHelper.PackAlternationDataTable(frm.ds_Operation.T_Operation);
                            ds.Tables.Add(t1);
                            ds.Tables.Add(t2);
                            CardManager.SaveCardHandle(DataSetHelper.InnerBytesData(ds), BaseGlobalVariable.UserID);
                        }
                    }
                    else
                    {
                        SynchronizationManager.SynchronizeSalesOrder(id, DataSetHelper.PackAlternationDataTable(frm.T_CardHandle), DataSetHelper.PackAlternationDataTable(frm.ds_Operation.T_Operation));
                    }
                    BindGrid();
                    //SyncOrder(id, DataSetHelper.PackAlternationDataTable(frm.T_CardHandle), DataSetHelper.PackAlternationDataTable(frm.ds_Operation.T_Operation));

                    var serverSalesOrderID = SalesManager.FindSalesOrderID(rowguid);
                    if (serverSalesOrderID == 0)
                    {
                        throw new Exception("სერვერზე გადაგზავნილი ფაქტურა არ მოიძებნა");
                    }

                    SaveAndPrintAct(serverSalesOrderID);
                }
            }
            catch (Exception ex)
            {
                ExceptionHelper.Show(ex);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }