コード例 #1
0
        public ViewProcessViewModel(process process)
        {
            this.actionUP = () => {
                this.val = Ico.getValue <db>().GetUnivdb().processes.ToList().Where(p => p.Id == process.Id).ToList().FirstOrDefault();
            };
            this.name = val.Name;
            this.code = val.Code;
            this.num  = val.num;
            var lc = val.cards;

            if (lc.ToList().Count > 0)
            {
                if (lc.ToList().FirstOrDefault().card_7isab?.ToList().FirstOrDefault().visa != null)
                {
                    visibility = Visibility.Hidden;
                }
            }
            this.date    = process.date.GetDateTimeFormats()[0];
            this.nowcost = process.NewCost;
            parts        = new ObservableCollection <ItemPart>(val.parts.ToList().Select(p => new ItemPart(p)
            {
                action = (t) => {
                    parts.Remove(t);
                },

                action_kanoni = () => {
                    var card = Ico.getValue <db>().GetUnivdb().card_kanoni.ToList().Where(c => c.id_part == p.Id).FirstOrDefault();

                    if (card == null)
                    {
                        Sample4Content = new AddPartCard(p, AcceptSample4Dialog, CancelSample4Dialog);
                        OpenSample4Dialog();
                    }
                    else
                    {
                        Ico.getValue <ContentApp>().page = new Viewkanoni(card);
                    }
                }
            }));
            back = new Command(() => {
                Ico.getValue <ContentApp>().back();
            });
            addpart = new Command(() => {
                Ico.getValue <ContentApp>().page = new AddPart(val);
            });
            card_s7ab = new Command(() => {
                Ico.getValue <ContentApp>().page = new Viewsa7ab(val);
            });
            card_7isab = new Command(() => {
                //   Univ.lib.Card_7isab card = new Univ.lib.Card_7isab(new processes(process));
                Ico.getValue <ContentApp>().page = new View7isab(process);
            });
            viewcardmo7sabi = new Command(() => {
                //  Ico.getValue<ContentApp>().page = new Addmo7asbi( process);
                OpenSample4Dialog();
            });
            card_mo7asbi = new Command(() => {
                //  Task.Run(()=> { Card_mo7sabi card = new Card_mo7sabi(new processes(process)); });
            });
        }
コード例 #2
0
        public void inTilData()
        {
            this.actionUP();

            this.name = val.Name;
            this.code = val.Code;
            this.num  = val.num;
            var lc = val.cards;

            if (lc.ToList().Count > 0)
            {
                var a = lc.ToList().Where(c => c.card_7isab.Count > 0).FirstOrDefault();
                if (a != null)
                {
                    if (a.card_7isab?.ToList().FirstOrDefault() != null)
                    {
                        visibility = Visibility.Collapsed;
                    }
                }
            }
            this.date    = val.date.GetDateTimeFormats()[0];
            this.nowcost = val.NewCost;
            parts        = new ObservableCollection <ItemPart>(val.parts.ToList().Select(p => new ItemPart(p)
            {
                action = (t) =>
                {
                    OpenSample4Dialog();

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

                        parts.Remove(t);
                    },
                                                 () => {
                        CancelSample4Dialog();
                    });
                },

                action_kanoni = () =>
                {
                    var card = Ico.getValue <db>().GetUnivdb().card_kanoni.ToList().Where(c => c.id_part == p.Id).FirstOrDefault();

                    if (card == null)
                    {
                        Sample4Content = new AddPartCard(p, AcceptSample4Dialog, CancelSample4Dialog);
                        OpenSample4Dialog();
                    }
                    else
                    {
                        Ico.getValue <ContentApp>().page = new Viewkanoni(card);
                    }
                }
            }));
        }
コード例 #3
0
        public void inTilData()
        {
            this.actionUP();

            this.name = val.Name;
            this.code = val.Code;
            this.num  = val.num;
            var lc = val.cards;

            if (lc.ToList().Count > 0)
            {
                var a = lc.ToList().FirstOrDefault();
                if (a != null)
                {
                    if (a.card_7isab?.ToList().FirstOrDefault().visa != null)
                    {
                        visibility = Visibility.Hidden;
                    }
                }
            }
            this.date    = val.date.GetDateTimeFormats()[0];
            this.nowcost = val.NewCost;
            parts        = new ObservableCollection <ItemPart>(val.parts.ToList().Select(p => new ItemPart(p)
            {
                action = (t) =>
                {
                    parts.Remove(t);
                },

                action_kanoni = () =>
                {
                    var card = Ico.getValue <db>().GetUnivdb().card_kanoni.ToList().Where(c => c.id_part == p.Id).FirstOrDefault();

                    if (card == null)
                    {
                        Sample4Content = new AddPartCard(p, AcceptSample4Dialog, CancelSample4Dialog);
                        OpenSample4Dialog();
                    }
                    else
                    {
                        Ico.getValue <ContentApp>().page = new Viewkanoni(card);
                    }
                }
            }));
        }
コード例 #4
0
        public void inTilData()
        {
            this.actionUP();

            this.name = val.Name;
            this.code = val.Code;
            this.num  = val.num;
            var lc = val.cards;

            if (lc.ToList().Count > 0)
            {
                var a = lc.ToList().Where(c => c.card_7isab.Count > 0).FirstOrDefault();
                if (a != null)
                {
                    if (a.card_7isab?.ToList().FirstOrDefault() != null && a.card_7isab?.ToList().FirstOrDefault().visa != null)
                    {
                        visibility = Visibility.Collapsed;
                    }
                }
            }
            this.date    = val.date.GetDateTimeFormats()[0];
            this.nowcost = val.NewCost;
            parts        = new ObservableCollection <ItemPart>(val.parts.ToList().Select(p => new ItemPart(p)
            {
                action = (t) =>
                {
                    var prr = Ico.getValue <db>().GetUnivdb().parts.ToList().Where(pr => pr.Id == p.Id).FirstOrDefault();
                    if (prr.card_mo7sabi.ToList().Count == 0 && prr.card_dafa3.ToList().Count == 0)
                    {
                        Ico.getValue <ContentApp>().OpenSample4Dialog();
                        Ico.getValue <ContentApp>().Sample4Content = new YesOrNo("هل أنت متأكد من قيامك بحذف هذه الحصة من العملية ,لا يمكن التراجع عن الحذف",
                                                                                 async() => {
                            AcceptSample4Dialog();
                            await Task.Run(() => {
                                Ico.getValue <db>().GetUnivdb().parts.Remove(prr);
                                Ico.getValue <db>().savedb();
                                Ico.getValue <ContentApp>().CancelSample4Dialog();
                            });

                            parts.Remove(t);
                        }, Ico.getValue <ContentApp>().CancelSample4Dialog);
                    }
                    else
                    {
                        Ico.getValue <ContentApp>().OpenSample4Dialog();
                        Ico.getValue <ContentApp>().Sample4Content = new Messagebox(new List <string> {
                            "الرجاء حذف جميع البطاقات الخاصة بالحصة  ومن ثم أعد المحاولة مرة أخرى "
                        },
                                                                                    Ico.getValue <ContentApp>().CancelSample4Dialog);
                    }
                },

                action_kanoni = () =>
                {
                    var card = Ico.getValue <db>().GetUnivdb().card_kanoni.ToList().Where(c => c.id_part == p.Id).FirstOrDefault();

                    if (card == null)
                    {
                        Sample4Content = new AddPartCard(p, AcceptSample4Dialog, CancelSample4Dialog);
                        OpenSample4Dialog();
                    }
                    else
                    {
                        Ico.getValue <ContentApp>().page = new Viewkanoni(card);
                    }
                }
            }));
        }