Beispiel #1
0
        public AddclientVievModel()
        {
            save = new Command(async() => {
                erour = new List <string>();

                if (Name.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة إسم العميل");
                }



                if (numaccount.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة رقم الحساب   ");
                }


                if (agence.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة الوكالة    ");
                }

                if (bank.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة البنك    ");
                }
                if (address.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة العنوان    ");
                }
                OpenSample4Dialog();

                if (erour.Count == 0)
                {
                    AcceptSample4Dialog();

                    await Task.Run(() =>
                    {
                        var client = new client()
                        {
                            Name        = Name,
                            address     = address,
                            bank        = bank,
                            gence       = agence,
                            num_account = numaccount
                        };
                        Ico.getValue <db>().GetUnivdb().clients.Add(client);
                        Ico.getValue <db>().savedb();
                        Ico.getValue <ContentApp>().back();
                    });
                }
                else
                {
                    Sample4Content = new Messagebox(erour, () => {
                        CancelSample4Dialog();
                    });
                }
            });
        }
        public EditprocessesViewModel(process process)
        {
            this.Name = process.Name;
            this.date = process.date;
            this.Code = process.Code;
            this.Num  = process.num;

            save = new Command(() =>
            {
                erour = new List <string>();
                if (Name.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة إسم العملية ");
                }
                if (Code.ToString().Length != 15)
                {
                    erour.Add(" كود العملية  يجب أن يحتوي على 15 حرف" + Code.ToString().Length);
                }

                if (Num.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة رقم الثابت للعملية ");
                }
                else
                {
                    string pattern = "[1-9]+/[1-9]+";
                    Regex rgx      = new Regex(pattern);
                    if (rgx.IsMatch(Num.ToString()))
                    {
                        erour.Add("الرجاء كتابة رقم   ");
                    }
                }


                if (erour.Count == 0)
                {
                    var pr = Ico.getValue <db>().GetUnivdb().processes.Single(p => p.Id == process.Id);


                    pr.Name = Name;
                    pr.date = date;
                    pr.Code = Code;
                    pr.num  = Num;
                    Ico.getValue <db>().savedb();
                    Ico.getValue <ContentApp>().back();
                }
                else
                {
                    OpenSample4Dialog();
                    Sample4Content = new Messagebox(erour, () => {
                        CancelSample4Dialog();
                    });
                }
            });
            back = new Command(() =>
            {
                Ico.getValue <ContentApp>().back();
            });
        }
Beispiel #3
0
        public Adddafa3VewModel(part part)
        {
            this.part = part;

            this.namepro  = part.process.Name;
            this.cost     = cost;
            this.namepart = part.Name;

            var client = part.card_kanoni.ToList().FirstOrDefault().client;

            this.nameclient     = client.Name;
            this.codebankclient = client.num_account;
            this.bankclient     = client.bank;


            savecommand = new Command(() =>
            {
                erour = new List <string>();


                string pattern = "[0-9]+";
                Regex rgx      = new Regex(pattern);
                if (Cost == 0 || !rgx.IsMatch(cost.ToString()))
                {
                    erour.Add("الرجاء كتابة المبلغ ");
                }
                else
                {
                    if (!((part.mcost - part.nowcost) >= Cost))
                    {
                        erour.Add("المبلغ أكبر من الرصيد المتاح");
                    }
                }



                if (AlCost.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة  المبلغ حرفيا   ");
                }
                if (erour.Count == 0)
                {
                    acc();
                    Sample4Content = new Messagebox(erour, con);
                }
                else
                {
                    Creat_card(part);
                }
                //              var cardm = Ico.getValue<db>().GetUnivdb().card_mo7sabi.ToList().Where(c => c.Id == card_mo7sabi.Id).SingleOrDefault();
                //    Ico.gtValue<ContentApp>().SetPage(new Viewdafa3(cardm));
            });
            Cancelcommand = new Command(() =>
            {
                con();
            });
        }
        public NewprocessesViewModel()
        {
            back = new Command(() => {
                Ico.getValue <ContentApp>().back();
            });

            save = new Command(async() => {
                erour = new List <string>();
                if (Name.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة إسم العملية ");
                }
                if (Code.ToString().Length != 15)
                {
                    erour.Add(" كود العملية  يجب أن يحتوي على 15 حرف" + Code.ToString().Length);
                }

                if (Num.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة رقم الثابت للعملية ");
                }


                if (erour.Count == 0)
                {
                    AcceptSample4Dialog();

                    await Task.Run(() =>
                    {
                        double totalCoast = 0;
                        var p             = new process()
                        {
                            Name     = Name,
                            date     = date,
                            Code     = Code,
                            num      = Num,
                            NewCost  = totalCoast,
                            location = Ico.getValue <IO>().CREATE_F_PRO(Code)
                        };
                        Ico.getValue <db>().GetUnivdb().processes.Add(p);
                        Ico.getValue <db>().GetUnivdb().SaveChanges();
                        CancelSample4Dialog();
                    });

                    Ico.getValue <ContentApp>().page = new PCrad();
                    Ico.getValue <ContentApp>().clear();
                }
                else
                {
                    OpenSample4Dialog();
                    Sample4Content = new Messagebox(erour, () => {
                        CancelSample4Dialog();
                    });
                }
            });
        }
Beispiel #5
0
        public void inTilData()
        {
            actionUP();
            this.process = val;
            this.newcost = val.NewCost;

            Itemsa7abs = new ObservableCollection <Itemsa7ab>(Ico.getValue <db>().GetUnivdb().card_sa7ab.ToList().Where(c => c.card.id_prosess == process.Id).ToList().Select(c => new Itemsa7ab(c)
            {
                Viewsa7abViewModel = this,
                start = () => { AcceptSample4Dialog();
                                AcceptSample4Dialog(); },
                end        = CancelSample4Dialog,
                addtashira = (t) => {
                    Sample4Content = new Addtashira_sa7ab(t, AcceptSample4Dialog, CancelSample4Dialog);
                    OpenSample4Dialog();
                },
                edittashiraaction = (t) => {
                    Sample4Content = new Edittashira_sa7ab(t, AcceptSample4Dialog, CancelSample4Dialog);
                    OpenSample4Dialog();
                }
            }));

            addmo7asabi = new Command(() => {
                /*      MessageBox.Show((process.cards.ToList().LastOrDefault() != null)+"");
                 *    MessageBox.Show((Ico.getValue<Date>().GetPevDate() != null )+"");
                 *        MessageBox.Show((process.cards.ToList().LastOrDefault().year1.Id != Ico.getValue<Date>().GetPevDate().Id) + "");
                 *             MessageBox.Show((Ico.getValue<db>().GetUnivdb().card_sa7ab.ToList().Where(c => (c.card.id_prosess == process.Id) &&
                 *        (c.card.year1.Id == Ico.getValue<Date>().GetNowDate().Id)).ToList().Count != 0) + "");
                 */


                if ((process.date.Year == Ico.getValue <Date>().GetNowDate().year1.Year) || (Ico.getValue <Date>().GetPevDate() == null) || (process.cards.ToList().LastOrDefault() != null && Ico.getValue <Date>().GetPevDate() != null && process.cards.ToList().LastOrDefault().year1.Id != Ico.getValue <Date>().GetPevDate().Id&&Ico.getValue <db>().GetUnivdb().card_sa7ab.ToList().Where(c => (c.card.id_prosess == process.Id) && (c.card.year1.Id == Ico.getValue <Date>().GetNowDate().Id)).ToList().Count != 0))
                {
                    Sample4Content = new Messagebox(new List <string>()
                    {
                        "لا تستطيغ إستخراج بطاقة سحب بعد"
                    }, CancelSample4Dialog);
                    OpenSample4Dialog();
                }
                else
                {
                    Sample4Content = new Addsa7ab(process, AcceptSample4Dialog, CancelSample4Dialog);
                    OpenSample4Dialog();
                }
            });
        }
Beispiel #6
0
        public EditpartViewModel(part part)
        {
            strcode = part.process.Code;
            stpro   = part.process.Name;
            var d = 0d;

            foreach (var p in part.process.parts)
            {
                d += p.Cost;
            }
            costpro = String.Format("{0:0.00}", d);


            this.cost    = part.Cost;
            this.name    = part.Name;
            this.alhcost = part.alpart;
            types        = new List <TypePart>();
            types.Add(new TypePart(1));
            types.Add(new TypePart(2));
            types.Add(new TypePart(3));
            types.Add(new TypePart(4));
            types.Add(new TypePart(5));
            types.Add(new TypePart(6));
            types.Add(new TypePart(7));
            types.Add(new TypePart(8));
            types.Add(new TypePart(9));
            types.Add(new TypePart(10));
            this.numtype = types.ElementAt(part.num_type - 1);

            back = new Command(() => {
                Ico.getValue <ContentApp>().back();
            });
            save = new Command(async() => {
                erour = new List <string>();

                if (name.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة إسم الحصة ");
                }
                if (cost == 0 && cost == null)
                {
                    erour.Add("الرجاء كتابة المبلغ ");
                }

                if (alhcost.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة  المبلغ حرفيا   ");
                }
                if (numtype == null)
                {
                    erour.Add("الرجاء  إختيار نوع الحصة    ");
                }
                OpenSample4Dialog();

                if (erour.Count == 0)
                {
                    AcceptSample4Dialog();
                    MessageBox.Show(name + "");
                    await Task.Run(() =>
                    {
                        var p      = Ico.getValue <db>().GetUnivdb().parts.ToList().Where(par => par.Id == part.Id).FirstOrDefault();
                        p.num_type = numtype.numType;
                        p.Name     = name;
                        p.Cost     = cost;
                        p.alpart   = alhcost;
                        Ico.getValue <db>().savedb();
                        CancelSample4Dialog();
                    });
                    Ico.getValue <ContentApp>().back();
                }
                else
                {
                    Sample4Content = new Messagebox(erour, () => {
                        OpenSample4Dialog();
                    });
                }
            });
        }
Beispiel #7
0
        public processesViewModel()
        {
            actionUP = () =>
            {
                this.processes = new ObservableCollection <processesViewMODEL>(Ico.getValue <db>().GetUnivdb().processes.ToList().Select(p => new processesViewMODEL(p)
                {
                    removeaction = () => {
                        OpenSample4Dialog();

                        Sample4Content = new YesOrNo("هل أنت مـتأكد من قيامك بحذف هذه العملية  ؟ , لا يمكن التراجع عن هذه الحذف ",
                                                     async() => {
                            AcceptSample4Dialog();
                            await Task.Run(() => {
                                Ico.getValue <db>().GetUnivdb().processes.Remove(Ico.getValue <db>().GetUnivdb().processes.ToList().Where(pro => pro.Id == p.Id).ToList().FirstOrDefault());
                                Ico.getValue <db>().savedb();

                                CancelSample4Dialog();
                                inTilData();
                            });
                        },
                                                     () => {
                            CancelSample4Dialog();
                        });
                    }
                }));
            };
            inTilData();
            Count  = processes.Count;
            Serech = new CommandPar((t) => {
                var text  = (string)t;
                processes = new ObservableCollection <processesViewMODEL>(Ico.getValue <db>().GetUnivdb().processes.ToList().Select(p => new processesViewMODEL(p)
                {
                    removeaction = () => {
                        OpenSample4Dialog();

                        Sample4Content = new YesOrNo("هل أنت مـنأكد من قيامك بحذف هذه العملية  ؟ , لا يمكن التراجع عن هذه الحذف ",

                                                     async() => {
                            AcceptSample4Dialog();

                            await Task.Run(() => {
                                Ico.getValue <db>().GetUnivdb().processes.Remove(Ico.getValue <db>().GetUnivdb().processes.ToList().Where(pro => pro.Id == p.Id).ToList().FirstOrDefault());
                                Ico.getValue <db>().savedb();
                                CancelSample4Dialog();
                                inTilData();
                            });
                        },
                                                     () => {
                            CancelSample4Dialog();
                        });
                    }
                }

                                                                                                                                    ).Where((l) => l.Code.Contains(text) || l.Name.Contains(text))
                                                                          );
            });
            new_ = new Command(() => {
                AcceptSample4Dialog();
                Sample4Content = new Messagebox(new string[] { " تجربة 1 ", " تجربة 1 ", " تجربة 1 ", " تجربة 1 " }, () => {
                    CancelSample4Dialog();
                });
                //      MainViewModel.page = new NewProcesses();
                //       Ico.getValue<ContentApp>().page = new NewProcesses();
            });
        }
Beispiel #8
0
        public AddpartViewModel(process process)
        {
            this.process = process;
            this.num     = process.parts.Count + 1;
            types        = new List <TypePart>();
            types.Add(new TypePart(1));
            types.Add(new TypePart(2));
            types.Add(new TypePart(3));
            types.Add(new TypePart(4));
            types.Add(new TypePart(5));
            types.Add(new TypePart(6));
            types.Add(new TypePart(7));
            types.Add(new TypePart(8));
            types.Add(new TypePart(9));
            types.Add(new TypePart(10));
            save = new Command(async() => {
                if (name.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة إسم العملية ");
                }
                if (cost.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة المبلغ ");
                }

                if (alhcost.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة رقم الثابت للعملية ");
                }
                if (numtype == null)
                {
                    erour.Add("الرجاء  إختيار نوع الحصة    ");
                }

                if (erour.Count == 0)
                {
                    AcceptSample4Dialog();

                    await Task.Run(() =>
                    {
                        var part = new part()
                        {
                            Name     = name,
                            Cost     = cost,
                            Id_Pro   = process.Id,
                            num_type = numtype.numType,
                            num      = num,
                            alpart   = alhcost
                        };

                        Ico.getValue <db>().GetUnivdb().parts.Add(part);
                        Ico.getValue <db>().savedb();
                    });
                    Ico.getValue <ContentApp>().back();
                }
                else
                {
                    OpenSample4Dialog();
                    Sample4Content = new Messagebox(erour, () => {
                        CancelSample4Dialog();
                    });
                }
            });
            back = new Command(() => {
                Ico.getValue <ContentApp>().back();
            });
        }
Beispiel #9
0
        public AddpartViewModel(process process)
        {
            strcode = process.Code;
            stpro   = process.Name;
            var d = 0d;

            foreach (var p in process.parts)
            {
                d += p.Cost;
            }
            costpro = String.Format("{0:0.00}", d);


            this.num = process.parts.Count + 1;


            types = new List <TypePart>();
            types.Add(new TypePart(1));
            types.Add(new TypePart(2));
            types.Add(new TypePart(3));
            types.Add(new TypePart(4));
            types.Add(new TypePart(5));
            types.Add(new TypePart(6));
            types.Add(new TypePart(7));
            types.Add(new TypePart(8));
            types.Add(new TypePart(9));
            types.Add(new TypePart(10));
            save = new Command(async() => {
                erour = new List <string>();

                if (name.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة إسم الحصة ");
                }
                string pattern = "[1-9]+";
                Regex rgx      = new Regex(pattern);
                if (!rgx.IsMatch(cost.ToString()))
                {
                    erour.Add("الرجاء كتابة المبلغ ");
                }



                if (alhcost.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة  المبلغ حرفيا   ");
                }
                if (numtype == null)
                {
                    erour.Add("الرجاء  إختيار نوع الحصة    ");
                }
                OpenSample4Dialog();

                if (erour.Count == 0)
                {
                    AcceptSample4Dialog();

                    await Task.Run(() =>
                    {
                        var part = new part()
                        {
                            Name     = name,
                            Cost     = cost,
                            Id_Pro   = process.Id,
                            num_type = numtype.numType,
                            num      = num,
                            alpart   = alhcost
                        };

                        Ico.getValue <db>().GetUnivdb().parts.Add(part);
                        Ico.getValue <db>().savedb();
                        OpenSample4Dialog();
                    });
                    Ico.getValue <ContentApp>().back();
                }
                else
                {
                    Sample4Content = new Messagebox(erour, () => {
                        OpenSample4Dialog();
                    });
                }
            });
            back = new Command(() => {
                Ico.getValue <ContentApp>().back();
            });
        }
        public EditclientVievModel(client client)
        {
            Name       = client.Name;
            agence     = client.gence;
            numaccount = client.num_account;
            bank       = client.bank;
            address    = client.address;
            save       = new Command(async() => {
                erour = new List <string>();

                if (Name.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة إسم العميل");
                }



                if (numaccount.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة رقم الحساب   ");
                }


                if (agence.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة الوكالة    ");
                }

                if (bank.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة البنك    ");
                }
                if (address.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة العنوان    ");
                }
                OpenSample4Dialog();

                if (erour.Count == 0)
                {
                    AcceptSample4Dialog();

                    await Task.Run(() =>
                    {
                        var c = Ico.getValue <db>().GetUnivdb().clients.ToList().Where(cl => cl.Id == client.Id).FirstOrDefault();


                        c.Name        = Name;
                        c.address     = address;
                        c.bank        = bank;
                        c.gence       = agence;
                        c0num_account = numaccount;

                        Ico.getValue <db>().GetUnivdb().clients.Add(client);
                        Ico.getValue <db>().savedb();
                        CancelSample4Dialog();

                        Ico.getValue <ContentApp>().back();
                    });
                }
                else
                {
                    Sample4Content = new Messagebox(erour, () => {
                        CancelSample4Dialog();
                    });
                }
            });
            back = new Command(() => {
                Ico.getValue <ContentApp>().back();
            });
        }