示例#1
0
        public async Task<int> Create_installment(Data.installment Installment)
        {
            _sqLiteConnection = await DependencyService.Get<ISQLite>().GetConnection();

            int res = _sqLiteConnection.Insert(Installment);
            var x = 0;
            return res;
        }
示例#2
0
        public async Task<int> Update_installment(Data.installment Installment)
        {
            _sqLiteConnection = await DependencyService.Get<ISQLite>().GetConnection();
            
            
            try
            {
                //var res = _sqLiteConnection.Update(existing_installment);
                
                var res = _sqLiteConnection.Query<Data.installment>
                    (" UPDATE installment SET list_Down_visible = ? , InstallmentDueDate = ? ,  InstallmentPaymentDate = ? , Collectedvalue = ? , installmedntColor = ? , installment_condition = ? , Worthy_amount = ? , delay_Days = ? , Remaining_amount = ? WHERE deal_id = ? and installment_id = ? ",
                                  Installment.list_Down_visible, Installment.InstallmentDueDate, Installment.InstallmentPaymentDate, Installment.Collectedvalue, Installment.installmedntColor, Installment.installment_condition, Installment.Worthy_amount, Installment.delay_Days, Installment.Remaining_amount, Installment.deal_id, Installment.installment_id).FirstOrDefault();
                //var existing_installment = _sqLiteConnection.Query<Data.installment>("UPDATE installment SET list_Down_visible = ?  where deal_id = ? and installment_id = ? ", Installment.list_Down_visible, Installment.deal_id, Installment.installment_id).FirstOrDefault();
                return 1;
            }                                
            catch(Exception e)
            {                
                return 0;
            }

        }
示例#3
0
        public App()
        {
            Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MjkzMzMzQDMxMzgyZTMyMmUzMFkrbThkQ0FqejNXS2YyUkRoQUFzZVhTbnhUK09BOFNPQjliS2RDUTJDSnM9");
            InitializeComponent();

            //start
            var builder = PublicClientApplicationBuilder.Create(OAuthSettings.ApplicationId).WithRedirectUri(OAuthSettings.RedirectUri);

            if (!string.IsNullOrEmpty(iOSKeychainSecurityGroup))
            {
                builder = builder.WithIosKeychainSecurityGroup(iOSKeychainSecurityGroup);
            }

            PCA = builder.Build();
            //end
            var o_dataservices = new DealService();

            o_dataservices.UpdateAll_list_Down_visible_installment();
            //تحديث ايام التاخير
            List <Data.V_costomar_deal_installment> List_Deal_Data;
            var view_Deal_Data = o_dataservices.GetAll_costomar_deal_installment_payed();

            if (view_Deal_Data.Result != null)
            {
                List_Deal_Data = view_Deal_Data.Result;

                var date = DateTime.Now;
                foreach (var element in List_Deal_Data)
                {
                    var O_installment = new Data.installment
                    {
                        installment_id         = element.installment_id,
                        deal_id                = element.deal_id,
                        InstallmentPaymentDate = element.InstallmentPaymentDate,
                        InstallmentDueDate     = element.InstallmentDueDate,
                        installment_condition  = element.installment_condition,
                        Collectedvalue         = element.Collectedvalue,
                        Worthy_amount          = element.Worthy_amount,
                        Remaining_amount       = element.Remaining_amount,
                        list_Down_visible      = element.list_Down_visible,
                        installmedntColor      = element.installmedntColor,
                        delay_Days             = element.delay_Days,
                    };
                    if (date > element.InstallmentDueDate)
                    {
                        var res = (date - O_installment.InstallmentDueDate).Days;
                        // عدد ايام التاخير اقصاها 3 شهور يعنى 90 يوم واللون الاحمر والاخضر بالرجي بي بيكونو 255  يعنى كل يوم تخير بيساوى 3 درجات فى اللون غالبا ...يعنى اضرب عدد اليام التاخير فى 3 يطلع الدرجة الى انا محتاج اظبطها
                        int   total_delay_Days = 0;
                        int   gren             = 0;
                        int   red  = 0;
                        int   blue = 0;
                        Color o_installmedntColor;

                        if (res <= 90)
                        {
                            if (res <= 30)
                            {
                                total_delay_Days = Convert.ToInt32(res * 2.5);
                                red  = 180 + total_delay_Days;
                                gren = 255;
                                blue = 180;
                                o_installmedntColor = Color.FromRgb(red, gren, blue);
                            }
                            else if (res <= 60 && res > 30)
                            {
                                total_delay_Days = Convert.ToInt32(res * 1.3);
                                red  = 255;
                                gren = 255 - total_delay_Days;
                                blue = 180;
                                o_installmedntColor = Color.FromRgb(red, gren, blue);
                            }
                            else
                            {
                                total_delay_Days = Convert.ToInt32(res * 1.4);
                                red  = 255;
                                gren = 180 - total_delay_Days;
                                blue = 180 - total_delay_Days;
                                o_installmedntColor = Color.FromRgb(red, gren, blue);
                            }
                        }
                        else
                        {
                            // اكثر من 90 يوم يبقى هحط الاحمر والاخضر على طول
                            red  = 255;
                            gren = 60;
                            blue = 60;
                            o_installmedntColor = Color.FromRgb(red, gren, blue);
                        }

                        O_installment.delay_Days = res.ToString();
                        string Color_Hex = o_installmedntColor.ToHex();
                        O_installment.installmedntColor = Color_Hex.Remove(1, 2);
                        // Color v = Color.FromHex(O_installment.installmedntColor);
                        int test = o_dataservices.Update_installment(O_installment).Result;
                        int x    = 5;
                    }
                }
            }

            Settings.Deal_installment_id = -1; Settings.Deal_deal_id = -1;
            MainPage = new NavigationPage(new Views.installment());
            //MainPage = new NavigationPage(new Views.MasterPage());
        }