Exemplo n.º 1
0
        public ConnectResult_ENUM do_ConnectionDialog(string sTitle, ref bool bNewDatabase, NavigationButtons.Navigation nav, ref bool bCanceled, string myConnectionName)
        {
            bNewDatabase = false;
                switch (m_DBType)
                {
                    case eDBType.MYSQL:
                        if ((m_conData_MYSQL.m_DataSource.Length > 0) && (m_conData_MYSQL.m_DataBase.Length > 0))
                        {
                            ConnectionDialog = new ConnectionDialog(ConnectionDialog.ConnectionDialog_enum.EditLoginAndPassword, this, sTitle, nav);
                        }
                        else
                        {
                            ConnectionDialog = new ConnectionDialog(ConnectionDialog.ConnectionDialog_enum.EditAll, this, sTitle, nav);
                        }
                        break;

                    case eDBType.MSSQL:
                        if ((m_conData_MSSQL.m_DataSource.Length > 0) && (m_conData_MSSQL.m_DataBase.Length > 0))
                        {
                            ConnectionDialog = new ConnectionDialog(ConnectionDialog.ConnectionDialog_enum.EditLoginAndPassword, this, sTitle, nav);
                        }
                        else
                        {
                            ConnectionDialog = new ConnectionDialog(ConnectionDialog.ConnectionDialog_enum.EditAll, this, sTitle, nav);
                        }
                        break;

                    case eDBType.SQLITE:

                        SQLiteConnectionDialog = new SQLiteConnectionDialog(m_conData_SQLITE,this.RecentItemsFolder, this.BackupFolder, nav, myConnectionName);
                        break;

                    default:
                        MessageBox.Show("Error unknown eSQLType in function:  public ConnectResult_ENUM do_ConnectionDialog(string sTitle).");
                        break;
                }

            while (true)
            {

                if (m_DBType == eDBType.SQLITE)
                {
                    if (nav.bDoModal)
                    {
                        SQLiteConnectionDialog.ShowDialog(nav.parentForm);
                        this.BackupFolder = SQLiteConnectionDialog.BackupFolder;
                    }
                    else
                    {
                        SQLiteConnectionDialog.TopMost = true;
                        SQLiteConnectionDialog.Show();
                        while (nav.eExitResult== NavigationButtons.Navigation.eEvent.NOTHING)
                        {
                            Application.DoEvents();
                        }
                    }
                }
                else
                {
                    nav.ChildDialog = ConnectionDialog;
                    nav.ShowDialog();
                }
                if (nav.eExitResult == NavigationButtons.Navigation.eEvent.PREV)
                {
                    return ConnectResult_ENUM.CANCELED;
                }

                if ((nav.eExitResult == NavigationButtons.Navigation.eEvent.EXIT)|| (nav.eExitResult == NavigationButtons.Navigation.eEvent.CANCEL))
                {
                    bCanceled = true;
                    if (m_DBType == eDBType.SQLITE)
                    {
                        SQLiteConnectionDialog.Dispose();
                    }
                    else
                    {
                        ConnectionDialog.Dispose();
                    }
                    return ConnectResult_ENUM.CANCELED;
                }
                else if ((nav.eExitResult == NavigationButtons.Navigation.eEvent.NEXT)|| (nav.eExitResult == NavigationButtons.Navigation.eEvent.OK))
                {

                    try
                    {
                        if (m_DBType == eDBType.SQLITE)
                        {

                            if (!File.Exists(DataBase))
                            {

                                string sErr = null;
                                if (m_con_SQLite != null)
                                {
                                    m_con_SQLite.Dispose();
                                }
                                m_con_SQLite = new SQLiteConnection(ConnectionString);
                                //}
                                //else
                                //{
                                //    m_con_SQLite.ConnectionString = ConnectionString;
                                //}
                                //if (m_con_SQLite.ConnectionString.Length == 0)
                                //{
                                //    m_con_SQLite.ConnectionString = ConnectionString;
                                //}
                                if (Connect_ToServerOnly(ref sErr))
                                {
                                    if (m_DBType == eDBType.SQLITE)
                                    {
                                        try
                                        {
                                            SQLiteCommand cmd = m_con_SQLite.CreateCommand();
                                            cmd.CommandText = "PRAGMA foreign_keys = ON;";
                                            cmd.ExecuteNonQuery();
                                        }
                                        catch (Exception ex)
                                        {
                                            LogFile.Error.Show("ERROR:SQLite:PRAGMA foreign_keys = ON;! " + ex.Message);
                                        }
                                    }
                                    Disconnect();
                                    bNewDatabase = true;
                                }
                                else
                                {
                                    LogFile.Error.Show(sErr);
                                    continue;
                                }
                            }

                        }
                        else
                        {
                            bNewDatabase = ConnectionDialog.m_bNewDataBase;
                        }

                        if (this.CheckDataBaseConnection(nav.parentForm, sTitle))
                        {
                            if ((nav.eExitResult == NavigationButtons.Navigation.eEvent.NEXT) || (nav.eExitResult == NavigationButtons.Navigation.eEvent.OK))
                            {
                                return ConnectResult_ENUM.OK;
                            }
                            else if ((nav.eExitResult == NavigationButtons.Navigation.eEvent.NEXT) || (nav.eExitResult == NavigationButtons.Navigation.eEvent.OK))
                            {
                                ConnectionDialog.my_ConnectionDialog_enum = ConnectionDialog.ConnectionDialog_enum.SaveConnectionData;
                                ConnectionDialog.ShowDialog(nav.parentForm);
                                nav.eExitResult = ConnectionDialog.eExitEvent;
                                if ((nav.eExitResult == NavigationButtons.Navigation.eEvent.NEXT) || (nav.eExitResult == NavigationButtons.Navigation.eEvent.OK))
                                {
                                    return ConnectResult_ENUM.OK_SAVE;
                                }
                                return ConnectResult_ENUM.OK;
                            }
                        }
                        else
                        {
                            if (m_DBType != eDBType.SQLITE)
                            {
                                ConnectionDialog.my_ConnectionDialog_enum = ConnectionDialog.ConnectionDialog_enum.TryAgain_EditAll;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        if (m_DBType != eDBType.SQLITE)
                        {
                            ConnectionDialog.my_ConnectionDialog_enum = ConnectionDialog.ConnectionDialog_enum.TryAgain_EditAll;
                        }
                        else
                        {
                            LogFile.Error.Show("ERROR SQLITE:Excpetion = " + ex.Message);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public bool Write_ShopC_Items(NavigationButtons.Navigation xnav)
        {
            string Currency_Name = null;
            string Currency_Abbreviation = null;
            string Currency_Symbol = null;
            int Currency_Code = 0;
            int Currency_DecimalPlaces = 2;

            if (f_Currency.Get(myOrg.Default_Currency_ID, ref Currency_Abbreviation, ref Currency_Name, ref Currency_Symbol, ref Currency_Code, ref Currency_DecimalPlaces))
            {

                xnav.ChildDialog = new Form_Items_Samples(xnav, lngRPM.s_Shop_C.s);
                xnav.bDoModal = false;
                xnav.ShowDialog();
                if (xnav.eExitResult == NavigationButtons.Navigation.eEvent.NEXT)
                {
                    if (((Form_Items_Samples)xnav.ChildDialog).bAutoGenerateDemoSampleItems)
                    {
                        int iNumberOfGroupsInLevel3 = ((Form_Items_Samples)xnav.ChildDialog).iNumberOfGroupsInLevel3;
                        int iNumberOfGroupsInLevel2 = ((Form_Items_Samples)xnav.ChildDialog).iNumberOfGroupsInLevel2;
                        int iNumberOfGroupsInLevel1 = ((Form_Items_Samples)xnav.ChildDialog).iNumberOfGroupsInLevel1;
                        int iNumberOfItemsPerGroup = ((Form_Items_Samples)xnav.ChildDialog).iNumberOfItemsPerGroup;
                        int iNumberOfAll = ((Form_Items_Samples)xnav.ChildDialog).iNumberOffAll();

                        SampleDB_Price_ShopC_Item[] SampleDB_Price_ShopC_Item_List = new SampleDB_Price_ShopC_Item[iNumberOfAll];
                        int j = 0;
                        string ShopC_Item_Abbreviation = null;
                        string ShopC_Item_Name = null;
                        string sl3 = null;
                        string sl2 = null;
                        string sl1 = null;
                        int i1 = 0;
                        int i2 = 0;
                        int i3 = 0;
                        int ig = 0;
                        if (iNumberOfGroupsInLevel3 > 0)
                        {
                            for (i3 = 0; i3 < iNumberOfGroupsInLevel3; i3++)
                            {
                                string sln3 = "L3g" + i3.ToString();
                                sl3 = "." + sln3;
                                for (i2 = 0; i2 < iNumberOfGroupsInLevel2; i2++)
                                {
                                    string sln2 = sln3 + "L2g" + i2.ToString();
                                    sl2 = "." + sln2;
                                    for (i1 = 0; i1 < iNumberOfGroupsInLevel1; i1++)
                                    {
                                        string sln1 = sln3 + sln2 + "L1g" + i1.ToString();
                                        sl1 = "." + sln1;
                                        for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                                        {
                                            ShopC_Item_Abbreviation = lngRPMS.ShopC_Item_Abbreviation_SB.s + ig.ToString() + sln1;
                                            ShopC_Item_Name = lngRPMS.ShopC_Item_Name_Item.s + ig.ToString() + sln1;

                                            SampleDB_Price_ShopC_Item_List[j] = new SampleDB_Price_ShopC_Item(
                                                                           ShopC_Item_Name,
                                                                           ShopC_Item_Abbreviation,
                                                                           new int_v(1),
                                                                           sl1,
                                                                           sl2,
                                                                           sl3,
                                                                           lngRPMS.s_Piece.s,
                                                                           lngRPMS.s_PieceAbr.s,
                                                                           0,
                                                                           true,
                                                                           null,
                                                                           null,
                                                                           lngRPM.s_Description.s,
                                                                           180,
                                                                           60,
                                                                           10,
                                                                           null,
                                                                           -1,
                                                                           -1,
                                                                           null,
                                                                           null,
                                                                           true,
                                                                           lngRPMS.PriceList_Name.s,
                                                                           true,
                                                                           Currency_Abbreviation,
                                                                           Currency_Name,
                                                                           Currency_Symbol,
                                                                           Currency_Code,
                                                                           Currency_DecimalPlaces,
                                                                           null,
                                                                           null,
                                                                           new DateTime_v(DateTime.Now),
                                                                           null,
                                                                           "DDV 22%",
                                                                           0.22M,
                                                                           10M,
                                                                           new decimal_v(0)
                                                                           );

                                            j++;
                                        }
                                    }
                                    for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                                    {
                                        ShopC_Item_Abbreviation = lngRPMS.ShopC_Item_Abbreviation_SB.s + ig.ToString() + sln2;
                                        ShopC_Item_Name = lngRPMS.ShopC_Item_Name_Item.s + ig.ToString() + sln2;
                                        SampleDB_Price_ShopC_Item_List[j] = new SampleDB_Price_ShopC_Item(
                                                                       ShopC_Item_Name,
                                                                       ShopC_Item_Abbreviation,
                                                                       new int_v(1),
                                                                       sl2,
                                                                       sl3,
                                                                       null,
                                                                       lngRPMS.s_Piece.s,
                                                                       lngRPMS.s_PieceAbr.s,
                                                                       0,
                                                                       true,
                                                                       null,
                                                                       null,
                                                                       lngRPM.s_Description.s,
                                                                       180,
                                                                       60,
                                                                       10,
                                                                       null,
                                                                       -1,
                                                                       -1,
                                                                       null,
                                                                       null,
                                                                       true,
                                                                       lngRPMS.PriceList_Name.s,
                                                                       true,
                                                                       Currency_Abbreviation,
                                                                       Currency_Name,
                                                                       Currency_Symbol,
                                                                       Currency_Code,
                                                                       Currency_DecimalPlaces,
                                                                       null,
                                                                       null,
                                                                       new DateTime_v(DateTime.Now),
                                                                       null,
                                                                       "DDV 22%",
                                                                       0.22M,
                                                                       10M,
                                                                       new decimal_v(0)
                                                                       );
                                        j++;
                                    }

                                }
                                for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                                {

                                    ShopC_Item_Abbreviation = lngRPMS.ShopC_Item_Abbreviation_SB.s + ig.ToString() + sln3;
                                    ShopC_Item_Name = lngRPMS.ShopC_Item_Name_Item.s + ig.ToString() + sln3;
                                    SampleDB_Price_ShopC_Item_List[j] = new SampleDB_Price_ShopC_Item(
                                                                                                               ShopC_Item_Name,
                                                                                                               ShopC_Item_Abbreviation,
                                                                                                               new int_v(1),
                                                                                                               sl3,
                                                                                                               null,
                                                                                                               null,
                                                                                                               lngRPMS.s_Piece.s,
                                                                                                               lngRPMS.s_PieceAbr.s,
                                                                                                               0,
                                                                                                               true,
                                                                                                               null,
                                                                                                               null,
                                                                                                               lngRPM.s_Description.s,
                                                                                                               180,
                                                                                                               60,
                                                                                                               10,
                                                                                                               null,
                                                                                                               -1,
                                                                                                               -1,
                                                                                                               null,
                                                                                                               null,
                                                                                                               true,
                                                                                                               lngRPMS.PriceList_Name.s,
                                                                                                               true,
                                                                                                               Currency_Abbreviation,
                                                                                                               Currency_Name,
                                                                                                               Currency_Symbol,
                                                                                                               Currency_Code,
                                                                                                               Currency_DecimalPlaces,
                                                                                                               null,
                                                                                                               null,
                                                                                                               new DateTime_v(DateTime.Now),
                                                                                                               null,
                                                                                                               "DDV 22%",
                                                                                                               0.22M,
                                                                                                               10M,
                                                                                                               new decimal_v(0)
                                                                                                               ); j++;
                                }
                            }
                            for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                            {
                                ShopC_Item_Abbreviation = lngRPMS.ShopC_Item_Abbreviation_SB.s + ig.ToString() + "noL1noL2noL3";
                                ShopC_Item_Name = lngRPMS.ShopC_Item_Name_Item.s + ig.ToString() + "noL1noL2noL3";
                                SampleDB_Price_ShopC_Item_List[j] = new SampleDB_Price_ShopC_Item(
                                                                                                           ShopC_Item_Name,
                                                                                                           ShopC_Item_Abbreviation,
                                                                                                           new int_v(1),
                                                                                                           null,
                                                                                                           null,
                                                                                                           null,
                                                                                                           lngRPMS.s_Piece.s,
                                                                                                           lngRPMS.s_PieceAbr.s,
                                                                                                           0,
                                                                                                           true,
                                                                                                           null,
                                                                                                           null,
                                                                                                           lngRPM.s_Description.s,
                                                                                                           180,
                                                                                                           60,
                                                                                                           10,
                                                                                                           null,
                                                                                                           -1,
                                                                                                           -1,
                                                                                                           null,
                                                                                                           null,
                                                                                                           true,
                                                                                                           lngRPMS.PriceList_Name.s,
                                                                                                           true,
                                                                                                           Currency_Abbreviation,
                                                                                                           Currency_Name,
                                                                                                           Currency_Symbol,
                                                                                                           Currency_Code,
                                                                                                           Currency_DecimalPlaces,
                                                                                                           null,
                                                                                                           null,
                                                                                                           new DateTime_v(DateTime.Now),
                                                                                                           null,
                                                                                                           "DDV 22%",
                                                                                                           0.22M,
                                                                                                           10M,
                                                                                                           new decimal_v(0)
                                                                                                           ); j++;
                            }
                        }
                        else if (iNumberOfGroupsInLevel2 > 0)
                        {
                            for (i2 = 0; i2 < iNumberOfGroupsInLevel2; i2++)
                            {
                                sl2 = ".L2g" + i2.ToString();
                                for (i1 = 0; i1 < iNumberOfGroupsInLevel1; i1++)
                                {
                                    sl1 = ".L1g" + i1.ToString();
                                    for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                                    {
                                        ShopC_Item_Abbreviation = lngRPMS.ShopC_Item_Abbreviation_SB.s + ig.ToString() + sl2 + sl1;
                                        ShopC_Item_Name = lngRPMS.ShopC_Item_Name_Item.s + ig.ToString() + sl2 + sl1;
                                        SampleDB_Price_ShopC_Item_List[j] = new SampleDB_Price_ShopC_Item(
                                                                       ShopC_Item_Name,
                                                                       ShopC_Item_Abbreviation,
                                                                       new int_v(1),
                                                                       sl1,
                                                                       sl2,
                                                                       null,
                                                                       lngRPMS.s_Piece.s,
                                                                       lngRPMS.s_PieceAbr.s,
                                                                       0,
                                                                       true,
                                                                       null,
                                                                       null,
                                                                       lngRPM.s_Description.s,
                                                                       180,
                                                                       60,
                                                                       10,
                                                                       null,
                                                                       -1,
                                                                       -1,
                                                                       null,
                                                                       null,
                                                                       true,
                                                                       lngRPMS.PriceList_Name.s,
                                                                       true,
                                                                       Currency_Abbreviation,
                                                                       Currency_Name,
                                                                       Currency_Symbol,
                                                                       Currency_Code,
                                                                       Currency_DecimalPlaces,
                                                                       null,
                                                                       null,
                                                                       new DateTime_v(DateTime.Now),
                                                                       null,
                                                                       "DDV 22%",
                                                                       0.22M,
                                                                       10M,
                                                                       new decimal_v(0)
                                                                       );
                                        j++;
                                    }
                                }
                            }
                            for (i2 = 0; i2 < iNumberOfGroupsInLevel2; i2++)
                            {
                                sl2 = ".L2g" + i2.ToString() + "(...)";
                                for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                                {
                                    ShopC_Item_Abbreviation = lngRPMS.ShopC_Item_Abbreviation_SB.s + ig.ToString() + sl2;
                                    ShopC_Item_Name = lngRPMS.ShopC_Item_Name_Item.s + ig.ToString() + sl2;
                                    SampleDB_Price_ShopC_Item_List[j] = new SampleDB_Price_ShopC_Item(
                                                                   ShopC_Item_Name,
                                                                   ShopC_Item_Abbreviation,
                                                                   new int_v(1),
                                                                   sl2,
                                                                   null,
                                                                   null,
                                                                   lngRPMS.s_Piece.s,
                                                                   lngRPMS.s_PieceAbr.s,
                                                                   0,
                                                                   true,
                                                                   null,
                                                                   null,
                                                                   lngRPM.s_Description.s,
                                                                   180,
                                                                   60,
                                                                   10,
                                                                   null,
                                                                   -1,
                                                                   -1,
                                                                   null,
                                                                   null,
                                                                   true,
                                                                   lngRPMS.PriceList_Name.s,
                                                                   true,
                                                                   Currency_Abbreviation,
                                                                   Currency_Name,
                                                                   Currency_Symbol,
                                                                   Currency_Code,
                                                                   Currency_DecimalPlaces,
                                                                   null,
                                                                   null,
                                                                   new DateTime_v(DateTime.Now),
                                                                   null,
                                                                   "DDV 22%",
                                                                   0.22M,
                                                                   10M,
                                                                   new decimal_v(0)
                                                                   );
                                    j++;
                                }
                            }
                            sl2 = "(...)";
                            for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                            {
                                ShopC_Item_Abbreviation = lngRPMS.ShopC_Item_Abbreviation_SB.s + ig.ToString() + sl2;
                                ShopC_Item_Name = lngRPMS.ShopC_Item_Name_Item.s + ig.ToString() + sl2;
                                SampleDB_Price_ShopC_Item_List[j] = new SampleDB_Price_ShopC_Item(
                                                               ShopC_Item_Name,
                                                               ShopC_Item_Abbreviation,
                                                               new int_v(1),
                                                               null,
                                                               null,
                                                               null,
                                                               lngRPMS.s_Piece.s,
                                                               lngRPMS.s_PieceAbr.s,
                                                               0,
                                                               true,
                                                               null,
                                                               null,
                                                               lngRPM.s_Description.s,
                                                               180,
                                                               60,
                                                               10,
                                                               null,
                                                               -1,
                                                               -1,
                                                               null,
                                                               null,
                                                               true,
                                                               lngRPMS.PriceList_Name.s,
                                                               true,
                                                               Currency_Abbreviation,
                                                               Currency_Name,
                                                               Currency_Symbol,
                                                               Currency_Code,
                                                               Currency_DecimalPlaces,
                                                               null,
                                                               null,
                                                               new DateTime_v(DateTime.Now),
                                                               null,
                                                               "DDV 22%",
                                                               0.22M,
                                                               10M,
                                                               new decimal_v(0)
                                                               );

                                j++;
                            }
                        }
                        else if (iNumberOfGroupsInLevel1 > 0)
                        {
                            for (i1 = 0; i1 < iNumberOfGroupsInLevel1; i1++)
                            {
                                sl1 = ".L1g" + i1.ToString();
                                for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                                {
                                    ShopC_Item_Abbreviation = lngRPMS.ShopC_Item_Abbreviation_SB.s + ig.ToString() + sl1;
                                    ShopC_Item_Name = lngRPMS.ShopC_Item_Name_Item.s + ig.ToString() + sl1;
                                    SampleDB_Price_ShopC_Item_List[j] = new SampleDB_Price_ShopC_Item(
                                                                                                  ShopC_Item_Name,
                                                                                                  ShopC_Item_Abbreviation,
                                                                                                  new int_v(1),
                                                                                                  sl1,
                                                                                                  null,
                                                                                                  null,
                                                                                                  lngRPMS.s_Piece.s,
                                                                                                  lngRPMS.s_PieceAbr.s,
                                                                                                  0,
                                                                                                  true,
                                                                                                  null,
                                                                                                  null,
                                                                                                  lngRPM.s_Description.s,
                                                                                                  180,
                                                                                                  60,
                                                                                                  10,
                                                                                                  null,
                                                                                                  -1,
                                                                                                  -1,
                                                                                                  null,
                                                                                                  null,
                                                                                                  true,
                                                                                                  lngRPMS.PriceList_Name.s,
                                                                                                  true,
                                                                                                  Currency_Abbreviation,
                                                                                                  Currency_Name,
                                                                                                  Currency_Symbol,
                                                                                                  Currency_Code,
                                                                                                  Currency_DecimalPlaces,
                                                                                                  null,
                                                                                                  null,
                                                                                                  new DateTime_v(DateTime.Now),
                                                                                                  null,
                                                                                                  "DDV 22%",
                                                                                                  0.22M,
                                                                                                  10M,
                                                                                                  new decimal_v(0)
                                                                                                  );
                                    j++;
                                }
                            }
                            sl1 = "(...)";
                            for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                            {
                                ShopC_Item_Abbreviation = lngRPMS.ShopC_Item_Abbreviation_SB.s + ig.ToString() + sl1;
                                ShopC_Item_Name = lngRPMS.ShopC_Item_Name_Item.s + ig.ToString() + sl1;
                                SampleDB_Price_ShopC_Item_List[j] = new SampleDB_Price_ShopC_Item(
                                                                                              ShopC_Item_Name,
                                                                                              ShopC_Item_Abbreviation,
                                                                                              new int_v(1),
                                                                                              null,
                                                                                              null,
                                                                                              null,
                                                                                              lngRPMS.s_Piece.s,
                                                                                              lngRPMS.s_PieceAbr.s,
                                                                                              0,
                                                                                              true,
                                                                                              null,
                                                                                              null,
                                                                                              lngRPM.s_Description.s,
                                                                                              180,
                                                                                              60,
                                                                                              10,
                                                                                              null,
                                                                                              -1,
                                                                                              -1,
                                                                                              null,
                                                                                              null,
                                                                                              true,
                                                                                              lngRPMS.PriceList_Name.s,
                                                                                              true,
                                                                                              Currency_Abbreviation,
                                                                                              Currency_Name,
                                                                                              Currency_Symbol,
                                                                                              Currency_Code,
                                                                                              Currency_DecimalPlaces,
                                                                                              null,
                                                                                              null,
                                                                                              new DateTime_v(DateTime.Now),
                                                                                              null,
                                                                                              "DDV 22%",
                                                                                              0.22M,
                                                                                              10M,
                                                                                              new decimal_v(0)
                                                                                              );
                                j++;
                            }
                        }
                        else
                        {
                            sl1 = "(...)";
                            for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                            {
                                ShopC_Item_Abbreviation = lngRPMS.ShopC_Item_Abbreviation_SB.s + ig.ToString() + sl1;
                                ShopC_Item_Name = lngRPMS.ShopC_Item_Name_Item.s + ig.ToString() + sl1;
                                SampleDB_Price_ShopC_Item_List[j] = new SampleDB_Price_ShopC_Item(
                                                                                                                             ShopC_Item_Name,
                                                                                                                             ShopC_Item_Abbreviation,
                                                                                                                             new int_v(1),
                                                                                                                             null,
                                                                                                                             null,
                                                                                                                             null,
                                                                                                                             lngRPMS.s_Piece.s,
                                                                                                                             lngRPMS.s_PieceAbr.s,
                                                                                                                             0,
                                                                                                                             true,
                                                                                                                             null,
                                                                                                                             null,
                                                                                                                             lngRPM.s_Description.s,
                                                                                                                             180,
                                                                                                                             60,
                                                                                                                             10,
                                                                                                                             null,
                                                                                                                             -1,
                                                                                                                             -1,
                                                                                                                             null,
                                                                                                                             null,
                                                                                                                             true,
                                                                                                                             lngRPMS.PriceList_Name.s,
                                                                                                                             true,
                                                                                                                             Currency_Abbreviation,
                                                                                                                             Currency_Name,
                                                                                                                             Currency_Symbol,
                                                                                                                             Currency_Code,
                                                                                                                             Currency_DecimalPlaces,
                                                                                                                             null,
                                                                                                                             null,
                                                                                                                             new DateTime_v(DateTime.Now),
                                                                                                                             null,
                                                                                                                             "DDV 22%",
                                                                                                                             0.22M,
                                                                                                                             10M,
                                                                                                                             new decimal_v(0)
                                                                                                                             ); j++;
                            }
                        }
                        //{new
                        if (j != iNumberOfAll)
                        {
                            LogFile.Error.Show("ERROR:SampleDB:Write_ShopB_Items:Calculated number of items " + iNumberOfAll.ToString() + " is not equal to iterating number j in loop:" + j.ToString());
                        }
                        int k = 0;
                        int SampleDB_Price_ShopC_Item_List_Count = SampleDB_Price_ShopC_Item_List.Count();
                        ProgressForm.Progress_Thread progress = new ProgressForm.Progress_Thread();
                        progress.sLabel1 = lngRPMS.s_WriteItemsToDatabase.s + SampleDB_Price_ShopC_Item_List_Count.ToString();
                        progress.Start();
                        f_Expiry.Expiry_v expiry_v = new f_Expiry.Expiry_v();
                        f_Warranty.Warranty_v warranty_v = new f_Warranty.Warranty_v();
                        f_Expiry.Expiry_v xexpiry_v = null;
                        f_Warranty.Warranty_v xwarranty_v = null;
                        for (k = 0; k < SampleDB_Price_ShopC_Item_List_Count; k++)
                        {
                            xexpiry_v = null;
                            xwarranty_v = null;
                            SampleDB_Price_ShopC_Item sample_ShopC_Item = SampleDB_Price_ShopC_Item_List[k];
                            if (sample_ShopC_Item.ShopC_Item_Expiry_ExpectedShelfLifeInDays >= 0)
                            {
                                expiry_v.ExpectedShelfLifeInDays = sample_ShopC_Item.ShopC_Item_Expiry_ExpectedShelfLifeInDays;
                                expiry_v.DiscardBeforeExpiryDateInDays = sample_ShopC_Item.ShopC_Item_Expiry_DiscardBeforeExpiryDateInDays;
                                expiry_v.SaleBeforeExpiryDateInDays = sample_ShopC_Item.ShopC_Item_Expiry_SaleBeforeExpiryDateInDays;
                                expiry_v.ExpiryDescription = sample_ShopC_Item.ShopC_Item_Expiry_ExpiryDescription;
                                xexpiry_v = expiry_v;

                            }
                            if (sample_ShopC_Item.ShopC_Item_Warranty_WarrantyDuration >= 0)
                            {
                                warranty_v.WarrantyDuration = sample_ShopC_Item.ShopC_Item_Warranty_WarrantyDuration;
                                warranty_v.WarrantyDurationType = sample_ShopC_Item.ShopC_Item_Warranty_WarrantyDurationType;
                                warranty_v.WarrantyConditions = sample_ShopC_Item.ShopC_Item_Warranty_WarrantyConditions;
                                xwarranty_v = warranty_v;
                            }

                            if (f_Item.Get(sample_ShopC_Item.ShopC_Item_Name,
                                           sample_ShopC_Item.ShopC_Item_UniqueName,
                                           sample_ShopC_Item.ShopC_Item_ToOffer,
                                           sample_ShopC_Item.ShopC_Item_Image,
                                           sample_ShopC_Item.ShopC_Item_Code,
                                           "komad",
                                           "kom.",
                                           0,
                                           true,
                                           "Artikli kot komadi.",
                                           null,
                                           null,
                                           xexpiry_v,
                                           xwarranty_v,
                                           sample_ShopC_Item.ShopC_Item_ParentGroup1,
                                           sample_ShopC_Item.ShopC_Item_ParentGroup2,
                                           sample_ShopC_Item.ShopC_Item_ParentGroup3,
                                           ref sample_ShopC_Item.ShopC_Item_Unit_ID,
                                           ref sample_ShopC_Item.ShopC_Price_Item_Item_ID
                                           ))
                            {

                                if (f_PriceList.Get(sample_ShopC_Item.ShopC_Price_Item_PriceList_Name,
                                                    sample_ShopC_Item.ShopC_Price_Item_PriceList_valid,
                                                    myOrg.Default_Currency_ID,
                                                    sample_ShopC_Item.ShopC_Price_Item_PriceList_ValidFrom_v,
                                                    sample_ShopC_Item.ShopC_Price_Item_PriceList_ValidTo_v,
                                                    sample_ShopC_Item.ShopC_Price_Item_PriceList_CreationDate_v,
                                                    sample_ShopC_Item.ShopC_Price_Item_PriceList_Description,
                                                    ref sample_ShopC_Item.ShopC_Price_Item_PriceList_ID))
                                {
                                    if (f_Taxation.Get(sample_ShopC_Item.ShopC_Price_Item_TaxationName,
                                                       sample_ShopC_Item.ShopC_Price_Item_TaxationRate,
                                                       ref sample_ShopC_Item.ShopC_Price_Item_Taxation_ID))
                                    {

                                        if (f_Price_Item.Get(sample_ShopC_Item.ShopC_Price_Item_RetailPricePerUnit,
                                                             sample_ShopC_Item.ShopC_Price_Item_Discount_v,
                                                             sample_ShopC_Item.ShopC_Price_Item_Taxation_ID,
                                                             sample_ShopC_Item.ShopC_Price_Item_Item_ID,
                                                             sample_ShopC_Item.ShopC_Price_Item_PriceList_ID,
                                                             ref sample_ShopC_Item.ShopC_Price_Item_ID
                                                             ))
                                        {
                                            if (k % 5 == 0)
                                            {
                                                GC.Collect();
                                                int iPercent = ((int)(k * 100) / SampleDB_Price_ShopC_Item_List_Count);
                                                progress.Message(null, lngRPMS.s_ItemsWrittenToDB.s + " " + k.ToString(), lngRPMS.s_JobInPercentDone.s + " " + iPercent.ToString() +"%", iPercent);
                                            }
                                            if (progress.bCancel || progress.bEnd)
                                            {
                                                return true;
                                            }
                                        }
                                        else
                                        {
                                            progress.End();
                                            return false;
                                        }
                                    }
                                    else
                                    {
                                        progress.End();
                                        return false;
                                    }
                                }
                                else
                                {
                                    progress.End();
                                    return false;
                                }
                            }
                            else
                            {
                                progress.End();
                                return false;
                            }
                            SampleDB_Price_ShopC_Item_List[k] = null;
                            sample_ShopC_Item = null;
                        }
                        progress.End();
                    }
                }
                return true;
            }
            else
            {
                return false;
            }
        }
Exemplo n.º 3
0
        private static DBConnection.eDBType Get_DBType(ref string DataBaseType, NavigationButtons.Navigation xnav, bool bShowDialog, ref bool bCanceled)
        {
            if (DataBaseType == null)
            {
                DataBaseType = "SQLITE";
            }

            xnav.ChildDialog = new Form_GetDBType(DataBaseType, xnav);
            xnav.ShowDialog();
            if ((xnav.eExitResult == NavigationButtons.Navigation.eEvent.NEXT)|| (xnav.eExitResult == NavigationButtons.Navigation.eEvent.OK))
            {
                switch (((Form_GetDBType)xnav.ChildDialog).m_DBType)
                {
                    case DBConnection.eDBType.SQLITE:
                        DataBaseType = "SQLITE";
                        break;
                    case DBConnection.eDBType.MSSQL:
                        DataBaseType = "MSSQL";
                        break;
                    case DBConnection.eDBType.MYSQL:
                        DataBaseType = "MYSQL";
                        break;
                }
                return ((Form_GetDBType)xnav.ChildDialog).m_DBType;
            }
            else
            {
                bCanceled = true;
                return m_DBType;
            }
        }
Exemplo n.º 4
0
        internal bool MyOrgSampleShowDialog(ref bool bCanceled, NavigationButtons.Navigation xnav, Icon oIcon)
        {
            start:
            if (xnav.LastStartupDialog_TYPE.Equals("Tangenta.Form_Select_DefaultCurrency"))
            {
                Form_EditMyOrgSampleData fedt = new Form_EditMyOrgSampleData(this, xnav, oIcon);
                xnav.ChildDialog = fedt;
                xnav.ShowDialog();
                if ((xnav.eExitResult == NavigationButtons.Navigation.eEvent.NEXT) || (xnav.eExitResult == NavigationButtons.Navigation.eEvent.OK))
                {
                    return true;
                }
                else if (xnav.eExitResult == NavigationButtons.Navigation.eEvent.PREV)
                {
                    goto start;
                }
            }
            else
            {
                Country_ISO_3166.ISO_3166_Table myISO_3166_Table = new Country_ISO_3166.ISO_3166_Table();
                string DefaultCountry = null;
                if (DynSettings.LanguageID == DynSettings.Slovensko_ID)
                {
                    DefaultCountry = "Slovenija";
                }
            select_country:
                Country_ISO_3166.Form_Select_Country_ISO_3166 frmsel_country = new Country_ISO_3166.Form_Select_Country_ISO_3166(myISO_3166_Table.dt_ISO_3166, DefaultCountry, lngRPMS.s_SelectCountryWhereYouPayTaxes.s, xnav);
                xnav.ChildDialog = frmsel_country;
                xnav.ShowDialog();
                if (xnav.eExitResult == NavigationButtons.Navigation.eEvent.PREV)
                {
                    bCanceled = true;
                    return false;
                }
                if (xnav.eExitResult == NavigationButtons.Navigation.eEvent.EXIT)
                {
                    bCanceled = true;
                    return true;
                }
                else if ((xnav.eExitResult == NavigationButtons.Navigation.eEvent.NEXT)||(xnav.eExitResult == NavigationButtons.Navigation.eEvent.OK))
                {
                    myOrgSample.SetCountry(frmsel_country);
                    Form_EditMyOrgSampleData fedt = new Form_EditMyOrgSampleData(this, xnav, oIcon);
                    xnav.ChildDialog = fedt;
                    xnav.ShowDialog();
                    if (xnav.eExitResult == NavigationButtons.Navigation.eEvent.PREV)
                    {
                        fedt.Dispose();
                        goto select_country;
                    }
                    if ((xnav.eExitResult == NavigationButtons.Navigation.eEvent.NEXT) || (xnav.eExitResult == NavigationButtons.Navigation.eEvent.OK))
                    {
                        return true;
                    }

                }
            }
            bCanceled = true;
            return false;
        }
Exemplo n.º 5
0
        public bool Write_ShopB_Items(NavigationButtons.Navigation xnav)
        {
            string Currency_Name = null;
            string Currency_Abbreviation = null;
            string Currency_Symbol = null;
            int Currency_Code = 0;
            int Currency_DecimalPlaces = 2;

            if (f_Currency.Get(myOrg.Default_Currency_ID, ref Currency_Abbreviation, ref Currency_Name, ref Currency_Symbol, ref Currency_Code, ref Currency_DecimalPlaces))
            {
                xnav.ChildDialog = new Form_Items_Samples(xnav, lngRPM.s_Shop_B.s);
                xnav.bDoModal = false;
                xnav.ShowDialog();
                if (xnav.eExitResult == NavigationButtons.Navigation.eEvent.NEXT)
                {
                    if (((Form_Items_Samples)xnav.ChildDialog).bAutoGenerateDemoSampleItems)
                    {
                        int iNumberOfGroupsInLevel3 = ((Form_Items_Samples)xnav.ChildDialog).iNumberOfGroupsInLevel3;
                        int iNumberOfGroupsInLevel2 = ((Form_Items_Samples)xnav.ChildDialog).iNumberOfGroupsInLevel2;
                        int iNumberOfGroupsInLevel1 = ((Form_Items_Samples)xnav.ChildDialog).iNumberOfGroupsInLevel1;
                        int iNumberOfItemsPerGroup = ((Form_Items_Samples)xnav.ChildDialog).iNumberOfItemsPerGroup;
                        int iNumberOfAll = ((Form_Items_Samples)xnav.ChildDialog).iNumberOffAll();
                        SampleDB_Price_ShopB_Item[] SampleDB_Price_ShopB_Item_List = new SampleDB_Price_ShopB_Item[iNumberOfAll];
                        int j = 0;
                        string ShopB_Item_Abbreviation = null;
                        string ShopB_Item_Name = null;
                        string sl3 = null;
                        string sl2 = null;
                        string sl1 = null;
                        int i1 = 0;
                        int i2 = 0;
                        int i3 = 0;
                        int ig = 0;
                        if (iNumberOfGroupsInLevel3 > 0)
                        {
                            for (i3 = 0; i3 < iNumberOfGroupsInLevel3; i3++)
                            {
                                string sln3 = "L3g" + i3.ToString();
                                sl3 = "." + sln3;
                                for (i2 = 0; i2 < iNumberOfGroupsInLevel2; i2++)
                                {
                                    string sln2 = sln3+"L2g" + i2.ToString();
                                    sl2 = "." + sln2;
                                    for (i1 = 0; i1 < iNumberOfGroupsInLevel1; i1++)
                                    {
                                        string sln1 = sln3 + sln2+ "L1g" + i1.ToString();
                                        sl1 = "."+ sln1;
                                        for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                                        {
                                            ShopB_Item_Abbreviation = lngRPMS.ShopB_Item_Abbreviation_SB.s + ig.ToString() + sln1;
                                            ShopB_Item_Name = lngRPMS.ShopB_Item_Name_Item.s + ig.ToString() + sln1;
                                            SampleDB_Price_ShopB_Item_List[j] = new SampleDB_Price_ShopB_Item(ShopB_Item_Name,
                                                                    ShopB_Item_Abbreviation,
                                                                    true,
                                                                    null,
                                                                    null,
                                                                    sl1,
                                                                    sl2,
                                                                    sl3,
                                                                    lngRPMS.PriceList_Name.s,
                                                                    true,
                                                                    null,
                                                                    null,
                                                                    new DateTime_v(DateTime.Now),
                                                                    lngRPMS.PriceList_Description.s,
                                                                    Currency_Abbreviation,
                                                                    Currency_Name,
                                                                    Currency_Symbol,
                                                                    Currency_Code,
                                                                    Currency_DecimalPlaces,
                                                                    "DDV 22%",
                                                                    0.22M,
                                                                    2,
                                                                    null);
                                            j++;
                                        }
                                    }
                                    for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                                    {
                                        ShopB_Item_Abbreviation = lngRPMS.ShopB_Item_Abbreviation_SB.s + ig.ToString() + sln2;
                                        ShopB_Item_Name = lngRPMS.ShopB_Item_Name_Item.s + ig.ToString() + sln2;
                                        SampleDB_Price_ShopB_Item_List[j] = new SampleDB_Price_ShopB_Item(ShopB_Item_Name,
                                                                ShopB_Item_Abbreviation,
                                                                true,
                                                                null,
                                                                null,
                                                                sl2,
                                                                sl3,
                                                                null,
                                                                lngRPMS.PriceList_Name.s,
                                                                true,
                                                                null,
                                                                null,
                                                                new DateTime_v(DateTime.Now),
                                                                lngRPMS.PriceList_Description.s,
                                                                Currency_Abbreviation,
                                                                Currency_Name,
                                                                Currency_Symbol,
                                                                Currency_Code,
                                                                Currency_DecimalPlaces,
                                                                "DDV 22%",
                                                                0.22M,
                                                                2,
                                                                null);
                                        j++;
                                    }

                                }
                                for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                                {

                                    ShopB_Item_Abbreviation = lngRPMS.ShopB_Item_Abbreviation_SB.s + ig.ToString() + sln3;
                                    ShopB_Item_Name = lngRPMS.ShopB_Item_Name_Item.s + ig.ToString() + sln3;
                                    SampleDB_Price_ShopB_Item_List[j] = new SampleDB_Price_ShopB_Item(ShopB_Item_Name,
                                                        ShopB_Item_Abbreviation,
                                                        true,
                                                        null,
                                                        null,
                                                        sl3,
                                                        null,
                                                        null,
                                                        lngRPMS.PriceList_Name.s,
                                                        true,
                                                        null,
                                                        null,
                                                        new DateTime_v(DateTime.Now),
                                                        lngRPMS.PriceList_Description.s,
                                                        Currency_Abbreviation,
                                                        Currency_Name,
                                                        Currency_Symbol,
                                                        Currency_Code,
                                                        Currency_DecimalPlaces,
                                                        "DDV 22%",
                                                        0.22M,
                                                        2,
                                                        null);
                                    j++;
                                }
                            }
                            for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                            {
                                ShopB_Item_Abbreviation = lngRPMS.ShopB_Item_Abbreviation_SB.s + ig.ToString() + "noL1noL2noL3";
                                ShopB_Item_Name = lngRPMS.ShopB_Item_Name_Item.s + ig.ToString() + "noL1noL2noL3";
                                SampleDB_Price_ShopB_Item_List[j] = new SampleDB_Price_ShopB_Item(ShopB_Item_Name,
                                                        ShopB_Item_Abbreviation,
                                                        true,
                                                        null,
                                                        null,
                                                        null,
                                                        null,
                                                        null,
                                                        lngRPMS.PriceList_Name.s,
                                                        true,
                                                        null,
                                                        null,
                                                        new DateTime_v(DateTime.Now),
                                                        lngRPMS.PriceList_Description.s,
                                                        Currency_Abbreviation,
                                                        Currency_Name,
                                                        Currency_Symbol,
                                                        Currency_Code,
                                                        Currency_DecimalPlaces,
                                                        "DDV 22%",
                                                        0.22M,
                                                        2,
                                                        null);
                                j++;
                            }
                        }
                        else if (iNumberOfGroupsInLevel2 > 0)
                        {
                            for (i2 = 0; i2 < iNumberOfGroupsInLevel2; i2++)
                            {
                                sl2 = ".L2g" + i2.ToString();
                                for (i1 = 0; i1 < iNumberOfGroupsInLevel1; i1++)
                                {
                                    sl1 = ".L1g" + i1.ToString();
                                    for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                                    {
                                        ShopB_Item_Abbreviation = lngRPMS.ShopB_Item_Abbreviation_SB.s + ig.ToString() + sl2 + sl1;
                                        ShopB_Item_Name = lngRPMS.ShopB_Item_Name_Item.s + ig.ToString() +  sl2 + sl1;
                                        SampleDB_Price_ShopB_Item_List[j] = new SampleDB_Price_ShopB_Item(ShopB_Item_Name,
                                                                ShopB_Item_Abbreviation,
                                                                true,
                                                                null,
                                                                null,
                                                                sl1,
                                                                sl2,
                                                                null,
                                                                lngRPMS.PriceList_Name.s,
                                                                true,
                                                                null,
                                                                null,
                                                                new DateTime_v(DateTime.Now),
                                                                lngRPMS.PriceList_Description.s,
                                                                Currency_Abbreviation,
                                                                Currency_Name,
                                                                Currency_Symbol,
                                                                Currency_Code,
                                                                Currency_DecimalPlaces,
                                                                "DDV 22%",
                                                                0.22M,
                                                                2,
                                                                null);
                                        j++;
                                    }
                                }
                            }
                            for (i2 = 0; i2 < iNumberOfGroupsInLevel2; i2++)
                            {
                                sl2 = ".L2g" + i2.ToString() + "(...)";
                                for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                                {
                                    ShopB_Item_Abbreviation = lngRPMS.ShopB_Item_Abbreviation_SB.s + ig.ToString() + sl2;
                                    ShopB_Item_Name = lngRPMS.ShopB_Item_Name_Item.s + ig.ToString() + sl2;
                                    SampleDB_Price_ShopB_Item_List[j] = new SampleDB_Price_ShopB_Item(ShopB_Item_Name,
                                                            ShopB_Item_Abbreviation,
                                                            true,
                                                            null,
                                                            null,
                                                            sl2,
                                                            null,
                                                            null,
                                                            lngRPMS.PriceList_Name.s,
                                                            true,
                                                            null,
                                                            null,
                                                            new DateTime_v(DateTime.Now),
                                                            lngRPMS.PriceList_Description.s,
                                                            Currency_Abbreviation,
                                                            Currency_Name,
                                                            Currency_Symbol,
                                                            Currency_Code,
                                                            Currency_DecimalPlaces,
                                                            "DDV 22%",
                                                            0.22M,
                                                            2,
                                                            null);
                                    j++;
                                }
                            }
                            sl2 = "(...)";
                            for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                            {
                                ShopB_Item_Abbreviation = lngRPMS.ShopB_Item_Abbreviation_SB.s + ig.ToString() + sl2;
                                ShopB_Item_Name = lngRPMS.ShopB_Item_Name_Item.s + ig.ToString() + sl2;
                                SampleDB_Price_ShopB_Item_List[j] = new SampleDB_Price_ShopB_Item(ShopB_Item_Name,
                                                        ShopB_Item_Abbreviation,
                                                        true,
                                                        null,
                                                        null,
                                                        null,
                                                        null,
                                                        null,
                                                        lngRPMS.PriceList_Name.s,
                                                        true,
                                                        null,
                                                        null,
                                                        new DateTime_v(DateTime.Now),
                                                        lngRPMS.PriceList_Description.s,
                                                        Currency_Abbreviation,
                                                        Currency_Name,
                                                        Currency_Symbol,
                                                        Currency_Code,
                                                        Currency_DecimalPlaces,
                                                        "DDV 22%",
                                                        0.22M,
                                                        2,
                                                        null);
                                j++;
                            }
                        }
                        else if (iNumberOfGroupsInLevel1 > 0)
                        {
                            for (i1 = 0; i1 < iNumberOfGroupsInLevel1; i1++)
                            {
                                sl1 = ".L1g" + i1.ToString();
                                for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                                {
                                    ShopB_Item_Abbreviation = lngRPMS.ShopB_Item_Abbreviation_SB.s + ig.ToString() + sl1;
                                    ShopB_Item_Name = lngRPMS.ShopB_Item_Name_Item.s + ig.ToString() + sl1;
                                    SampleDB_Price_ShopB_Item_List[j] = new SampleDB_Price_ShopB_Item(ShopB_Item_Name,
                                                            ShopB_Item_Abbreviation,
                                                            true,
                                                            null,
                                                            null,
                                                            sl1,
                                                            null,
                                                            null,
                                                            lngRPMS.PriceList_Name.s,
                                                            true,
                                                            null,
                                                            null,
                                                            new DateTime_v(DateTime.Now),
                                                            lngRPMS.PriceList_Description.s,
                                                            Currency_Abbreviation,
                                                            Currency_Name,
                                                            Currency_Symbol,
                                                            Currency_Code,
                                                            Currency_DecimalPlaces,
                                                            "DDV 22%",
                                                            0.22M,
                                                            2,
                                                            null);
                                    j++;
                                }
                            }
                            sl1 = "(...)";
                            for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                            {
                                ShopB_Item_Abbreviation = lngRPMS.ShopB_Item_Abbreviation_SB.s + ig.ToString() + sl1;
                                ShopB_Item_Name = lngRPMS.ShopB_Item_Name_Item.s + ig.ToString() + sl1;
                                SampleDB_Price_ShopB_Item_List[j] = new SampleDB_Price_ShopB_Item(ShopB_Item_Name,
                                                        ShopB_Item_Abbreviation,
                                                        true,
                                                        null,
                                                        null,
                                                        null,
                                                        null,
                                                        null,
                                                        lngRPMS.PriceList_Name.s,
                                                        true,
                                                        null,
                                                        null,
                                                        new DateTime_v(DateTime.Now),
                                                        lngRPMS.PriceList_Description.s,
                                                        Currency_Abbreviation,
                                                        Currency_Name,
                                                        Currency_Symbol,
                                                        Currency_Code,
                                                        Currency_DecimalPlaces,
                                                        "DDV 22%",
                                                        0.22M,
                                                        2,
                                                        null);
                                j++;
                            }
                        }
                        else
                        {
                            sl1 = "(...)";
                            for (ig = 0; ig < iNumberOfItemsPerGroup; ig++)
                            {
                                ShopB_Item_Abbreviation = lngRPMS.ShopB_Item_Abbreviation_SB.s + ig.ToString() + sl1;
                                ShopB_Item_Name = lngRPMS.ShopB_Item_Name_Item.s + ig.ToString() + sl1;
                                SampleDB_Price_ShopB_Item_List[j] = new SampleDB_Price_ShopB_Item(ShopB_Item_Name,
                                                        ShopB_Item_Abbreviation,
                                                        true,
                                                        null,
                                                        null,
                                                        null,
                                                        null,
                                                        null,
                                                        lngRPMS.PriceList_Name.s,
                                                        true,
                                                        null,
                                                        null,
                                                        new DateTime_v(DateTime.Now),
                                                        lngRPMS.PriceList_Description.s,
                                                        Currency_Abbreviation,
                                                        Currency_Name,
                                                        Currency_Symbol,
                                                        Currency_Code,
                                                        Currency_DecimalPlaces,
                                                        "DDV 22%",
                                                        0.22M,
                                                        2,
                                                        null);
                                j++;
                            }
                        }
                        //{new
                        if (j!= iNumberOfAll)
                        {
                            LogFile.Error.Show("ERROR:SampleDB:Write_ShopB_Items:Calculated number of items " + iNumberOfAll.ToString() + " is not equal to iterating number j in loop:" + j.ToString());
                        }
                        int k = 0;
                        int SampleDB_Price_ShopB_Item_List_Count = SampleDB_Price_ShopB_Item_List.Count();
                        ProgressForm.Progress_Thread progress = new ProgressForm.Progress_Thread();
                        progress.sLabel1 = lngRPMS.s_WriteItemsToDatabase.s + SampleDB_Price_ShopB_Item_List_Count.ToString();
                        progress.Start();
                        for (k=0;k<SampleDB_Price_ShopB_Item_List_Count;k++)
                        {
                            SampleDB_Price_ShopB_Item sample_ShopB_Item = SampleDB_Price_ShopB_Item_List[k];
                            if (f_SimpleItem.Get(sample_ShopB_Item.ShopB_Item_Name,
                                                    sample_ShopB_Item.ShopB_Item_Abbreviation,
                                                    sample_ShopB_Item.ShopB_Item_bToOffer,
                                                    sample_ShopB_Item.ShopB_Item_Image,
                                                    sample_ShopB_Item.ShopB_Item_Code_v,
                                                    sample_ShopB_Item.ShopB_Item_ParentGroup1,
                                                    sample_ShopB_Item.ShopB_Item_ParentGroup2,
                                                    sample_ShopB_Item.ShopB_Item_ParentGroup3,
                                                    ref sample_ShopB_Item.ShopB_Item_ID))
                            {
                                if (f_PriceList.Get(sample_ShopB_Item.PriceList_Name,
                                                    sample_ShopB_Item.PriceList_valid,
                                                    myOrg.Default_Currency_ID,
                                                    sample_ShopB_Item.PriceList_ValidFrom_v,
                                                    sample_ShopB_Item.PriceList_ValidTo_v,
                                                    sample_ShopB_Item.PriceList_CreationDate_v,
                                                    sample_ShopB_Item.PriceList_Description,
                                                    ref sample_ShopB_Item.PriceList_ID))
                                {
                                    if (f_Taxation.Get(sample_ShopB_Item.TaxationName,
                                                       sample_ShopB_Item.TaxationRate,
                                                       ref sample_ShopB_Item.Taxation_ID))
                                    {
                                        if (f_Price_SimpleItem.Get(sample_ShopB_Item.RetailShopB_ItemPrice,
                                                                   sample_ShopB_Item.Discount_v,
                                                                   sample_ShopB_Item.Taxation_ID,
                                                                   sample_ShopB_Item.ShopB_Item_ID,
                                                                   sample_ShopB_Item.PriceList_ID,
                                                                   ref sample_ShopB_Item.Price_ShopB_Item_ID
                                                                   ))
                                        {
                                            if (k % 5 == 0)
                                            {
                                                GC.Collect();
                                                int iPercent = ((int)(k * 100) / SampleDB_Price_ShopB_Item_List_Count);
                                                progress.Message(null, lngRPMS.s_ItemsWrittenToDB.s+" "+ k.ToString(),lngRPMS.s_JobInPercentDone.s + " " + iPercent.ToString()+"%", iPercent);
                                            }
                                            if (progress.bCancel|| progress.bEnd)
                                            {
                                                return true;
                                            }
                                        }
                                        else
                                        {
                                            progress.End();
                                            return false;
                                        }
                                    }
                                    else
                                    {
                                        progress.End();
                                        return false;
                                    }
                                }
                                else
                                {
                                    progress.End();
                                    return false;
                                }
                            }
                            else
                            {
                                progress.End();
                                return false;
                            }
                            SampleDB_Price_ShopB_Item_List[k] = null;
                            sample_ShopB_Item = null;
                        }
                        progress.End();
                    }
                }
                return true;
            }
            else
            {
                return false;
            }
        }
Exemplo n.º 6
0
 private bool CheckInsertSampleData(startup myStartup, NavigationButtons.Navigation xnav)
 {
     Form_CheckInsertSampleData frmdlg = new Form_CheckInsertSampleData(myStartup,xnav);
     xnav.ChildDialog = frmdlg;
     xnav.ShowDialog();
     return myStartup.bInsertSampleData;
 }
Exemplo n.º 7
0
        internal bool CheckDBVersion(startup myStartup, object oData,NavigationButtons.Navigation xnav, ref string Err)
        {
            bool bResult = false;
            switch (myStartup.eGetDBSettings_Result)
            {

                case fs.enum_GetDBSettings.DBSettings_OK:
                    bResult = CheckDataBaseVersion(myStartup, ref Err);
                    if (bResult)
                    {
                        if (Program.bFirstTimeInstallation)
                        {
                            bResult = InsertSampleData(myStartup, xnav, ref Err);
                            if (xnav.eExitResult == Navigation.eEvent.PREV)
                            {
                                goto do_Form_DBSettings;
                            }
                        }
                    }
                    return bResult;

                case fs.enum_GetDBSettings.No_Data_Rows:
                    //No CheckDataBaseVersion is needed because Database was allready created and its version has not been written to DBSettings table
             do_Form_DBSettings:

                    xnav.ChildDialog = new Form_DBSettings(xnav, Program.AdministratorLockedPassword, Program.MultiuserOperationWithLogin, Program.StockCheckAtStartup);
                    xnav.ShowDialog();
                    Program.AdministratorLockedPassword = ((Form_DBSettings)xnav.ChildDialog).AdministratorLockedPassword;
                    Program.MultiuserOperationWithLogin = ((Form_DBSettings)xnav.ChildDialog).MultiuserOperationWithLogin;
                    Program.StockCheckAtStartup = ((Form_DBSettings)xnav.ChildDialog).StockCheckAtStartup;
                    switch (xnav.eExitResult)
                    {
                        case Navigation.eEvent.NEXT:
                            bResult = InsertSampleData(myStartup, xnav, ref Err);
                            if (xnav.eExitResult == Navigation.eEvent.PREV)
                            {
                                if (xnav.LastStartupDialog_TYPE.Equals("Tangenta.Form_CheckInsertSampleData"))
                                {
                                    goto do_Form_DBSettings;
                                }
                            }
                            return bResult;

                        case Navigation.eEvent.PREV:
                            myStartup.eNextStep = startup_step.eStep.Check_DataBase;
                            return true;

                        case Navigation.eEvent.EXIT:
                            myStartup.eNextStep = startup_step.eStep.Cancel;
                            return false;
                    }

                    bResult = InsertSampleData(myStartup, xnav, ref Err);
                    return bResult;

                case fs.enum_GetDBSettings.Error_Load_DBSettings:
                    LogFile.Error.Show(Err);
                    myStartup.eNextStep = startup_step.eStep.Cancel;
                    return false;

                case fs.enum_GetDBSettings.No_TextValue:
                    myStartup.eNextStep = startup_step.eStep.Cancel;
                    return false;

                case fs.enum_GetDBSettings.No_ReadOnly:
                    Err = "ERROR enum_GetDBSettings return No_ReadOnly!";
                    LogFile.Error.Show(Err);
                    myStartup.eNextStep = startup_step.eStep.Cancel;
                    return false;

                default:
                    Err = "ERROR enum_GetDBSettings not handled!";
                    LogFile.Error.Show(Err);
                    myStartup.eNextStep = startup_step.eStep.Cancel;
                    return false;

            }

            myStartup.eNextStep = startup_step.eStep.Cancel;
            return false;
        }
Exemplo n.º 8
0
        public bool Get_ProgramSettings(NavigationButtons.Navigation xnav,bool bResetShopsInUse)
        {
            if (Program.bFirstTimeInstallation||(Program.Shops_in_use.Length == 0))
            {
                xnav.ChildDialog = new Form_ProgramSettings(this,xnav);
                xnav.ShowDialog();
                if (xnav.m_eButtons == NavigationButtons.Navigation.eButtons.PrevNextExit)
                {
                    switch (xnav.eExitResult)
                    {
                        case NavigationButtons.Navigation.eEvent.NEXT:
                            return true;
                        case NavigationButtons.Navigation.eEvent.PREV:
                            return true;
                        default:
                            return false;
                    }
                }
                else if (xnav.m_eButtons == NavigationButtons.Navigation.eButtons.OkCancel)
                {
                    switch (xnav.eExitResult)
                    {
                        case NavigationButtons.Navigation.eEvent.OK:

                            if (m_usrc_InvoiceMan.m_usrc_Invoice != null)
                            {
                                if (m_usrc_InvoiceMan.m_usrc_Invoice.DBtcn != null)
                                {
                                    m_usrc_InvoiceMan.m_usrc_Invoice.Set_eShopsMode(Properties.Settings.Default.eShopsInUse, xnav);
                                    return true;
                                }
                            }
                            return true;
                        default:
                            return false;
                    }
                }
                else
                {
                    LogFile.Error.Show("ERROR:usrc_Document:Get_shops_in_use:Error " + xnav.m_eButtons.ToString() + "not implemented!");
                    return false;
                }
            }
            else
            {
                if (Program.Shops_in_use.Length > 0)
                {
                    xnav.eExitResult = Navigation.eEvent.NEXT;
                    return true;
                }
                else
                {
                    LogFile.Error.Show("ERROR:usrc_Document:Get_shops_in_use:Error Program.Shops_in_use.Length <= 0!");
                    return false;
                }
            }
        }