コード例 #1
0
        public async void Account_Detail_Counter_Defult()
        {
            IFirebaseConfig Config = new FirebaseConfig
            {
                AuthSecret = "VH1rdiDgj2hzD0WN5JZ67BSXTN7OdOeM0fnry50G",
                BasePath   = "https://ctm-db.firebaseio.com/"
            };

            IFirebaseClient Client = new FireSharp.FirebaseClient(Config);

            var Number_Account_Detail = new FireBase_Account_Detail_Counter
            {
                Counter = "1"
            };

            SetResponse Respose = await Client.SetTaskAsync("Number_Account_Detail/" + "Now", Number_Account_Detail);
        }
コード例 #2
0
        // Insert Data In FireBase DataBase ...
        //

        public async void FireBase_Insert(List <Account_Detail> Detail)
        {
            IFirebaseConfig Config = new FirebaseConfig
            {
                AuthSecret = "VH1rdiDgj2hzD0WN5JZ67BSXTN7OdOeM0fnry50G",
                BasePath   = "https://ctm-db.firebaseio.com/"
            };

            IFirebaseClient Client = new FireSharp.FirebaseClient(Config);

            int Number_Detail = Detail.Count;

            FirebaseResponse CounterRespose = await Client.GetTaskAsync("Number_Account_Detail/" + "Now");

            FireBase_Account_Detail_Counter Data = CounterRespose.ResultAs <FireBase_Account_Detail_Counter>();

            string Counter_Value = Data.Counter;

            for (int i = 0; i < Number_Detail; i++)
            {
                var Account_Detail = new FireBase_Account_Detail
                {
                    Account_Id        = Detail[i].Get_Account_Id(),
                    Student_Name      = Detail[i].Get_Student_Name(),
                    Class             = Detail[i].Get_Class(),
                    Study_Fee         = Detail[i].Get_Study_Fee(),
                    Registration_Fee  = Detail[i].Get_Registration_Fee(),
                    Transportaion_Fee = Detail[i].Get_Transportaion_Fee(),
                    Extra_Fee         = Detail[i].Get_Extra_Fee(),
                    Total             = Detail[i].Get_Total()
                };

                SetResponse Respose = await Client.SetTaskAsync("Account_Detail/" + Counter_Value, Account_Detail);

                Counter_Value = (int.Parse(Counter_Value) + 1).ToString();
            }

            Update_Counter(Counter_Value);

            return;
        }
コード例 #3
0
        public async void Excute_Process(Process Process)
        {
            IFirebaseConfig Config = new FirebaseConfig
            {
                AuthSecret = "VH1rdiDgj2hzD0WN5JZ67BSXTN7OdOeM0fnry50G",
                BasePath   = "https://ctm-db.firebaseio.com/"
            };

            IFirebaseClient Client = new FireSharp.FirebaseClient(Config);

            if (Process.Code == "S1")
            {
                FirebaseResponse Respose = await Client.GetTaskAsync("Student/" + Process.Record_Id);

                FireBase_Student Data = Respose.ResultAs <FireBase_Student>();

                Student Student = new Student(Data.Id, Data.First_Name, Data.Last_Name, Data.Father_Name, Data.Birth, Data.Type, Data.Connect1, Data.Connect2,
                                              Data.Class, Data.Registration, Data.School_Name, Data.Transportation, Data.City, Data.Block,
                                              Data.Street, Data.Detail, Data.Account_Number, Data.File_Number, Data.Note, Data.File_Stutus, Data.Picture);
                Student.Sql_Insert(Student);
                return;
            }
            else if (Process.Code == "S2")
            {
                Student Student = new Student();
                Student.Sql_Delete(Process.Record_Id);
                return;
            }
            else if (Process.Code == "S3")
            {
                return;
            }
            else if (Process.Code == "R1")
            {
                FirebaseResponse Respose = await Client.GetTaskAsync("Receipt/" + Process.Record_Id);

                FireBase_Receipt Data = Respose.ResultAs <FireBase_Receipt>();

                Receipt Receipt = new Receipt(Data.Number, Data.Book, Data.Branch, Data.Recipient,
                                              Data.First_Name, Data.Last_Name, Data.Amount_Paid, Data.Date, Data.For, Data.Account_Number);
                Receipt.Sql_Insert(Receipt);
                return;
            }
            else if (Process.Code == "R2")
            {
                Receipt Receipt = new Receipt();
                Receipt.Sql_Delete(Process.Record_Id);
            }
            else if (Process.Code == "R3")
            {
                return;
            }
            else if (Process.Code == "A1")
            {
                FirebaseResponse Respose = await Client.GetTaskAsync("Account/" + Process.Record_Id);

                FireBase_Account Data = Respose.ResultAs <FireBase_Account>();

                Respose = await Client.GetTaskAsync("Number_Account_Detail/" + "Now");

                FireBase_Account_Detail_Counter Counter_Data = Respose.ResultAs <FireBase_Account_Detail_Counter>();

                List <Receipt> Receipts = new List <Receipt>();

                int Number_Detail = int.Parse(Counter_Data.Counter);

                List <Account_Detail> Detail = new List <Account_Detail>();

                for (int i = 1; i < Number_Detail; i++)
                {
                    Respose = await Client.GetTaskAsync("Account_Detail/" + i.ToString());

                    FireBase_Account_Detail Detail_Data = Respose.ResultAs <FireBase_Account_Detail>();

                    if (Detail_Data.Account_Id == Process.Record_Id)
                    {
                        Account_Detail Account_Detail = new Account_Detail(Detail_Data.Account_Id, Detail_Data.Student_Name, Detail_Data.Class, Detail_Data.Registration_Fee, Detail_Data.Study_Fee, Detail_Data.Transportaion_Fee, Detail_Data.Extra_Fee, Detail_Data.Total);
                        Detail.Add(Account_Detail);
                    }
                }


                Account Account = new Account(Data.Number, Data.Name, Data.Type, Data.Connect1, Data.Connect2, Data.Whats_App, Data.Total, Data.Amount_Paid, Data.Remender, Receipts, Detail);

                Account.Sql_Insert(Account);

                return;
            }
            else if (Process.Code == "A2")
            {
                Account Account = new Account();
                Account.Sql_Delete(Process.Record_Id);

                Account_Detail Account_Detail = new Account_Detail();
                Account_Detail.Sql_Delete(Process.Record_Id);

                return;
            }
            else if (Process.Code == "A3")
            {
                return;
            }
            else if (Process.Code == "E1")
            {
                FirebaseResponse Respose = await Client.GetTaskAsync("Employee/" + Process.Record_Id);

                FireBase_Employee Data = Respose.ResultAs <FireBase_Employee>();

                List <Employee_Receipt> Employee_Receipt = new List <Employee_Receipt>();

                Employee Employee = new Employee(Data.Number, Data.Name, Data.Connect1, Data.Connect2, Data.Children, Data.Type, Data.Class, Data.Number_Hour, Data.Detail, Employee_Receipt);
                Employee.Sql_Insert(Employee);
                return;
            }
            else if (Process.Code == "E2")
            {
                Employee Employee = new Employee();
                Employee.Sql_Delete(Process.Record_Id);
                return;
            }
            else if (Process.Code == "E3")
            {
                return;
            }
            else if (Process.Code == "SA1")
            {
                FirebaseResponse Respose = await Client.GetTaskAsync("Employee_Receipt/" + Process.Record_Id);

                FireBase_Employee_Receipt Data = Respose.ResultAs <FireBase_Employee_Receipt>();

                Employee_Receipt Employee_Receipt = new Employee_Receipt(Data.Number, Data.Book, Data.Owner, Data.Date,
                                                                         Data.Name, Data.Sallary, Data.Discount, Data.Total, Data.Detail, Data.Employee_Number);
                Employee_Receipt.Sql_Insert(Employee_Receipt);
                return;
            }
            else if (Process.Code == "SA2")
            {
                return;
            }
            else if (Process.Code == "SA3")
            {
                return;
            }
            else if (Process.Code == "MR1")
            {
                FirebaseResponse Respose = await Client.GetTaskAsync("Movement_Receipt/" + Process.Record_Id);

                FireBase_Movement_Receipt Data = Respose.ResultAs <FireBase_Movement_Receipt>();

                Movement_Receipt Movement_Receipt = new Movement_Receipt(Data.Number, Data.Book, Data.Type, Data.Owner, Data.Kind, Data.Amount, Data.Date, Data.Detail);

                Movement_Receipt.Sql_Insert(Movement_Receipt);
                return;
            }
            else if (Process.Code == "MR2")
            {
                return;
            }
            else if (Process.Code == "MR3")
            {
                return;
            }
        }