Ejemplo n.º 1
0
        public App()
        {
            InitializeComponent();

            //  Settings.UserLoginId = "";

            //  MainPage = new SalesApp.views.MapPage();

            if (Settings.UserName.Length > 0 && Settings.UserPassword.Length > 0)
            {
                App.Current.MainPage = new MasterPage(new LogoutPage());

                //  var currentpage = new LoadingAlert();

                //   Controller.InstanceCreation().login("http://beta-dev1.hashmicro.com", "LBS", Settings.UserName, Settings.UserPassword);

                //  Controller.InstanceCreation().login("http://beta-dev1.hashmicro.com", "telering_dev", Settings.UserName, Settings.UserPassword);

                //  Controller.InstanceCreation().login("http://telering.equip-sapphire.com", "telering", Settings.UserName, Settings.UserPassword);

                //   Controller.InstanceCreation().login("http://bevananda.equip-sapphire.com", "bevananda", Settings.UserName, Settings.UserPassword);

                Controller.InstanceCreation().login("http://beta-dev2.hashmicro.com", "PNM", Settings.UserName, Settings.UserPassword);

                //if (Settings.UserLoginId == "0")
                //{
                //    MainPage = new SignInPage();
                //}
                //else
                //{
                //    Application.Current.MainPage = new MasterPage(new DashBoardPage());
                //}

                List <CRMLead> crmLeadData = Controller.InstanceCreation().crmLeadData();

                //  List<CRMLead> crmLeadData = Controller.InstanceCreation().crmFilterData();

                App.Current.MainPage = new MasterPage(new CrmTabbedPage());

                //   Loadingalertcall();
            }

            else
            {
                //  MainPage = new MainPage();
                MainPage = new SalesApp.views.LoginPage();
                //  MainPage = new SalesApp.views.GoogleMapScreen();
            }

            //      MainPage = new SalesApp.views.CRMLeadEditAddressPage();
        }
Ejemplo n.º 2
0
        public App()
        {
            InitializeComponent();

            App._connection = DependencyService.Get <ISQLiteDb>().GetConnection();
            App._connection.CreateTable <UserModelDB>();
            try
            {
                var details = (from y in App._connection.Table <UserModelDB>() select y).ToList();
                //  App.UserListDb = details;

                if (App.cusList.Count == 0 && details.Count != 0)
                {
                    foreach (var res in details)
                    {
                        App.cusList       = JsonConvert.DeserializeObject <List <Customers> >(res.customers_list);
                        App.productList   = JsonConvert.DeserializeObject <List <ProductsList> >(res.products);
                        App.journalList   = JsonConvert.DeserializeObject <List <account_journal> >(res.journal_list);
                        App.warehousList  = JsonConvert.DeserializeObject <List <warehouse> >(res.warehouse_list);
                        App.journalList   = JsonConvert.DeserializeObject <List <account_journal> >(res.journal_list);
                        App.salespersons  = JsonConvert.DeserializeObject <Dictionary <int, string> >(res.sales_persons);
                        App.taxList       = JsonConvert.DeserializeObject <List <taxes> >(res.tax_list);
                        App.partner_id    = res.partnerid;
                        App.partner_name  = res.user_name;
                        App.partner_image = res.user_image_medium;
                        App.partner_email = res.user_email;
                        App.userid        = res.userid;
                    }
                }
            }
            catch (Exception ex)
            {
                int i = 0;
            }


            if (Settings.UserName.Length > 0 && Settings.UserPassword.Length > 0)
            {
                // App.Current.MainPage = new MasterPage(new LogoutPage());

                String res = "";

                try
                {
                    //  res = Controller.InstanceCreation().login(Settings.UserUrlName, Settings.UserDbName, Settings.UserName, Settings.UserPassword);
                    App.Current.MainPage = new MasterPage(new CrmTabbedPage("tab4"));
                    App.sq_rpc           = true;
                    //   PopupNavigation.PushAsync( new CalendarPopupPage());
                }

                catch (Exception ea)
                {
                    if (ea.Message.Contains("(Network is unreachable)") || ea.Message.Contains("NameResolutionFailure"))
                    {
                        App.NetAvailable = false;
                    }

                    else if (ea.Message.Contains("(503) Service Unavailable"))
                    {
                        App.responseState = false;
                    }
                }

                if (App.NetAvailable == false)
                {
                    App.Current.MainPage = new MasterPage(new CrmTabbedPage());
                }
            }

            else
            {
                //  MainPage = new MainPage();
                MainPage = new SalesApp.views.LoginPage();
                //  MainPage = new SalesApp.views.GoogleMapScreen();
            }
        }
Ejemplo n.º 3
0
        public App()
        {
            InitializeComponent();

            App._connection = DependencyService.Get <ISQLiteDb>().GetConnection();

            App._connection.CreateTable <ActivePromotionsDB>();
            try
            {
                var details = (from y in App._connection.Table <ActivePromotionsDB>() select y).ToList();
                App.promotionsListDB = details;
            }
            catch (Exception ex)
            {
                int i = 0;
            }

            App._connection.CreateTable <SalesOrderDB>();
            try
            {
                var details = (from y in App._connection.Table <SalesOrderDB>() select y).ToList();                   App.SalesOrderListDb = details;
            }

            catch (Exception e)
            {
                int j = 0;
            }

            App._connection.CreateTable <CRMOpportunitiesDB>();
            try
            {
                var details = (from y in App._connection.Table <CRMOpportunitiesDB>() select y).ToList();
                App.CRMOpportunitiesListDb = details;
            }
            catch (Exception ex)
            {
                int i = 0;
            }


            App._connection.CreateTable <CRMLeadDB>();
            try
            {
                var details = (from y in App._connection.Table <CRMLeadDB>() select y).ToList();
                App.crmListDb = details;
            }
            catch (Exception ex)
            {
                int i = 0;
            }


            App._connection.CreateTable <SalesQuotationDB>();
            try
            {
                var details = (from y in App._connection.Table <SalesQuotationDB>() select y).ToList();
                App.SalesQuotationListDb = details;
            }
            catch (Exception ex)
            {
                int i = 0;
            }


            App._connection.CreateTable <UserModelDB>();
            try
            {
                var details = (from y in App._connection.Table <UserModelDB>() select y).ToList();
                App.UserListDb = details;
            }
            catch (Exception ex)
            {
                int i = 0;
            }


            List <ProductsList> productslistdb = new List <ProductsList>();

            // Dictionary<int, string> cusdictDbapp = new Dictionary<int, string>();
            foreach (var item in App.UserListDb)
            {
                productslistdb    = JsonConvert.DeserializeObject <List <ProductsList> >(item.products);
                App.cusdictDb     = JsonConvert.DeserializeObject <Dictionary <int, string> >(item.customers_list);
                App.ProductListDb = productslistdb;
                App.userid_db     = item.userid;
                //  App.cusdictDb = cusdictDbapp;
            }



            //  var details1 = (from x in App._connection.Table<SalesQuotation>() select x).ToList();

            if (Settings.UserName.Length > 0 && Settings.UserPassword.Length > 0)
            {
                // App.Current.MainPage = new MasterPage(new LogoutPage());

                String res = "";

                try
                {
                    res = Controller.InstanceCreation().login(Settings.UserUrlName, Settings.UserDbName, Settings.UserName, Settings.UserPassword);
                    App.Current.MainPage = new MasterPage(new CrmTabbedPage());

                    //   PopupNavigation.PushAsync( new CalendarPopupPage());
                }

                catch (Exception ea)
                {
                    if (ea.Message.Contains("(Network is unreachable)") || ea.Message.Contains("NameResolutionFailure"))
                    {
                        App.NetAvailable = false;
                    }

                    else if (ea.Message.Contains("(503) Service Unavailable"))
                    {
                        App.responseState = false;
                    }
                }

                if (App.NetAvailable == false)
                {
                    App.Current.MainPage = new MasterPage(new CrmTabbedPage());
                }



                //   Loadingalertcall();
            }

            else
            {
                //  MainPage = new MainPage();
                MainPage = new SalesApp.views.LoginPage();
                //  MainPage = new SalesApp.views.GoogleMapScreen();
            }
        }
Ejemplo n.º 4
0
        public App()
        {
            InitializeComponent();

            App._connection = DependencyService.Get <ISQLiteDb>().GetConnection();


            App._connection.CreateTable <ActivePromotionsDB>();
            try
            {
                var details = (from y in App._connection.Table <ActivePromotionsDB>() select y).ToList();
                App.promotionsListDB = details;
            }
            catch (Exception ex)
            {
                int i = 0;
            }


            App._connection.CreateTable <SalesOrderDB>();
            try
            {
                var details = (from y in App._connection.Table <SalesOrderDB>() select y).ToList();
                App.SalesOrderListDb = details;
            }

            catch (Exception e)
            {
                int j = 0;
            }


            App._connection.CreateTable <CRMOpportunitiesDB>();
            try
            {
                var details = (from y in App._connection.Table <CRMOpportunitiesDB>() select y).ToList();
                App.CRMOpportunitiesListDb = details;
            }
            catch (Exception ex)
            {
                int i = 0;
            }



            App._connection.CreateTable <CRMLeadDB>();
            try
            {
                var details = (from y in App._connection.Table <CRMLeadDB>() select y).ToList();
                App.crmListDb = details;
            }
            catch (Exception ex)
            {
                int i = 0;
            }


            App._connection.CreateTable <SalesQuotationDB>();
            try
            {
                var details = (from y in App._connection.Table <SalesQuotationDB>() select y).ToList();
                App.SalesQuotationListDb = details;
            }
            catch (Exception ex)
            {
                int i = 0;
            }


            App._connection.CreateTable <UserModelDB>();
            try
            {
                var details = (from y in App._connection.Table <UserModelDB>() select y).ToList();
                App.UserListDb = details;
            }
            catch (Exception ex)
            {
                int i = 0;
            }


            List <ProductsList> productslistdb = new List <ProductsList>();

            // Dictionary<int, string> cusdictDbapp = new Dictionary<int, string>();
            foreach (var item in App.UserListDb)
            {
                productslistdb    = JsonConvert.DeserializeObject <List <ProductsList> >(item.products);
                App.cusdictDb     = JsonConvert.DeserializeObject <Dictionary <int, string> >(item.customers_list);
                App.ProductListDb = productslistdb;
                App.userid_db     = item.userid;
                //  App.cusdictDb = cusdictDbapp;
            }


            //App._connection.CreateTable<UserModelDB>();
            //try
            //{
            //    var details = (from y in App._connection.Table<SalesQuotationDB>() select y).ToList();
            //    App.SalesQuotationListDb = details;
            //}
            //catch(Exception ex)
            //{
            //    int i = 0;
            //}

            //foreach (var item in App.SalesOrderDb)
            //{
            //     var json_orderline = JsonConvert.SerializeObject(item.order_line);

            //    String convertstring = json_orderline.ToString();

            //  //  "\"[{\\\"customer_lead\\\":\\\"0\\\",\\\"price_unit\\\":\\\"10000\\\",\\\"product_uom_qty\\\":\\\"10\\\",\\\"price_subtotal\\\":\\\"100000\\\",\\\"taxes\\\":[],\\\"product_name\\\":\\\"Floordeck 1000x060 MM\\\"},{\\\"customer_lead\\\":\\\"0\\\",\\\"price_unit\\\":\\\"1\\\",\\\"product_uom_qty\\\":\\\"1\\\",\\\"price_subtotal\\\":\\\"1\\\",\\\"taxes\\\":[\\\"Sales Tax N/A SRCA-S\\\"],\\\"product_name\\\":\\\"Floordeck 1000x060 MM\\\"}]\""

            //    String finstring = convertstring.Replace("\\","");

            //    finstring = finstring.Substring(1);

            //    finstring = finstring.Remove(finstring.Length - 1);

            //    JArray stringres = JsonConvert.DeserializeObject<JArray>(finstring);

            //  //  OrderLine stringres = JsonConvert.DeserializeObject<OrderLine>(json_orderline)

            //    int cus_lead = 0;
            //    string prod_name = "";


            //    foreach (JObject obj in stringres)
            //    {
            //        cus_lead = obj["customer_lead"].ToObject<int>();
            //         prod_name = obj["product_name"].ToString();
            //    }

            //}



            //  var details1 = (from x in App._connection.Table<SalesQuotation>() select x).ToList();

            if (Settings.UserName.Length > 0 && Settings.UserPassword.Length > 0)
            {
                // App.Current.MainPage = new MasterPage(new LogoutPage());

                String res = "";

                try
                {
                    res = Controller.InstanceCreation().login(Settings.UserUrlName, Settings.UserDbName, Settings.UserName, Settings.UserPassword);
                    App.Current.MainPage = new MasterPage(new CrmTabbedPage());

                    //   PopupNavigation.PushAsync( new CalendarPopupPage());
                }

                catch (Exception ea)
                {
                    if (ea.Message.Contains("(Network is unreachable)") || ea.Message.Contains("NameResolutionFailure"))
                    {
                        App.NetAvailable = false;
                    }

                    else if (ea.Message.Contains("(503) Service Unavailable"))
                    {
                        App.responseState = false;
                    }
                }

                if (App.NetAvailable == false)
                {
                    App.Current.MainPage = new MasterPage(new CrmTabbedPage());
                }


                //  var currentpage = new LoadingAlert();

                //   Controller.InstanceCreation().login("http://beta-dev1.hashmicro.com", "LBS", Settings.UserName, Settings.UserPassword);

                //  Controller.InstanceCreation().login("http://beta-dev1.hashmicro.com", "telering_dev", Settings.UserName, Settings.UserPassword);

                //  Controller.InstanceCreation().login("http://telering.equip-sapphire.com", "telering", Settings.UserName, Settings.UserPassword);

                //  res =  Controller.InstanceCreation().login("http://mbtrussco.equip-sapphire.com", "mbtrussco", Settings.UserName, Settings.UserPassword);

                //  res =   Controller.InstanceCreation().login(Settings.UserUrlName, Settings.UserDbName, Settings.UserName, Settings.UserPassword);

                //if (res == "server")
                //{
                //   // await Navigation.RemovePopupPageAsync(currentpage);
                //    var alertResult1 = new CommonAlertWizard("Alert", "The server is temporarily unavailable due to maintenance or capacity problems. Please try again.");
                //   // PopupNavigation.PushAsync(alertResult1);
                //}

                //else
                //{
                //    List<CRMLead> crmLeadData = Controller.InstanceCreation().crmLeadData();
                //    App.Current.MainPage = new MasterPage(new CrmTabbedPage());
                //}

                //   Loadingalertcall();
            }

            else
            {
                //  MainPage = new MainPage();
                MainPage = new SalesApp.views.LoginPage();
                //  MainPage = new SalesApp.views.GoogleMapScreen();
            }



            //      MainPage = new SalesApp.views.CRMLeadEditAddressPage();
        }