예제 #1
0
        public override void CreateForm(SAPbouiCOM.Application SboApp, string strXml, SAPbobsCOM.Company cmp, string frmId)
        {
            base.CreateForm(SboApp, strXml, cmp, frmId);
            InitiallizeForm();
            NopServices ns     = new NopServices(Program.strConNOP, Program.strConSAP, Program.SboAPI);
            DataTable   dtConf = ns.getConfiguration();

            if (dtConf.Rows.Count > 0)
            {
                txSDB.Value      = dtConf.Rows[0][2].ToString();
                txSUID.Value     = dtConf.Rows[0][3].ToString();
                txSPwd.Value     = dtConf.Rows[0][4].ToString();
                txSDBUid.Value   = dtConf.Rows[0][5].ToString();
                txSDBPwd.Value   = dtConf.Rows[0][6].ToString();
                txSSType.Value   = dtConf.Rows[0][7].ToString();
                txSServer.Value  = dtConf.Rows[0][8].ToString();
                txNPServer.Value = dtConf.Rows[0][9].ToString();
                txNPDB.Value     = dtConf.Rows[0][10].ToString();
                txNPUID.Value    = dtConf.Rows[0][11].ToString();
                txNPPwd.Value    = dtConf.Rows[0][12].ToString();
                txStdPL.Value    = dtConf.Rows[0][13].ToString();
                txWhs.Value      = dtConf.Rows[0][14].ToString();
                txPrFldr.Value   = dtConf.Rows[0][15].ToString();
                txCatFldr.Value  = dtConf.Rows[0][16].ToString();

                txFI.Value       = dtConf.Rows[0][17].ToString();
                txSoSer.Value    = dtConf.Rows[0][18].ToString();
                txSalesEmp.Value = dtConf.Rows[0][19].ToString();
                txOwn.Value      = dtConf.Rows[0][20].ToString();
            }
        }
예제 #2
0
        public override void etAfterClick(ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent)
        {
            try
            {
                base.etAfterClick(ref pVal, ref BubbleEvent);



                if (pVal.ItemUID == "cmdClear")
                {
                    NopServices ns     = new NopServices(Program.strConNOP, Program.strConSAP, Program.SboAPI);
                    string      result = ns.cleanData();
                    oApplication.SetStatusBarMessage("UDFs Created Successfully." + result, SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                }
                if (pVal.ItemUID == "cmdUdfs")
                {
                    try
                    {
                        oApplication.SetStatusBarMessage("Creating Udfs.", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                        NopServices ns = new NopServices(Program.strConNOP, Program.strConSAP, Program.SboAPI);
                        ns.addSboFields();
                        oApplication.SetStatusBarMessage("UDFs Created Successfully.", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                    }
                    catch (Exception ex)
                    {
                    }
                }

                if (pVal.ItemUID == "cmdRole")
                {
                    try
                    {
                        NopServices ns = new NopServices(Program.strConNOP, Program.strConSAP, Program.SboAPI);
                        ns.SyncRole();
                        oApplication.SetStatusBarMessage("Role Created Successfully.", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                    }
                    catch (Exception ex)
                    {
                    }
                }
                if (pVal.ItemUID == "cmdCus")
                {
                    try
                    {
                        NopServices ns = new NopServices(Program.strConNOP, Program.strConSAP, Program.SboAPI);
                        ns.SyncCustomer();
                        oApplication.SetStatusBarMessage("Customer Transfered Successfully.", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                    }
                    catch (Exception ex)
                    {
                    }
                }
                if (pVal.ItemUID == "cmdIG")
                {
                    try
                    {
                        NopServices ns = new NopServices(Program.strConNOP, Program.strConSAP, Program.SboAPI);
                        ns.SyncItemGroup();
                        ns.syncCatImages(Program.categorImageFolder);

                        oApplication.SetStatusBarMessage("Item Group Transfered Successfully.", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                    }
                    catch (Exception ex)
                    {
                    }
                }
                if (pVal.ItemUID == "cmdItems")
                {
                    try
                    {
                        NopServices ns = new NopServices(Program.strConNOP, Program.strConSAP, Program.SboAPI);
                        ns.SyncItems();
                        //  ns.syncProductImages(Program.productImageFolder);
                        oApplication.SetStatusBarMessage("Items Transfered Successfully.", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                    }
                    catch (Exception ex)
                    {
                    }
                }
                if (pVal.ItemUID == "cmdPrice")
                {
                    try
                    {
                        NopServices ns = new NopServices(Program.strConNOP, Program.strConSAP, Program.SboAPI);
                        ns.UpdateStandardPrice(Program.standardPricelist);
                        oApplication.SetStatusBarMessage("Items Price Updated Successfully.", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                    }
                    catch (Exception ex)
                    {
                    }
                }
                if (pVal.ItemUID == "cmdGPrice")
                {
                    try
                    {
                        NopServices ns = new NopServices(Program.strConNOP, Program.strConSAP, Program.SboAPI);
                        ns.UpdateStandardPrice(Program.standardPricelist);
                        oApplication.SetStatusBarMessage("Group Price Updated Successfully.", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                    }
                    catch (Exception ex)
                    {
                    }
                }
                if (pVal.ItemUID == "1")
                {
                    NopServices ns = new NopServices(Program.strConNOP, Program.strConSAP, Program.SboAPI);

                    string consaveResult = ns.updateConConfiguration(txSDB.Value, txSUID.Value, txSPwd.Value, txSDBUid.Value, txSDBPwd.Value, txSSType.Value, txSServer.Value, txNPServer.Value, txNPDB.Value, txNPUID.Value, txNPPwd.Value);

                    if (consaveResult == "Ok")
                    {
                        Program.companyDb  = txSDB.Value;
                        Program.SboUID     = txSUID.Value;
                        Program.SboPwd     = txSPwd.Value;
                        Program.DbUserName = txSPwd.Value;
                        Program.DbPassword = txSDBPwd.Value;
                        Program.ServerType = txSSType.Value;
                        Program.SboServer  = txSServer.Value;

                        Program.standardPricelist  = txStdPL.Value;;
                        Program.whsCode            = txWhs.Value;;
                        Program.productImageFolder = txPrFldr.Value;
                        Program.categorImageFolder = txPrFldr.Value;

                        Program.NopDbUserName = txNPUID.Value;
                        Program.NopDbPassword = txNPPwd.Value;
                        Program.NopDbName     = txNPDB.Value;
                        Program.NopSServer    = txNPServer.Value;
                    }
                    ns.updateConfiguration(txSDB.Value, txSUID.Value, txSPwd.Value, txSDBUid.Value, txSDBPwd.Value, txSSType.Value, txSServer.Value, txNPServer.Value, txNPDB.Value, txNPUID.Value, txNPPwd.Value, txStdPL.Value, txWhs.Value, txPrFldr.Value, txCatFldr.Value, txFI.Value, txSoSer.Value, txSalesEmp.Value, txOwn.Value);

                    Program.updateSetting();
                }
            }
            catch (Exception ex)
            {
                oApplication.SetStatusBarMessage("Error occured " + ex.Message);
            }
        }