Exemple #1
0
        //süreçe kişi atamak
        public static char SureceKisiAta(KullaniciSurec ks, int projeId)
        {
            char res = '-';

            try
            {
                using (BuyutecDBEntities db = new BuyutecDBEntities())
                {
                    var projeSurecKontrol = (from p in db.tblSurecs where p.projeId == projeId && p.surecId == ks.surecId select p).SingleOrDefault();
                    if (projeSurecKontrol != null)
                    {
                        var surecKullaniciKontrol = (from p in db.tblKullaniciSurecs where p.kullaniciId == ks.kullaniciId && p.surecId == ks.surecId select p).SingleOrDefault();
                        if (surecKullaniciKontrol == null)
                        {
                            tblKullaniciSurec tks = new tblKullaniciSurec
                            {
                                kullaniciId = ks.kullaniciId,
                                surecId     = ks.surecId,
                            };
                            db.tblKullaniciSurecs.Add(tks);
                            db.SaveChanges();
                            res = '+';
                        }
                    }
                    return(res);
                }
            }
            catch
            {
                return('?');
            }
        }
Exemple #2
0
        public static char AltSureceKisiAta(KullaniciSurec ks, int projeId)
        {
            char result = '-';

            try
            {
                using (BuyutecDBEntities db = new BuyutecDBEntities())
                {
                    var altSurecKontrol = (from p in db.tblAltSurecs where p.altSurecId == ks.surecId select new { p.surecId }).SingleOrDefault();
                    if (altSurecKontrol != null)
                    {
                        var surecProjeKontrol = (from p in db.tblSurecs where p.surecId == altSurecKontrol.surecId && p.projeId == projeId select p).SingleOrDefault();
                        if (surecProjeKontrol != null)
                        {
                            var kullaniciSurectevarmi = (from p in db.tblKullaniciSurecs where p.surecId == altSurecKontrol.surecId && p.kullaniciId == ks.kullaniciId select p).SingleOrDefault();
                            if (kullaniciSurectevarmi == null)
                            {
                                tblKullaniciSurec kss = new tblKullaniciSurec
                                {
                                    surecId     = (int)altSurecKontrol.surecId,
                                    kullaniciId = ks.kullaniciId
                                };
                                db.tblKullaniciSurecs.Add(kss);
                            }
                            var kullanicivarmi = (from p in db.tblKullaniciAltSurecs where p.altSurecId == ks.surecId && p.kullaniciId == ks.kullaniciId select p).SingleOrDefault();
                            if (kullanicivarmi == null)
                            {
                                tblKullaniciAltSurec kas = new tblKullaniciAltSurec
                                {
                                    altSurecId  = ks.surecId,
                                    kullaniciId = ks.kullaniciId
                                };
                                db.tblKullaniciAltSurecs.Add(kas);
                                db.SaveChanges();
                                result = '+';
                            }
                        }
                    }
                }
            }
            catch
            {
                result = '?';
            }
            return(result);
        }
Exemple #3
0
        //süreç ekle
        public static int SurecEkle(tblSurec surec, int kullaniciId)//??!!zzzBAMM ;)
        {
            try
            {
                using (BuyutecDBEntities db = new BuyutecDBEntities())
                {
                    db.tblSurecs.Add(surec);

                    tblKullaniciSurec ks = new tblKullaniciSurec();
                    ks.surecId     = surec.surecId;
                    ks.kullaniciId = kullaniciId;
                    surec.tblKullaniciSurecs.Add(ks);

                    db.SaveChanges();
                }
                return(0);
            }
            catch
            {
                return(1); // işlem başarısız
            }
        }