コード例 #1
0
        private string checkSelectedStates(int selectedState, IDbCommand cmd, ProjeSahiplik pSBegin, ProjeSahiplik pSEnd)
        {
            string r = "";

            if (selectedState == tumProjeler)
            {
                r += "";
            }
            if (selectedState == teslimEdilmis)
            {
                r += " and pS.ApproveDate is not null ";
            }
            if (selectedState == zamanindaOnce)
            {
                r += " and pS.ApproveDate is not null and Convert(datetime,pS.EndDate,105)>Convert(datetime,pS.ApproveDate,105)";
            }
            if (selectedState == zamaninda)
            {
                r += " and pS.ApproveDate is not null and Convert(datetime,pS.EndDate,105)=Convert(datetime,pS.ApproveDate,105)";
            }
            if (selectedState == zamanindanSonra)
            {
                r += " and pS.ApproveDate is not null and Convert(datetime,pS.EndDate,105)<Convert(datetime,pS.ApproveDate,105)";
            }
            if (selectedState == zamanıDolmusVeTeslimEdilmemis)
            {
                r += " and pS.ApproveDate is null and Convert(datetime,pS.EndDate,105)<Convert(datetime,GETDATE(),105)";
            }
            return(r);
        }
コード例 #2
0
        private void projeAta()
        {
            ProjeAta pAta = new ProjeAta();

            gridToEntity();
            pAta.setProje(projeEntity);
            pAta.ShowDialog();

            if (pAta.DialogResult == DialogResult.OK)
            {
                try
                {
                    stajyerEntity = pAta.getStajyer();
                    DateTime      EndDate  = pAta.getEndDate();
                    ProjeSahiplik pSEntity = new ProjeSahiplik();
                    pSEntity.Active    = true;
                    pSEntity.EndDate   = EndDate;
                    pSEntity.InsDate   = DateTime.Now;
                    pSEntity.ProjeId   = projeEntity.Id;
                    pSEntity.StajyerId = stajyerEntity.Id;
                    new ProjeSahiplikDAOBase().Save(pSEntity);
                    MessageBox.Show("Başarılı");
                }
                catch (Exception e1)
                {
                    MessageBox.Show("HATA");
                }
            }
        }
コード例 #3
0
        public void openProject(ProjeSahiplik pSEntity, bool adminStajyer)
        {
            string path             = pSEntity.Path + "\\" + pSEntity.ProjeAdi + ".sln";
            FolderBrowserDialog fbd = null;
            DialogResult        result;
            Process             p;

            if (adminStajyer)
            {
                string adminPath = pSEntity.Path;
                try
                {
                    if (File.Exists(path))
                    {
                        adminPath  += "\\" + pSEntity.ProjeAdi + ".sln";
                        p           = new Process();
                        p.StartInfo = new ProcessStartInfo(adminPath);
                        p.Start();
                    }
                    else
                    {
                        MessageBox.Show("Intern does not upload any project!");
                    }
                    return;
                }
                catch
                {
                    MessageBox.Show("File Deleted or wrong Location!");
                }
            }
            else
            {
                while (!File.Exists(path))
                {
                    MessageBox.Show("Yol bulunamadı yeni yol tanımlayın");
                    fbd    = new FolderBrowserDialog();
                    result = fbd.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        pSEntity.Path = fbd.SelectedPath;
                        path          = pSEntity.Path + "\\" + pSEntity.ProjeAdi + ".sln";
                    }
                    else
                    {
                        return;
                    }
                }

                new ProjeSahiplikDAO().Save(pSEntity);
            }
            p           = new Process();
            p.StartInfo = new ProcessStartInfo(path);
            p.Start();
        }
コード例 #4
0
 private void screenToEntity()
 {
     if (pSEntity == null)
     {
         pSEntity = new ProjeSahiplik();
     }
     pSEntity.Id       = (int)projeGrid.CurrentRow.Cells["Id"].Value;
     pSEntity          = new ProjeSahiplikDAO().SelectById(pSEntity.Id);
     pSEntity.Versiyon = projeGrid.CurrentRow.Cells["Versiyon"].Value.ToString();
     pSEntity.ProjeAdi = projeGrid.CurrentRow.Cells["ProjeAdi"].Value.ToString();
 }
コード例 #5
0
        public List <ProjeVersiyonlari> getAllInternProjectsVersions(ProjeSahiplik projeSahiplikEntity)
        {
            string select = "select p.Adi ,pV.* ";
            string from   = "from Proje p join ProjeSahiplik pS on p.Id = pS.ProjeId join ProjeVersiyonlari pV on pS.Id = pV.ProjeSahiplikId ";

            string where = " where pS.Id = @ProjeSahiplikId and pV.Active = @Active";
            string     query = select + from + where;
            IDbCommand cmd   = this.CreateCommand(query);

            AddParameter(cmd, "@Active", true);
            AddParameter(cmd, "@ProjeSahiplikId", projeSahiplikEntity.Id);
            List <ProjeVersiyonlari> a = SelectCompact(cmd).Cast <ProjeVersiyonlari>().ToList();

            return(a);
        }
コード例 #6
0
        public bool updateProject(ProjeSahiplik pSEntity)
        {
            string path = pSEntity.Path;

            if (!Directory.Exists(path))
            {
                MessageBox.Show("File can't find");
                return(false);
            }

            try
            {
                //find project
                Proje pEntity = new ProjeDAO().SelectById(pSEntity.ProjeId);

                //increase version number
                string versiyonNumber = versiyonNumarasiArttir(pSEntity.Versiyon);
                string destDirName    = @"..\..\Projeler\" + pSEntity.StajyerId + "\\"
                                        + pEntity.Adi + "\\" + versiyonNumber;

                DirectoryCopy(path, destDirName, true);

                ProjeVersiyonlari pVEntity = new ProjeVersiyonlari();

                pVEntity.Versiyon        = versiyonNumber;
                pVEntity.InsDate         = DateTime.Now;
                pVEntity.Active          = true;
                pVEntity.ProjeSahiplikId = pSEntity.Id;
                pVEntity.Path            = destDirName;

                new ProjeVersiyonlariDAO().Save(pVEntity);

                pSEntity.Versiyon = versiyonNumber;

                new ProjeSahiplikDAO().Save(pSEntity);
            }
            catch
            {
                return(false);
            }


            return(true);
        }
コード例 #7
0
 private void projeGridToEntity()
 {
     row = ProjeGrid.CurrentRow;
     if (pSEntity == null)
     {
         pSEntity = new ProjeSahiplik();
     }
     if (versiyonEntity == null)
     {
         versiyonEntity = new ProjeVersiyonlari();
     }
     pSEntity.Id       = (int)row.Cells["Id"].Value;
     pSEntity          = new ProjeSahiplikDAO().SelectById(pSEntity.Id);
     pSEntity.Versiyon = row.Cells["Versiyon"].Value.ToString();
     pSEntity.ProjeAdi = row.Cells["ProjeAdi"].Value.ToString();
     versiyonEntity.ProjeSahiplikId = (int)row.Cells["Id"].Value;
     versiyonEntity.ProjeAdi        = row.Cells["ProjeAdi"].Value.ToString();
     versiyonEntity.Versiyon        = row.Cells["Versiyon"].Value.ToString();
     if (versiyonEntity.Versiyon != "<yok>")
     {
         versiyonEntity = new ProjeVersiyonlariDAO().SelectOneByOwnerIdAndVersion(versiyonEntity);
     }
     pSEntity.Path = versiyonEntity.Path;
 }
コード例 #8
0
 public void Delete(ProjeSahiplik Entity)
 {
     Entity.Active = false;
     Save(Entity);
 }
コード例 #9
0
        private string checkSelectedDates(bool beginInsDatePicker, bool beginEndDatePicker, bool beginApproveDatePicker
                                          , bool finishInsDatePicker, bool finishEndDatePicker, bool finishApproveDatePicker, IDbCommand cmd, ProjeSahiplik pSBegin, ProjeSahiplik pSEnd)
        {
            string r = "";

            if (beginInsDatePicker)
            {
                r += " and CONVERT(datetime,pS.InsDate,105)>=@beginInsDate";
                AddParameter(cmd, "@beginInsDate", pSBegin.InsDate);
            }
            if (beginEndDatePicker)
            {
                r += " and CONVERT(datetime,pS.EndDate,105) >=@beginEndDate";
                AddParameter(cmd, "@beginEndDate", pSBegin.EndDate);
            }
            if (beginApproveDatePicker)
            {
                r += " and CONVERT(datetime, pS.ApproveDate,105)>=@beginApproveDate";
                AddParameter(cmd, "@beginApproveDate", pSBegin.ApproveDate);
            }
            if (finishInsDatePicker)
            {
                r += " and CONVERT(datetime, pS.InsDate,105) <=@finishInsDate";
                AddParameter(cmd, "@finishInsDate", pSEnd.InsDate);
            }
            if (finishEndDatePicker)
            {
                r += " and CONVERT(datetime, pS.EndDate,105) <=@finishEndDate";
                AddParameter(cmd, "@finishEndDate", pSEnd.EndDate);
            }
            if (finishApproveDatePicker)
            {
                r += " and CONVERT(datetime,pS.ApproveDate,105) <=@finishApproveDate";
                AddParameter(cmd, "@finishApproveDate", pSEnd.ApproveDate);
            }
            return(r);
        }
コード例 #10
0
        public List <ProjeSahiplik> searchInProjeSahiplik(bool beginInsDatePicker, bool beginEndDatePicker, bool beginApproveDatePicker,
                                                          bool finishInsDatePicker, bool finishEndDatePicker, bool finishApproveDatePicker, int selectedState, ProjeSahiplik pSBegin, ProjeSahiplik pSEnd, Proje pEntity,
                                                          Kullanici kEntity)
        {
            IDbCommand cmd = this.CreateCommand("");


            string whereEkle = "";

            string where = "";
            whereEkle   += checkSelectedDates(beginInsDatePicker, beginEndDatePicker, beginApproveDatePicker,
                                              finishInsDatePicker, finishEndDatePicker, finishApproveDatePicker, cmd, pSBegin, pSEnd);
            whereEkle += checkSelectedStates(selectedState, cmd, pSBegin, pSEnd);
            whereEkle += getFromTxtField(cmd, pEntity, kEntity);
            where     += whereEkle;



            string query = "";

            query = "Select pS.Id as [Id], p.Adi as [ProjeAdi], k.Adi as [StajyerAdi], pS.Versiyon as [Versiyon], k.Id as [StajyerId]," +
                    " p.Id as [ProjeId], pS.Active,pS.InsDate, pS.EndDate, pS.ApproveDate, pS.Path " +
                    " from dbo.Kullanici k " +
                    "inner join dbo.ProjeSahiplik pS on pS.StajyerId = k.Id " +
                    "inner join dbo.Proje p on p.Id = pS.ProjeId ";


            query += where;



            cmd.CommandText = query;

            return(SelectCompact(cmd).ToList());
        }