Example #1
0
        public ObservableCollection <ItemDafa3> CreateItem()
        {
            return(new ObservableCollection <ItemDafa3>(part.part.card_dafa3.Select(ct => new ItemDafa3(ct)
            {
                Viewdafa3VewModel = this,
                end = CancelSample4Dialog,
                action = (t) => {
                    OpenSample4Dialog();

                    Sample4Content = new YesOrNo("هل أنت متأكد من قيامك بحذف هذه الحصة من العملية ,لا يمكن التراجع عن الحذف",
                                                 async() => {
                        AcceptSample4Dialog();
                        await Task.Run(() => {
                            Ico.getValue <db>().GetUnivdb().parts.ToList().Where(c => c.Id == ct.id_part).ToList().SingleOrDefault().nowcost -= t;
                            Ico.getValue <db>().GetUnivdb().card_dafa3.Remove(Ico.getValue <db>().GetUnivdb().card_dafa3.ToList().Where(c => c.Id == ct.Id).FirstOrDefault());
                            Ico.getValue <db>().savedb();

                            CancelSample4Dialog();
                        });
                    },
                                                 () => {
                        CancelSample4Dialog();
                    });
                },
                action_edit = (t) => {
                    Ico.getValue <ContentApp>().Sample4Content = new Editdafa3(t, inTilData);
                    Ico.getValue <ContentApp>().OpenSample4Dialog();
                },
                addtswiya = (t) => {
                    OpenSample4Dialog();

                    Sample4Content = new YesOrNo(" إذا أضفت التسوية لن تستطيع التراجع عن البطاقة, الرجاء والتأكد قبل ذالك ", () => {
                        Ico.getValue <ContentApp>().OpenSample4Dialog();

                        Ico.getValue <ContentApp>().Sample4Content = new Addtswiya(t, inTilData);
                    }, Ico.getValue <ContentApp>().CancelSample4Dialog);
                },
                edittswiyaaction = (t) => {
                    Ico.getValue <ContentApp>().Sample4Content = new Edittswiya(t, inTilData);
                    Ico.getValue <ContentApp>().OpenSample4Dialog();
                }
            })));
        }
        public Edittashira_mo7asabi_VewModel(card_mo7sabi card_mo7sabi)
        {
            this.num    = card_mo7sabi.num.ToString();
            this.visa   = card_mo7sabi.visa;
            this.part   = card_mo7sabi.part.Name;
            this.cost   = String.Format("{0:0.00}", card_mo7sabi.cost);
            savecommand = new Command(() =>
            {
                Ico.getValue <ContentApp>().AcceptSample4Dialog();
                Ico.getValue <db>().GetUnivdb().card_mo7sabi.ToList().Where(d => d.Id == card_mo7sabi.Id).ToList().FirstOrDefault().visa = visa;
                Ico.getValue <db>().savedb();
                acc();
                Ico.getValue <ContentApp>().CancelSample4Dialog();
            });

            Cancelcommand = new Command(() => {
                Ico.getValue <ContentApp>().CancelSample4Dialog();
            });
        }
        public processesViewMODEL(process process)
        {
            Name = process.Name;
            Code = process.Code;
            date = process.date.ToShortDateString();
            double d = 0d;

            foreach (part p in process.parts.ToList())
            {
                d += p.Cost;
            }
            var lc = process.cards;

            visibility = Visibility.Visible;
            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;
                    }
                }
            }
            Cost    = String.Format("{0:0.00}", d);
            nowCost = String.Format("{0:0.00}", process.NewCost);
            view    = new Command(() => {
                Ico.getValue <ContentApp>().page = new ViewProcesses(process);
            });
            edit = new Command(() => {
                Ico.getValue <ContentApp>().page = new EditProcesses(process);
                // MessageBox.Show(Ico.getValue<ContentApp>().page.ToString());
            });
            removte = new Command(() => {
                //  Ico.getValue<ContentApp>().page = new EditProcesses(process);
                // MessageBox.Show(Ico.getValue<ContentApp>().page.ToString());
                MessageBox.Show("ok1");

                removeaction();
            });
        }
Example #4
0
        public async Task Craete_Card(process process)
        {
            await Task.Run(() => {
                var d    = DateTime.Now;
                var name = "بطاقة سحب الإلتزام سنة " + d.Year;

                var car = new card()
                {
                    date       = DateTime.Now,
                    id_prosess = process.Id,
                    num        = 1,
                    year       = Ico.getValue <Date>().GetNowDate().Id,
                    location   = Ico.getValue <IO>().CREATE_F_sa7ab(process.location) + "\\" + name
                };
                var card_sa7ab = new card_sa7ab()
                {
                    cost     = sa7abCost,
                    card     = car,
                    visa     = null,
                    old_cost = Cost
                };

                Ico.getValue <db>().GetUnivdb().cards.Add(car);
                Ico.getValue <db>().GetUnivdb().card_sa7ab.Add(card_sa7ab);
                Ico.getValue <db>().GetUnivdb().processes.ToList().Where(pr => pr.Id == process.Id).ToList().First().NewCost += sa7abCost;

                foreach (var p in Ico.getValue <db>().GetUnivdb().parts.ToList().Where(pr => pr.Id_Pro == pr.Id_Pro).ToList())
                {
                    Ico.getValue <db>().GetUnivdb().parts.ToList().Where(pr => pr.Id == p.Id).First().mcost = p.nowcost;
                }

                Ico.getValue <db>().savedb();
                var i = Ico.getValue <db>().GetUnivdb().card_sa7ab.ToList().Where(c => c.card.year == Ico.getValue <Date>().GetNowDate().Id).FirstOrDefault().id;
                foreach (p_sa7ab p in ps)
                {
                    p.id_sa7ab = i;
                }
                Ico.getValue <db>().GetUnivdb().p_sa7ab.AddRange(ps);
                Ico.getValue <db>().savedb();
                con();
            });
        }
Example #5
0
        public Addmo7asabiVewModel(card_kanoni card_kanoni)
        {
            part          = card_kanoni.part;
            this.namepro  = card_kanoni.part.process.Name;
            this.cost     = card_kanoni.cost;
            this.namepart = part.Name;
            this.client   = card_kanoni.client.Name;
            //  var carda = Ico.getValue<db>().GetUnivdb().years.Where(y => y.year1.Year == DateTime.Now.Year).ToList().FirstOrDefault().cards.ToList().Where(c => c.id_prosess == card_kanoni.part.Id_Pro)
            //    .ToList().FirstOrDefault();

            var carda = Ico.getValue <db>().GetUnivdb().card_mo7sabi.ToList().Where(c => (c.card.year == Ico.getValue <Date>().GetNowDate().Id) && c.id_part == card_kanoni.id_part)
                        .ToList().OrderByDescending(c => c.num).ToList().FirstOrDefault();

            //.card_mo7sabi.Where(c=>c.id_part== card_kanoni.id_part).OrderByDescending(c=>c.num).LastOrDefault();

            numm = 1;
            if (carda != null)
            {
                numm = carda.num + 1;
            }
            var nums = (numm.ToString().Length == 1) ? "0" + numm.ToString() : numm.ToString();

            this.subject = "الإلتزام المحاسبي رقم " + nums + " للعقد المتعلق بالعملية " + part.process.Name;

            savecommand = new Command(() =>
            {
                if ((part.Cost - part.mcost) >= Cost)
                {
                    acc();
                    Creat_card(card_kanoni);
                    con();
                }
                else
                {
                    MessageBox.Show("المبلغ أكبر من الرصيد المتاح");
                }
            });
            Cancelcommand = new Command(() =>
            {
                con();
            });
        }
Example #6
0
        public async Task Creat_card(card_kanoni card_kanoni)
        {
            await Task.Run(() =>
            {
                var card = Ico.getValue <db>().GetUnivdb().cards.ToList().Where(c => c.id_prosess == card_kanoni.part.Id_Pro && c.year == Ico.getValue <Date>().GetNowDate().Id).OrderByDescending(c => c.num).ToList().FirstOrDefault();
                var num  = 1;
                if (card != null)
                {
                    num = card.num + 1;
                }

                var d    = DateTime.Now;
                var name = "بطاقة إلتزام محاسبي رقم " + num + " سنة " + d.Year;

                var car = new card()
                {
                    date       = DateTime.Now,
                    id_prosess = card_kanoni.part.Id_Pro,
                    num        = Ico.getValue <db>().GetUnivdb().cards.ToList().Where(c => c.id_prosess == card_kanoni.part.Id_Pro).LastOrDefault().num + 1,
                    year       = Ico.getValue <db>().GetUnivdb().years.ToList().LastOrDefault().Id
                    ,
                    location = Ico.getValue <IO>().CREATE_F_mo7asabi(part.process.location) + "\\" + name
                };
                var card_mo7sabi = new card_mo7sabi()
                {
                    id_client = card_kanoni.id_client,
                    id_part   = card_kanoni.id_part,
                    cost      = Cost,
                    oldCost   = card_kanoni.part.process.NewCost,
                    card      = car,
                    num       = numm,
                    visa      = null,
                    subject   = subject
                };

                Ico.getValue <db>().GetUnivdb().processes.ToList().Where(p => p.Id == card_kanoni.part.Id_Pro).ToList().First().NewCost -= Cost;
                Ico.getValue <db>().GetUnivdb().parts.ToList().Where(p => p.Id == card_kanoni.id_part).ToList().First().mcost           += Cost;
                Ico.getValue <db>().GetUnivdb().cards.Add(car);
                Ico.getValue <db>().GetUnivdb().card_mo7sabi.Add(card_mo7sabi);
                Ico.getValue <db>().savedb();
            });
        }
Example #7
0
        public void inTilData(process process)
        {
            this.process = process;
            var cl = Ico.getValue <db>().GetUnivdb().card_sa7ab.ToList().ToList().LastOrDefault();

            if (cl != null)
            {
                this.oldcost = cl.old_cost;
            }
            else
            {
                this.oldcost = process.NewCost;
                this.newcost = process.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)
            {
                action_edit = (t) => {
                    //   Sample4Content = new Editmo7asabi(t, AcceptSample4Dialog, CancelSample4Dialog);
                    OpenSample4Dialog();
                },
                start = () => { AcceptSample4Dialog();
                                AcceptSample4Dialog(); },
                end        = CancelSample4Dialog,
                addtashira = (t) => {
                    //  Sample4Content = new Addtashira_mo7asabi(t, AcceptSample4Dialog, CancelSample4Dialog);
                    OpenSample4Dialog();
                    this.inTilData(Ico.getValue <db>().GetUnivdb().processes.ToList().Where(N => N.Id == process.Id).ToList().SingleOrDefault());
                },
                edittashiraaction = (t) => {
                    //Sample4Content = new Edittashira_mo7asabi(t, AcceptSample4Dialog, CancelSample4Dialog);
                    OpenSample4Dialog();
                }
            }));

            addmo7asabi = new Command(() => {
                //      if (Ico.getValue<Date>().GetPevDate() != null && process.cards.ToList().LastOrDefault().year1.Id== Ico.getValue<Date>().GetPevDate().Id
                if (Ico.getValue <db>().GetUnivdb().card_sa7ab.ToList().Where(c => c.card.id_prosess == process.Id && c.card.year1.Id == Ico.getValue <Date>().GetPevDate().Id).ToList().Count == 0)
                {
                    Sample4Content = new Addsa7ab(process, AcceptSample4Dialog, CancelSample4Dialog);
                    OpenSample4Dialog();
                }
            });
        }
        public ViewClientViewModel()
        {
            actionUP = () =>

            {
                val = new ObservableCollection <ClientPartViewModel>(Ico.getValue <db>().GetUnivdb().clients.ToList().Select(c => new ClientPartViewModel(c)
                {
                    deleteAc = (t) =>
                    {
                        Ico.getValue <db>().GetUnivdb().clients.Remove(
                            Ico.getValue <db>().GetUnivdb().clients.ToList().Where(cl => cl.Id == c.Id).FirstOrDefault());
                        Ico.getValue <db>().savedb();
                        inTilData();
                    },
                    editAc = () =>
                    {
                        Ico.getValue <ContentApp>().page = new EditClient(c);
                    }
                }));
                Clients = val;
            };
            actionUP();
            new_ = new Command(() => {
                Ico.getValue <ContentApp>().page = new AddCLient();
            });
            Serech = new CommandPar((t) => {
                var text = (string)t;
                Clients  = new ObservableCollection <ClientPartViewModel>(Ico.getValue <db>().GetUnivdb().clients.ToList().Select(c => new ClientPartViewModel(c)
                {
                    deleteAc = (tc) => {
                        Clients.Remove(tc as ClientPartViewModel);
                    },
                    editAc = () =>
                    {
                        Ico.getValue <ContentApp>().page = new EditClient(c);
                    }
                }

                                                                                                                                  ).Where((l) => l.Name.Contains(text) || l.numaccount.Contains(text) || l.bank.Contains(text))
                                                                          );
            });
        }
Example #9
0
        public processesViewMODEL(process process)
        {
            Name = process.Name;
            Code = process.Code;
            double d = 0d;

            foreach (part p in process.parts.ToList())
            {
                d += p.Cost;
            }
            Cost    = String.Format("{0:0.00}", d);
            nowCost = String.Format("{0:0.00}", process.NewCost);
            view    = new Command(() => {
                Ico.getValue <ContentApp>().page = new ViewProcesses(process);
            });
            edit = new Command(() => {
                Ico.getValue <ContentApp>().page = new EditProcesses(process);
                // MessageBox.Show(Ico.getValue<ContentApp>().page.ToString());
            });
        }
        public EdittswiyaVewModel(card_dafa3 card_dafa3)
        {
            this.num    = card_dafa3.num.ToString();
            this.part   = card_dafa3.part.Name;
            this.tswiya = card_dafa3.tswiya;
            this.cost   = String.Format("{0:0.00}", card_dafa3.Cost);
            savecommand = new Command(() =>
            {
                acc();
                Ico.getValue <db>().GetUnivdb().card_dafa3.ToList().Where(d => d.Id == card_dafa3.Id).ToList().FirstOrDefault().kasima = tswiya;
                Ico.getValue <db>().savedb();
                Card_dafa3Execl c7 = new Card_dafa3Execl(Ico.getValue <db>().GetUnivdb().card_dafa3.ToList().Where(c => c.Id == card_dafa3.Id).FirstOrDefault());
                c7.CreateCard();
                con();
            });

            Cancelcommand = new Command(() => {
                con();
            });
        }
        public NewprocessesViewModel()
        {
            save = new Command(() => {
                double totalCoast = 0;
                var p             = new process()
                {
                    Name     = Name,
                    date     = date,
                    Code     = Code,
                    num      = Num,
                    NewCost  = totalCoast,
                    location = Ico.getValue <IO>().CREATE_FOLDER(Code)
                };
                Ico.getValue <db>().GetUnivdb().processes.Add(p);
                Ico.getValue <db>().GetUnivdb().SaveChanges();

                Ico.getValue <ContentApp>().page = new PCrad();
                Ico.getValue <ContentApp>().clear();
            });
        }
Example #12
0
        public Addtashira_7isabi_VewModel(card_7isab card_7isab)
        {
            this.num    = card_7isab.card.num.ToString();
            this.part   = card_7isab.card.process.Name;
            savecommand = new Command(async() =>
            {
                Ico.getValue <ContentApp>().AcceptSample4Dialog();
                await Task.Run(() =>
                {
                    Ico.getValue <db>().GetUnivdb().card_7isab.ToList().Where(d => d.Id == card_7isab.Id).ToList().FirstOrDefault().visa = visa;
                    Ico.getValue <db>().savedb();
                    acc();
                    Ico.getValue <ContentApp>().CancelSample4Dialog();
                });
            });

            Cancelcommand = new Command(() => {
                Ico.getValue <ContentApp>().CancelSample4Dialog();
            });
        }
Example #13
0
        public ViewpartViewModel(part part)
        {
            this.cost    = part.Cost;
            this.name    = part.Name;
            this.process = part.process;

            this.Code    = process.Code;
            this.Name    = process.Name;
            this.alhcost = part.alpart;

            foreach (part p in process.parts.ToList())
            {
                nowcost += p.Cost;
            }
            type = new TypePart(part.num_type);

            back = new Command(() => {
                Ico.getValue <ContentApp>().back();
            });
        }
Example #14
0
        public Viewdafa3VewModel(part part)
        {
            this.actionUP = () => {
                this.val = Ico.getValue <db>().GetUnivdb().parts.ToList().Where(p => p.Id == part.Id).ToList().FirstOrDefault();
            };

            this.inTilData();
            this.client = part.card_kanoni.ToList().FirstOrDefault().client.Name;
            visa        = "لم يتحصل على فيزا إلى حد الان ..";
            back        = new  Command(() => {
                Ico.getValue <ContentApp>().back();
            });

            AddDafa3 = new Command(() => {
                Sample4Content = new Adddafa3(part, AcceptSample4Dialog, CancelSample4Dialog, () => {
                    this.inTilData();
                });
                OpenSample4Dialog();
            });
        }
Example #15
0
        public void inTilData(card_kanoni card_kanoni)
        {
            this.process  = card_kanoni.card.process;
            this.part     = new Part(card_kanoni.part);
            this.client   = card_kanoni.client.Name;
            this.newcost  = card_kanoni.part.process.NewCost;
            ItemMo7asabis = new ObservableCollection <ItemMo7asabi>(card_kanoni.part.card_mo7sabi.Select(c => new ItemMo7asabi(c)
            {
                action_edit = (t) => {
                    Sample4Content = new Editmo7asabi(t, AcceptSample4Dialog, CancelSample4Dialog);
                    OpenSample4Dialog();
                },
                start = () => { AcceptSample4Dialog();
                                AcceptSample4Dialog(); },
                end        = CancelSample4Dialog,
                addtashira = (t) => {
                    Sample4Content = new Addtashira_mo7asabi(t, AcceptSample4Dialog, CancelSample4Dialog);
                    OpenSample4Dialog();
                    this.inTilData(Ico.getValue <db>().GetUnivdb().card_kanoni.ToList().Where(N => N.id == card_kanoni.id).ToList().SingleOrDefault());
                },
                edittashiraaction = (t) => {
                    Sample4Content = new Edittashira_mo7asabi(t, AcceptSample4Dialog, CancelSample4Dialog);
                    OpenSample4Dialog();
                }
            }));

            addmo7asabi = new Command(() => {
                var card = Ico.getValue <db>().GetUnivdb().card_mo7sabi.ToList().Where(c => c.id_part == card_kanoni.id_part).ToList().FirstOrDefault();

                if (card != null && card.card.year != Ico.getValue <Date>().GetNowDate()?.Id&& Ico.getValue <db>().GetUnivdb().card_sa7ab.ToList().Where(c =>
                                                                                                                                                         c.card.id_prosess == card_kanoni.card.id_prosess && c.card.year == Ico.getValue <Date>().GetNowDate().Id).ToList().ToList().Count == 0)
                {
                    MessageBox.Show(" الرجاء التأكد من إستخراج بظاقة سحب إلتزام مسبقاا  ");
                }
                else
                {
                    Sample4Content = new Addmo7asabi(card_kanoni, AcceptSample4Dialog, CancelSample4Dialog);
                    OpenSample4Dialog();
                }
            });
        }
        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)
            {
                if (lc.ToList().FirstOrDefault().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);
                    }
                }
            }));
        }
        public View7isabViewModel(process process)
        {
            this.actionUP = () =>
            {
                this.val = Ico.getValue <db>().GetUnivdb().card_7isab.ToList().Where(c => c.card.id_prosess == process.Id).FirstOrDefault();
            };

            this.process = process;
            parts        = process.parts.ToList();
            foreach (part part in parts)
            {
                newcost += part.Cost;
                MessageBox.Show(part.Name);
            }
            MessageBox.Show("" + newcost);

            var card_7 = Ico.getValue <db>().GetUnivdb().card_7isab.ToList().Where(c => c.card.id_prosess == process.Id).FirstOrDefault();

            if (card_7 == null || card_7.visa == null)
            {
                if (card_7 != null)
                {
                    Ico.getValue <IO>().DELETE_FILE(card_7.card.location + ".xlsx");
                    Ico.getValue <db>().GetUnivdb().card_7isab.Remove(Ico.getValue <db>().GetUnivdb().card_7isab.ToList().Where(c => c.Id == card_7.Id).FirstOrDefault());
                    Ico.getValue <db>().GetUnivdb().cards.Remove(Ico.getValue <db>().GetUnivdb().cards.ToList().Where(c => c.Id == card_7.id_card).FirstOrDefault());
                }
                OpenSample4Dialog();
                AcceptSample4Dialog();
                this.CreateCard(card_7);
            }
            else
            {
                this.inTilData();
            }



            back = new Command(() => {
                Ico.getValue <ContentApp>().back();
            });
        }
Example #18
0
        public void inTilData(process process)
        {
            this.process = process;
            var cl = Ico.getValue <db>().GetUnivdb().card_sa7ab.ToList().ToList().LastOrDefault();

            if (cl != null)
            {
                this.oldcost = cl.old_cost;
            }
            else
            {
                this.oldcost = process.NewCost;
                this.newcost = process.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)
            {
                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(() => {
                if (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)
                {
                    MessageBox.Show("لا تستطيغ إستخراج باقة سحب بعد");
                }
                else
                {
                    Sample4Content = new Addsa7ab(process, AcceptSample4Dialog, CancelSample4Dialog);
                    OpenSample4Dialog();
                }
            });
        }
Example #19
0
        public AddpartCardViewModel(part part, Action accept, Action Cancel)
        {
            this.namepart    = part.Name;
            this.cost        = part.Cost;
            this.nameprocess = part.process.Name;
            this.part        = part;
            clients          = Ico.getValue <db>().GetUnivdb().clients.ToList();

            savecommand = new Command(() =>
            {
                accept();
            });
            Cancelcommand = new Command(() =>
            {
                Cancel();
            });
            addclient = new Command(() =>
            {
                Ico.getValue <ContentApp>().page = new AddClient();
            });
        }
Example #20
0
    public  loginModelView() {
            login = new CommandPar((p)=> {

                var passwordBox = p as PasswordBox ;
                var password = passwordBox.Password;
                var user = Ico.getValue<db>().GetUnivdb().users.ToList().Where(u => u.username.Equals(username) && u.passoword.Equals(password)).ToList().FirstOrDefault();
                MessageBox.Show(user+");
                if (user == null)
                {
                    erour = Visibility.Visible;

                }
                else
                {
                    erour = Visibility.Collapsed;

                    Ico.setValue<user>(user);
                    MessageBox.Show("JL HG]O,G FK[HP ");
                }
            });
        }
        public AddtswiyaVewModel(card_dafa3 card_dafa3)
        {
            this.num    = card_dafa3.num.ToString();
            this.part   = card_dafa3.part.Name;
            this.cost   = String.Format("{0:0.00}", card_dafa3.Cost);
            savecommand = new Command(() =>
            {
                Ico.getValue <ContentApp>().OpenSample4Dialog();
                Ico.getValue <ContentApp>().AcceptSample4Dialog();
                Ico.getValue <db>().GetUnivdb().card_dafa3.ToList().Where(d => d.Id == card_dafa3.Id).ToList().FirstOrDefault().kasima = tswiya;
                Ico.getValue <db>().savedb();
                Card_dafa3Execl c7 = new Card_dafa3Execl(Ico.getValue <db>().GetUnivdb().card_dafa3.ToList().Where(c => c.Id == card_dafa3.Id).FirstOrDefault());
                c7.CreateCard();
                acc();
                Ico.getValue <ContentApp>().CancelSample4Dialog();
            });

            Cancelcommand = new Command(() => {
                Ico.getValue <ContentApp>().CancelSample4Dialog();
            });
        }
Example #22
0
        public Addtashira_kanoni_VewModel(card_kanoni card_kanoni)
        {
            this.num    = card_kanoni.card.num.ToString();
            this.part   = card_kanoni.part.Name;
            this.cost   = String.Format("{0:0.00}", card_kanoni.cost);
            savecommand = new Command(async() =>
            {
                Ico.getValue <ContentApp>().AcceptSample4Dialog();
                await Task.Run(() =>
                {
                    Ico.getValue <db>().GetUnivdb().card_kanoni.ToList().Where(d => d.id == card_kanoni.id).ToList().FirstOrDefault().visa = visa;
                    Ico.getValue <db>().savedb();
                    acc();
                    Ico.getValue <ContentApp>().CancelSample4Dialog();
                });
            });

            Cancelcommand = new Command(() => {
                Ico.getValue <ContentApp>().CancelSample4Dialog();
            });
        }
        public async Task Creat_card(part part)
        {
            await Task.Run(() =>
            {
                var cardn = Ico.getValue <db>().GetUnivdb().cards.ToList().Where(c => c.id_prosess == part.Id_Pro && c.year == Ico.getValue <Date>().GetNowDate().Id).OrderByDescending(c => c.num).ToList().FirstOrDefault();
                var num   = 1;
                if (cardn != null)
                {
                    num = cardn.num + 1;
                }


                var d    = DateTime.Now;
                var name = "بطاقة إلتزام قانوني رقم " + num + " سنة " + d.Year;

                var card = new card()
                {
                    id_prosess = part.process.Id,
                    year       = Ico.getValue <db>().GetUnivdb().years.ToList().LastOrDefault().Id,
                    num        = num,
                    location   = Ico.getValue <IO>().CREATE_F_kanoni(part.process.location) + "\\" + name,
                    date       = DateTime.Now,
                };
                var kanoni = new card_kanoni()
                {
                    card      = card,
                    id_client = client.Id,
                    id_part   = part.Id,
                    cost      = part.Cost,
                    visa      = null
                };

                Ico.getValue <db>().GetUnivdb().cards.Add(card);
                Ico.getValue <db>().GetUnivdb().card_kanoni.Add(kanoni);
                Ico.getValue <db>().savedb();
                Card_kanoniExecl card_Kanoni = new Card_kanoniExecl(Ico.getValue <db>().GetUnivdb().card_kanoni.ToList().Where(c => c.id_part == part.Id).ToList().FirstOrDefault());
                card_Kanoni.CreateCard();
                Cancel();
            });
        }
        public AddpartCardViewModel(part part, Action accept, Action Cancel)
        {
            this.namepart    = part.Name;
            this.cost        = part.Cost;
            this.nameprocess = part.process.Name;
            this.part        = part;
            clients          = Ico.getValue <db>().GetUnivdb().clients.ToList();

            savecommand = new Command(() => {
                accept();

                var card = new card()
                {
                    id_prosess = part.process.Id,
                    year       = Ico.getValue <db>().GetUnivdb().years.ToList().LastOrDefault().Id,
                    num        = Ico.getValue <db>().GetUnivdb().cards.ToList().Where(c => c.id_prosess == part.process.Id).ToList().Count + 1,
                    location   = "",
                    date       = DateTime.Now,
                };
                var kanoni = new card_kanoni()
                {
                    card      = card,
                    id_client = client.Id,
                    id_part   = part.Id,
                    cost      = part.Cost,
                    visa      = null
                };

                Ico.getValue <db>().GetUnivdb().cards.Add(card);
                Ico.getValue <db>().GetUnivdb().card_kanoni.Add(kanoni);
                Ico.getValue <db>().savedb();
                Cancel();
            });
            Cancelcommand = new Command(() => {
                Cancel();
            });
            addclient = new Command(() => {
                Ico.getValue <ContentApp>().page = new AddClient();
            });
        }
Example #25
0
        public ViewProcessViewModel(process process)
        {

            this.actionUP = () =>
            {
                this.val = Ico.getValue<db>().GetUnivdb().processes.ToList().Where(p => p.Id == process.Id).ToList().FirstOrDefault();
            };
            this.inTilData();
            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(val);

            });
            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)); });
            });



        }
Example #26
0
        public View7isabViewModel(process process)
        {
            this.actionUP = () =>
            {
                this.val = Ico.getValue <db>().GetUnivdb().card_7isab.ToList().Where(c => c.card.id_prosess == process.Id).FirstOrDefault();
            };

            this.process = process;
            parts        = process.parts.ToList();

            foreach (part part in parts)
            {
                newcost += part.Cost;
            }

            var card_7 = Ico.getValue <db>().GetUnivdb().card_7isab.ToList().Where(c => c.card.id_prosess == process.Id).FirstOrDefault();

            if (card_7 == null)
            {
                OpenSample4Dialog();
                AcceptSample4Dialog();
                this.CreateCard(card_7);
            }
            else
            {
                this.inTilData();
            }



            back = new Command(() => {
                Ico.getValue <ContentApp>().back();
            });
            open = new Command(() => {
                Ico.getValue <ContentApp>().back();
            });
            print = new Command(() => {
                Ico.getValue <ContentApp>().back();
            });
        }
        public async Task Creat_card(part part)
        {
            erour = new List <string>();

            if (name.ToString().Length == 0)
            {
                erour.Add("الرجاء كتابة إسم الحصة ");
            }
            await Task.Run(() =>
            {
                var card = Ico.getValue <db>().GetUnivdb().card_dafa3.ToList().Where(c => c.id_part == part.Id && c.id_year == Ico.getValue <Date>().GetNowDate().Id).OrderByDescending(c => c.num).ToList().FirstOrDefault();
                var num  = 1;
                if (card != null)
                {
                    num = card.num + 1;
                }
                var d          = DateTime.Now;
                var name       = "بطاقة دفع رقم " + num + " سنة " + d.Year;
                var card_dafa3 = new card_dafa3()
                {
                    date     = d,
                    num      = num,
                    id_part  = part.Id,
                    Cost     = Cost,
                    alcost   = AlCost,
                    location = Ico.getValue <IO>().CREATE_F_dafa3(part.process.location) + "\\" + name,
                    id_year  = Ico.getValue <Date>().GetNowDate().Id,
                    tswiya   = null
                };
                Ico.getValue <db>().GetUnivdb().parts.ToList().Where(c => c.Id == part.Id).SingleOrDefault().nowcost += Cost;
                //  Ico.getValue<db>().GetUnivdb().processes.ToList().Where(p => p.Id == card_kanoni.part.Id_Pro).ToList().First().parts.ToList().Where(p => p.Id == card_kanoni.id_part).ToList().First().nowcost += Cost;

                Ico.getValue <db>().GetUnivdb().card_dafa3.Add(card_dafa3);
                Ico.getValue <db>().savedb();
                Card_dafa3Execl c7 = new Card_dafa3Execl(Ico.getValue <db>().GetUnivdb().card_dafa3.ToList().Where(c => c.num == num && c.id_year == Ico.getValue <Date>().GetNowDate().Id).FirstOrDefault());
                c7.CreateCard();

                con();
            });
        }
 public SettingModelView()
 {
     val           = Ico.getValue <db>().GetUnivdb().settings.ToList().FirstOrDefault();
     TempalePath   = val.locationTem;
     PathFileSave  = val.locationFile;
     date          = DateTime.Now;
     PathFileSavec = new Command(() => {
         var folderDialog = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog();
         var folderResult = folderDialog.ShowDialog();
         if (folderResult.HasValue && folderResult.Value)
         {
             PathFileSave = folderDialog.SelectedPath;
         }
     }); TempalePathc = new Command(() => {
         var folderDialog = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog();
         var folderResult = folderDialog.ShowDialog();
         if (folderResult.HasValue && folderResult.Value)
         {
             PathFileSave = folderDialog.SelectedPath;
         }
     });
 }
Example #29
0
        public ObservableCollection <ItemDafa3> CreateItem()
        {
            return(new ObservableCollection <ItemDafa3>(part.part.card_dafa3.Select(ct => new ItemDafa3(ct)
            {
                action = (t) => {
                    OpenSample4Dialog();

                    Sample4Content = new YesOrNo("هل أنت متأكد من قيامك بحذف هذه الحصة من العملية ,لا يمكن التراجع عن الحذف",
                                                 async() => {
                        AcceptSample4Dialog();
                        await Task.Run(() => {
                            Ico.getValue <db>().GetUnivdb().parts.ToList().Where(c => c.Id == ct.id_part).ToList().SingleOrDefault().nowcost -= t;
                            Ico.getValue <db>().GetUnivdb().card_dafa3.Remove(Ico.getValue <db>().GetUnivdb().card_dafa3.ToList().Where(c => c.Id == ct.Id).FirstOrDefault());
                            Ico.getValue <db>().savedb();

                            CancelSample4Dialog();
                        });
                    },
                                                 () => {
                        CancelSample4Dialog();
                    });
                },
                action_edit = (t) => {
                    Sample4Content = new Editdafa3(t, AcceptSample4Dialog, CancelSample4Dialog);
                    OpenSample4Dialog();

                    this.inTilData();
                },
                addtswiya = (t) => {
                    Sample4Content = new Addtswiya(t, AcceptSample4Dialog, CancelSample4Dialog);
                    OpenSample4Dialog();
                    this.inTilData();
                },
                edittswiyaaction = (t) => {
                    Sample4Content = new Edittswiya(t, AcceptSample4Dialog, CancelSample4Dialog);
                    OpenSample4Dialog();
                }
            })));
        }
        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(() => {
                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();
                }
            });
        }
Example #31
0
        public static Ico Extract(string FileName, int Index)
        {
            var module = LoadLibrary(FileName);

            try
            {
                // Negative Index stands for Resource ID.
                var resourceData = LoadResource(module, Index < 0 ? Kernel32.FindResource(module, new IntPtr(-Index), ResourceType.GroupIcon)
                                                                  : FindResource(module, Index, ResourceType.GroupIcon));

                // Convert the resouce into an .ico file image.
                using (var resourceReader = new BinaryReader(new MemoryStream(resourceData)))
                {
                    // Read the GroupIconDir header.
                    resourceReader.ReadInt16(); // Reserved
                    resourceReader.ReadInt16(); // icon
                    int numEntries = resourceReader.ReadInt16();

                    var icons = new Ico();

                    for (var i = 0; i < numEntries; i++)
                    {
                        using (var icoStream = new MemoryStream())
                            using (var icoWriter = new BinaryWriter(icoStream))
                        {
                            // Write the IconDir header.
                            icoWriter.Write((short)0); // Reserved
                            icoWriter.Write((short)1); // icon
                            icoWriter.Write((short)1); // make single image icon

                            // Read the GroupIconDirEntry.
                            var grpEntry = resourceReader.Read<IconEntry>();
                            var iconId = resourceReader.ReadInt16();

                            // Write the IconDirEntry.
                            grpEntry.Write(icoStream);

                            icoWriter.Write(22); // offset

                            // Get the icon image raw data and write it to the stream.
                            var imgBuf = LoadResource(module, Kernel32.FindResource(module, (IntPtr)iconId, ResourceType.Icon));

                            icoWriter.Write(imgBuf);

                            icoStream.Seek(0, SeekOrigin.Begin);

                            try
                            {
                                icons.Add(new Icon(icoStream).ToBitmap(), grpEntry.Width);
                            }
                            catch (ArgumentOutOfRangeException)
                            {
                                icons.Add(new Bitmap(new MemoryStream(imgBuf)), grpEntry.Width == 0 ? 256 : grpEntry.Width);
                            }
                        }
                    }

                    return icons;
                }
            }
            finally { Kernel32.FreeLibrary(module); }
        }
Example #32
0
        void Save()
        {
            if (!_sfd.ShowDialog().Value)
                return;

            try
            {
                using (var nico = new Ico())
                {
                    foreach (var item in IconFrames)
                        nico.Add(item.Bitmap, item.Size, item.KeepAspectRatio);

                    nico.Save(_sfd.FileName);
                }
            }
            catch { }
        }