Ejemplo n.º 1
0
        private void label18_Click(object sender, EventArgs e)
        {
            string shenasnameID = GlobalVariable.shenasnameID;

            using (var dbcontext = new Model.Context())
            {
                shenasname shen = dbcontext.shenasnames.SingleOrDefault(x => x.ID == shenasnameID);

                if (shen.final != 1)
                {
                    shen.comment = commentSection.Text;
                    //string parentID = shen.parent;

                    //List<shenasname> shenList = dbcontext.shenasnames.Where(x => x.parent == parentID).ToList();
                    //foreach (shenasname item in shenList)
                    //{
                    //    item.master = "0";
                    //};
                    //shen.isDone = true;
                    //shen.master = "1";
                    //shen.final = 1;
                    dbcontext.SaveChanges();
                }
                //GlobalVariable.shenasnameID = shen.parent;
            }
            this.Hide();
            projectFiles pf = new projectFiles();

            pf.Show();
        }
Ejemplo n.º 2
0
        private void label3_Click(object sender, EventArgs e)
        {
            string shenasnameID = GlobalVariable.shenasnameID;

            using (var dbcontext = new Model.Context())
            {
                shenasname shen = dbcontext.shenasnames.SingleOrDefault(x => x.ID == shenasnameID);

                if (shen.final != 1)
                {
                    string parentID = shen.parent;

                    List <shenasname> shenList = dbcontext.shenasnames.Where(x => x.parent == parentID).ToList();
                    foreach (shenasname item in shenList)
                    {
                        item.master = "0";
                    }
                    ;
                    shen.isDone = true;
                    shen.master = "1";
                    shen.final  = 1;

                    dbcontext.SaveChanges();
                }

                this.Hide();
                Form5_shenasnameList form5 = new Form5_shenasnameList();
                form5.Show();
            }
        }
Ejemplo n.º 3
0
        private void shenasnameAdd_Click(object sender, EventArgs e)
        {
            string     id          = RandomString(10);
            shenasname model       = new shenasname();
            DateTime   nowdatetime = DateTime.Now;

            model.token    = "123456789";
            model.master   = "1";
            model.ID       = id;
            model.parent   = id;
            model.date     = nowdatetime;
            model.dateFrom = DateTime.Now;
            model.dateTo   = DateTime.Now;
            model.time     = nowdatetime.TimeOfDay;
            dbcontext.shenasnames.Add(model);
            dbcontext.SaveChanges();
            GlobalVariable.shenasnameID = id;
            Form2_shenasnameAdd form = new Form2_shenasnameAdd();

            form.Show();


            this.Hide();
        }
Ejemplo n.º 4
0
        private void label2_Click(object sender, EventArgs e)
        {
            string itemname = itemList.SelectedItem.ToString();

            if (itemname == "")
            {
                return;
            }
            string shenasnameID = GlobalVariable.shenasnameID;

            using (var dbcontext = new Model.Context())
            {
                shenasname shen = dbcontext.shenasnames.SingleOrDefault(x => x.ID == shenasnameID);


                if (shen.final != 1)
                {
                    var    directory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
                    string root      = Path.Combine(directory, "FIM");
                    System.IO.Directory.CreateDirectory(root);
                    string trashPath = Path.Combine(root, "asset");
                    System.IO.Directory.CreateDirectory(trashPath);

                    OpenFileDialog f = new OpenFileDialog();
                    if (f.ShowDialog() == DialogResult.OK)
                    {
                        string source = Path.GetFullPath(f.FileName);

                        string finalname    = "";
                        Random _random      = new Random();
                        string random       = _random.Next(10000, 99999).ToString();
                        string sourcAddress = source;
                        finalname = random + Path.GetExtension(sourcAddress);
                        string finalPath = trashPath + "\\" + finalname;

                        File.Copy(f.FileName, finalPath);
                        webBrowser1.Navigate(finalPath);



                        switch (itemname)
                        {
                        case "بایگانی موارد":
                            shen.bayganiFile = finalname;
                            break;

                        case "قرارداد":
                            shen.gharardadFile = finalname;
                            break;

                        case "متمم":
                            shen.motamamFile = finalname;
                            break;

                        case "پیوست متنی":
                            shen.peyvastFile = finalname;
                            break;

                        case "لیست مواد":
                            shen.listmavadFile = finalname;
                            break;

                        case "گانت چارت":
                            shen.gantFile = finalname;
                            break;

                        case "مجوز ستاد کل":
                            shen.mojavezFile = finalname;
                            break;

                        case "گزارش پیشرفت":
                            shen.pishraftFile = finalname;
                            break;
                        }
                        dbcontext.SaveChanges();

                        //factorPdf factor = new factorPdf(source);
                        //factor.Show();
                    }
                }
            }
        }
Ejemplo n.º 5
0
        private void label17_Click(object sender, EventArgs e)
        {
            string itemname = itemList.SelectedItem.ToString();

            if (itemname == "")
            {
                return;
            }
            using (Context dbcontext = new Context())
            {
                string     shenasnameID = GlobalVariable.shenasnameID;
                shenasname model        = dbcontext.shenasnames.SingleOrDefault(x => x.ID == shenasnameID);
                string     finalname    = "";
                switch (itemname)
                {
                case "بایگانی موارد":
                    finalname = model.bayganiFile;
                    break;

                case "قرارداد":
                    finalname = model.gharardadFile;
                    break;

                case "متمم":
                    finalname = model.motamamFile;
                    break;

                case "پیوست متنی":
                    finalname = model.peyvastFile;
                    break;

                case "لیست مواد":
                    finalname = model.listmavadFile;
                    break;

                case "گانت چارت":
                    finalname = model.gantFile;
                    break;

                case "مجوز ستاد کل":
                    finalname = model.mojavezFile;
                    break;

                case "گزارش پیشرفت":
                    finalname = model.pishraftFile;
                    break;
                }
                string imageName = finalname;
                if (imageName != null)
                {
                    var    directory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
                    string root      = Path.Combine(directory, "FIM");
                    System.IO.Directory.CreateDirectory(root);
                    string trashPath = Path.Combine(root, "asset");
                    System.IO.Directory.CreateDirectory(trashPath);

                    string finalPath = trashPath + "\\" + finalname;
                    try
                    {
                        webBrowser1.Navigate(finalPath);
                    }
                    catch (Exception error)
                    {
                        label1.Text = "0000-" + error.InnerException.Message;
                    }
                }
            }
        }
Ejemplo n.º 6
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int    iSelectedGridIndex = dataGridView1.CurrentCell.ColumnIndex;
            int    rowindex           = dataGridView1.CurrentCell.RowIndex;
            string rowID = dataGridView1.Rows[rowindex].Cells[2].Value.ToString();

            if (iSelectedGridIndex == 1)
            {
                using (Context dbcontext = new Context())
                {
                    shenasname selecteditem = dbcontext.shenasnames.SingleOrDefault(x => x.ID == rowID);
                    if (selecteditem.master != "1")
                    {
                        return;
                    }

                    string sID = RandomString(10);
                    List <shenasnameGam> gamList = dbcontext.shenasnameGams.Where(x => x.shenasnameID == rowID).ToList();
                    if (gamList != null)
                    {
                        foreach (shenasnameGam item in gamList)
                        {
                            shenasnameGam newItem = item;
                            newItem.shenasnameID = sID;
                            dbcontext.shenasnameGams.Add(newItem);
                        }
                    }

                    List <shenasnameFounder> founderList = dbcontext.shenasnameFounders.Where(x => x.shenasnameID == rowID).ToList();
                    if (founderList != null)
                    {
                        foreach (shenasnameFounder item in founderList)
                        {
                            shenasnameFounder newItem = item;
                            newItem.shenasnameID = sID;
                            dbcontext.shenasnameFounders.Add(newItem);
                        }
                    }

                    List <ejraeiat> ejraeatList = dbcontext.ejraeiats.Where(x => x.shenasnameID == rowID).ToList();
                    if (ejraeatList != null)
                    {
                        foreach (ejraeiat item in ejraeatList)
                        {
                            ejraeiat newItem = item;
                            newItem.shenasnameID = sID;
                            dbcontext.ejraeiats.Add(newItem);
                        }
                    }
                    List <sarmaye> sarmayeslist = dbcontext.sarmayes.Where(x => x.shenasnameID == rowID).ToList();
                    if (sarmayeslist != null)
                    {
                        foreach (sarmaye item in sarmayeslist)
                        {
                            sarmaye newItem = item;
                            newItem.shenasnameID = sID;
                            dbcontext.sarmayes.Add(newItem);
                        }
                    }
                    List <masrafi> masrafislist = dbcontext.masrafis.Where(x => x.shenasnameID == rowID).ToList();
                    if (masrafislist != null)
                    {
                        foreach (masrafi item in masrafislist)
                        {
                            masrafi newItem = item;
                            newItem.shenasnameID = sID;
                            dbcontext.masrafis.Add(newItem);
                        }
                    }
                    List <edari> edarislist = dbcontext.edaris.Where(x => x.shenasnameID == rowID).ToList();
                    if (masrafislist != null)
                    {
                        foreach (edari item in edarislist)
                        {
                            edari newItem = item;
                            newItem.shenasnameID = sID;
                            dbcontext.edaris.Add(newItem);
                        }
                    }
                    List <omrani> omranilist = dbcontext.omranis.Where(x => x.shenasnameID == rowID).ToList();
                    if (masrafislist != null)
                    {
                        foreach (omrani item in omranilist)
                        {
                            omrani newItem = item;
                            newItem.shenasnameID = sID;
                            dbcontext.omranis.Add(newItem);
                        }
                    }
                    List <gharardad> gharardadslist = dbcontext.gharardads.Where(x => x.shenasnameID == rowID).ToList();
                    if (masrafislist != null)
                    {
                        foreach (gharardad item in gharardadslist)
                        {
                            gharardad newItem = item;
                            newItem.shenasnameID = sID;
                            dbcontext.gharardads.Add(newItem);
                        }
                    }
                    List <sayer> sayerslist = dbcontext.sayers.Where(x => x.shenasnameID == rowID).ToList();
                    if (masrafislist != null)
                    {
                        foreach (sayer item in sayerslist)
                        {
                            sayer newItem = item;
                            newItem.shenasnameID = sID;
                            dbcontext.sayers.Add(newItem);
                        }
                    }
                    List <tashvighi> tashvighislist = dbcontext.tashvighis.Where(x => x.shenasnameID == rowID).ToList();
                    if (masrafislist != null)
                    {
                        foreach (tashvighi item in tashvighislist)
                        {
                            tashvighi newItem = item;
                            newItem.shenasnameID = sID;
                            dbcontext.tashvighis.Add(newItem);
                        }
                    }

                    shenasname model = new shenasname()
                    {
                        comment           = selecteditem.comment,
                        date              = DateTime.Now,
                        time              = DateTime.Now.TimeOfDay,
                        changer           = selecteditem.changer,
                        dastgah           = selecteditem.dastgah,
                        dateFrom          = DateTime.Now,
                        title             = selecteditem.title,
                        token             = selecteditem.token,
                        parent            = selecteditem.parent,
                        ID                = sID,
                        noshke            = selecteditem.noshke,
                        dateTo            = DateTime.Now,
                        master            = selecteditem.master,
                        LvazifeT          = selecteditem.LvazifeT,
                        markaz            = selecteditem.markaz,
                        LvazifeHPR        = selecteditem.LvazifeHPR,
                        LvazifeHPD        = selecteditem.LvazifeHPD,
                        LrasmiT           = selecteditem.LrasmiT,
                        LrasmiHPR         = selecteditem.LrasmiHPR,
                        LrasmiHPD         = selecteditem.LrasmiHPD,
                        LgharartamamT     = selecteditem.LgharartamamT,
                        LgharartamamHPR   = selecteditem.LgharartamamHPR,
                        DghararsaatHPD    = selecteditem.DghararsaatHPD,
                        DghararsaatHPR    = selecteditem.DghararsaatHPR,
                        DghararsaatT      = selecteditem.DghararsaatT,
                        DgharartamamHPD   = selecteditem.DgharartamamHPD,
                        DgharartamamHPR   = selecteditem.DgharartamamHPR,
                        DgharartamamT     = selecteditem.DgharartamamT,
                        DighararsaatHPD   = selecteditem.DighararsaatHPD,
                        DighararsaatHPR   = selecteditem.DighararsaatHPR,
                        DighararsaatT     = selecteditem.DighararsaatT,
                        DigharartamamHPD  = selecteditem.DigharartamamHPD,
                        DigharartamamHPR  = selecteditem.DigharartamamHPR,
                        DigharartamamT    = selecteditem.DigharartamamT,
                        DirasmiHPD        = selecteditem.DirasmiHPD,
                        DirasmiHPR        = selecteditem.DirasmiHPR,
                        DirasmiT          = selecteditem.DirasmiT,
                        DivazifeHPD       = selecteditem.DivazifeHPD,
                        DivazifeHPR       = selecteditem.DivazifeHPR,
                        DivazifeT         = selecteditem.DivazifeT,
                        DrasmiHPD         = selecteditem.DrasmiHPD,
                        DrasmiHPR         = selecteditem.DrasmiHPR,
                        DrasmiT           = selecteditem.DrasmiT,
                        DvazifeHPD        = selecteditem.DvazifeHPD,
                        DvazifeHPR        = selecteditem.DvazifeHPR,
                        DvazifeT          = selecteditem.DvazifeT,
                        FDghararsaatHPD   = selecteditem.FDghararsaatHPD,
                        FDghararsaatHPR   = selecteditem.FDghararsaatHPR,
                        FDghararsaatT     = selecteditem.FDghararsaatT,
                        FDgharartamamHPD  = selecteditem.FDgharartamamHPD,
                        FDgharartamamHPR  = selecteditem.FDgharartamamHPR,
                        FDgharartamamT    = selecteditem.FDgharartamamT,
                        FDrasmiHPD        = selecteditem.FDrasmiHPD,
                        FDrasmiHPR        = selecteditem.FDrasmiHPR,
                        FDrasmiT          = selecteditem.FDrasmiT,
                        FDvazifeHPD       = selecteditem.FDvazifeHPD,
                        FDvazifeHPR       = selecteditem.FDvazifeHPR,
                        FDvazifeT         = selecteditem.FDvazifeT,
                        final             = 0,
                        FLghararsaatHPD   = selecteditem.FLghararsaatHPD,
                        FLgharartamamT    = selecteditem.FLgharartamamT,
                        FLghararsaatHPR   = selecteditem.FLghararsaatHPR,
                        FLghararsaatT     = selecteditem.FLghararsaatT,
                        FLgharartamamHPD  = selecteditem.FLgharartamamHPD,
                        FLgharartamamHPR  = selecteditem.FLgharartamamHPR,
                        FLrasmiHPD        = selecteditem.FLrasmiHPD,
                        FLrasmiHPR        = selecteditem.FLrasmiHPR,
                        FLrasmiT          = selecteditem.FLrasmiT,
                        FLvazifeHPD       = selecteditem.FLvazifeHPD,
                        FLvazifeHPR       = selecteditem.FLvazifeHPR,
                        FLvazifeT         = selecteditem.FLvazifeT,
                        hadaf             = selecteditem.hadaf,
                        isDone            = false,
                        LghararsaatHPD    = selecteditem.LghararsaatHPD,
                        LghararsaatHPR    = selecteditem.LghararsaatHPR,
                        LghararsaatT      = selecteditem.LghararsaatT,
                        LgharartamamHPD   = selecteditem.LgharartamamHPD,
                        ZDighararsaatHPD  = selecteditem.ZDighararsaatHPD,
                        ZDighararsaatHPR  = selecteditem.ZDighararsaatHPR,
                        ZDighararsaatT    = selecteditem.ZDighararsaatT,
                        ZDigharartamamHPD = selecteditem.ZDigharartamamHPD,
                        ZDigharartamamHPR = selecteditem.ZDigharartamamHPR,
                        ZDigharartamamT   = selecteditem.ZDigharartamamT,
                        ZDirasmiHPD       = selecteditem.ZDirasmiHPD,
                        ZDirasmiHPR       = selecteditem.ZDirasmiHPR,
                        ZDirasmiT         = selecteditem.ZDirasmiT,
                        ZDivazifeHPD      = selecteditem.ZDivazifeHPD,
                        ZDivazifeHPR      = selecteditem.ZDivazifeHPR,
                        ZDivazifeT        = selecteditem.ZDivazifeT,
                        bayganiFile       = selecteditem.bayganiFile,
                        gantFile          = selecteditem.gantFile,
                        gharardadFile     = selecteditem.gharardadFile,
                        listmavadFile     = selecteditem.listmavadFile,
                        mojavezFile       = selecteditem.mojavezFile,
                        motamamFile       = selecteditem.motamamFile,
                        peyvastFile       = selecteditem.peyvastFile,
                        pishraftFile      = selecteditem.pishraftFile,
                    };

                    dbcontext.shenasnames.Add(model);
                    dbcontext.SaveChanges();
                    GlobalVariable.shenasnameID = sID;
                    Form2_shenasnameAdd form2 = new Form2_shenasnameAdd();
                    form2.Show();
                }
            }
            else if (iSelectedGridIndex == 0)
            {
                GlobalVariable.shenasnameID = rowID;
                Form2_shenasnameAdd form2 = new Form2_shenasnameAdd();
                form2.Show();
            }
            else
            {
                return;
            }
        }