예제 #1
0
        public void AreNotSameTest()
        {
            FileProccess x = new FileProccess();
            FileProccess y = new FileProccess();

            Assert.AreNotSame(x, y);
        }
        public ActionResult CVCalismaOlustur(CVCalisma cv)
        {
            try
            {
                var b = sql.ExecuteNonQuery(CommandType.StoredProcedure, "sp_CvCalismaOlustur",
                                            new SqlParameter("@Aciklama", cv.Aciklama),
                                            new SqlParameter("@BaslangicTarihi", cv.BaslangicTarihi),
                                            new SqlParameter("@BitisTarihi", cv.BitisTarihi),
                                            new SqlParameter("@CvId", cv.CvId),
                                            new SqlParameter("@FirmaAdi", cv.FirmaAdi),
                                            new SqlParameter("@Pozisyon", cv.Pozisyon)
                                            ) > 0;

                if (b)
                {
                    return(Ok());
                }
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);

                return(BadRequest());
            }

            return(BadRequest());
        }
        public ActionResult CVOlustur(CVKullanici cv)
        {
            try
            {
                //cv var mı kontrol?

                var k = sql.ExecuteDataTable(CommandType.Text, "SELECT * FROM CVKullanici WHERE KullaniciId = @KullaniciId",
                                             new SqlParameter("@KullaniciId", cv.KullaniciId)
                                             );

                if (k.Rows.Count > 0)
                {
                    return(Ok("Kullanıcının CV bilgileri mevcuttur"));
                }

                var b = sql.ExecuteNonQuery(CommandType.StoredProcedure, "sp_CvOlustur",
                                            new SqlParameter("@CalismaSuresi", cv.CalismaSuresi),
                                            new SqlParameter("@KullaniciId", cv.KullaniciId),
                                            new SqlParameter("@Meslegi", cv.Meslegi)
                                            ) > 0;

                if (b)
                {
                    return(Ok());
                }
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);

                return(BadRequest());
            }

            return(BadRequest());
        }
예제 #4
0
        public object ExecuteScalar(CommandType commandType, string commandText, params SqlParameter[] parameters)
        {
            object result = new object();

            try
            {
                cmd             = new SqlCommand(commandText, cnn);
                cmd.CommandType = commandType;

                if (parameters != null)
                {
                    foreach (SqlParameter parameter in parameters)
                    {
                        cmd.Parameters.Add(parameter);
                    }
                }

                OpenConnection();

                result = cmd.ExecuteScalar();
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);
            }
            finally
            {
                CloseConnection();
            }

            return(result);
        }
        public ActionResult CVEgitimOlustur(CVEgitim cv)
        {
            try
            {
                var b = sql.ExecuteNonQuery(CommandType.StoredProcedure, "sp_CvEgitimOlustur",
                                            new SqlParameter("@Adi", cv.Adi),
                                            new SqlParameter("@BaslangicTarihi", cv.BaslangicTarihi),
                                            new SqlParameter("@BitisTarihi", cv.BitisTarihi),
                                            new SqlParameter("@CvId", cv.CvId),
                                            new SqlParameter("@EgitimDurumu", cv.EgitimDurumu),
                                            new SqlParameter("@Notu", cv.Notu)
                                            ) > 0;

                if (b)
                {
                    return(Ok());
                }
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);

                return(BadRequest());
            }

            return(BadRequest());
        }
예제 #6
0
        public DataSet ExecuteDataSet(CommandType commandType, string commandText, params SqlParameter[] parameters)
        {
            DataSet result = new DataSet();

            try
            {
                cmd             = new SqlCommand(commandText, cnn);
                cmd.CommandType = commandType;

                if (parameters != null)
                {
                    foreach (SqlParameter parameter in parameters)
                    {
                        cmd.Parameters.Add(parameter);
                    }
                }

                ds = new DataSet();
                da = new SqlDataAdapter(cmd);

                da.Fill(ds);

                result = ds;
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);
            }

            return(result);
        }
예제 #7
0
        public SqlDataReader ExecuteDataReader(CommandType commandType, string commandText, params SqlParameter[] parameters)
        {
            SqlDataReader result = null;

            try
            {
                cmd             = new SqlCommand(commandText, cnn);
                cmd.CommandType = commandType;

                if (parameters != null)
                {
                    foreach (SqlParameter parameter in parameters)
                    {
                        cmd.Parameters.Add(parameter);
                    }
                }

                OpenConnection();

                result = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);
            }

            return(result);
        }
예제 #8
0
        public int ExecuteNonQuery(CommandType commandType, string commandText, SqlTransaction tran, SqlConnection con, params SqlParameter[] parameters)
        {
            int result = 0;

            try
            {
                cmd             = new SqlCommand(commandText, con, tran);
                cmd.CommandType = commandType;

                if (parameters != null)
                {
                    foreach (SqlParameter parameter in parameters)
                    {
                        cmd.Parameters.Add(parameter);
                    }
                }

                con.Open();

                result = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);
            }
            finally
            {
                con.Close();
            }

            return(result);
        }
        public ActionResult Basvuru(IlanBasvuru basvuru)
        {
            try
            {
                //başvuru yapıldı mı kontrol?

                var k = sql.ExecuteDataTable(CommandType.Text, "SELECT * FROM IlanBasvuru WHERE IlanId = @IlanId AND CvId = @CvId",
                                             new SqlParameter("@CvId", basvuru.CvId),
                                             new SqlParameter("@IlanId", basvuru.IlanId)
                                             );

                if (k.Rows.Count > 0)
                {
                    return(Ok("CV'ye daha önce başvuru yapılmış"));
                }

                var b = sql.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Basvuru",
                                            new SqlParameter("@Adi", basvuru.CvId),
                                            new SqlParameter("@Adres", basvuru.IlanId)
                                            ) > 0;

                if (b)
                {
                    return(Ok());
                }
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);

                return(BadRequest());
            }

            return(BadRequest());
        }
예제 #10
0
        public ActionResult IlanOlustur(FirmaIlan ilan)
        {
            try
            {
                var b = sql.ExecuteNonQuery(CommandType.StoredProcedure, "sp_IlanOlustur",
                                            new SqlParameter("@FirmaId", ilan.FirmaId),
                                            new SqlParameter("@IlanAciklama", ilan.IlanAciklama),
                                            new SqlParameter("@Konum", ilan.Konum),
                                            new SqlParameter("@SonaErmeSuresi", ilan.SonaErmeSuresi)
                                            ) > 0;

                if (b)
                {
                    return(Ok());
                }
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);

                return(BadRequest());
            }

            return(BadRequest());
        }
예제 #11
0
        public ActionResult FirmaSil(int id)
        {
            try
            {
                //firma ilan bilgileri var mı kontrol?

                var k = sql.ExecuteDataTable(CommandType.Text, "SELECT * FROM dbo.FirmaIlan INNER JOIN dbo.IlanBasvuru ON IlanBasvuru.IlanId = FirmaIlan.Id WHERE FirmaId = @FirmaId",
                                             new SqlParameter("@FirmaId", id)
                                             );

                if (k.Rows.Count > 0)
                {
                    return(Ok("Firmanın ilanlarına başvuru yapılmış silinemez!"));
                }

                var b = sql.ExecuteNonQuery(CommandType.StoredProcedure, "sp_FirmaSil",
                                            new SqlParameter("@Id", id)
                                            ) > 0;

                if (b)
                {
                    return(Ok());
                }
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);

                return(BadRequest());
            }

            return(BadRequest());
        }
예제 #12
0
        public ActionResult IlanSil(int id)
        {
            try
            {
                //başvuru var mı kontrol?

                var k = sql.ExecuteDataTable(CommandType.Text, "SELECT * FROM IlanBasvuru WHERE IlanId = @IlanId",
                                             new SqlParameter("@IlanId", id)
                                             );

                if (k.Rows.Count > 0)
                {
                    return(Ok("İlana başvuru yapılmış silinemez"));
                }

                var b = sql.ExecuteNonQuery(CommandType.StoredProcedure, "sp_IlanSil",
                                            new SqlParameter("@Id", id)
                                            ) > 0;

                if (b)
                {
                    return(Ok());
                }
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);

                return(BadRequest());
            }

            return(BadRequest());
        }
예제 #13
0
        public void FileNameNullOrEmpty_ThrowsNullException()
        {
            // TODO;
            //Arrange
            FileProccess fp = new FileProccess();

            fp.FileExit("");
        }
        public void FileNameDoesNotExist()
        {
            bool         fromCall;
            FileProccess fp = new FileProccess();

            TestContext.WriteLine("Checking file: " + BAD_FILE_NAME);
            fromCall = fp.FileExists(BAD_FILE_NAME);
            Assert.IsFalse(fromCall);
        }
예제 #15
0
        public void FileNameDoesExits()
        {
            // TODO;
            FileProccess fp = new FileProccess();
            bool         fromCall;

            fromCall = fp.FileExit(@"");
            Assert.IsTrue(fromCall);
        }
        public void FileNameDoesExist()
        {
            bool         fromCall;
            FileProccess fp = new FileProccess();

            TestContext.WriteLine("Checking file: " + _GoodFileName);
            fromCall = fp.FileExists(_GoodFileName);

            Assert.IsTrue(fromCall);
        }
예제 #17
0
        public void FileDoesExitis()
        {
            //arranjo
            FileProccess fp = new FileProccess();
            bool         fromCall;

            //ação
            fromCall = fp.FileExit(@"");

            Assert.IsTrue(fromCall);
        }
예제 #18
0
        public void FileNameDoesNotExits()
        {
            // TODO;
            //Arrange
            FileProccess fp = new FileProccess();
            bool         fromCall;

            //Chamar o método
            fromCall = fp.FileExit(BAD_FILE_NAME);
            Assert.IsFalse(fromCall);
        }
        public ActionResult CVSil(int id)
        {
            try
            {
                //eğitim bilgileri, çalışma, başvuru bilgileri var mı kontrol?

                var k = sql.ExecuteDataTable(CommandType.Text, "SELECT * FROM CVEgitim WHERE CvId = @CvId",
                                             new SqlParameter("@CvId", id)
                                             );

                if (k.Rows.Count > 0)
                {
                    return(Ok("Kullanıcının eğitim bilgileri mevcuttur silinemez"));
                }

                var k2 = sql.ExecuteDataTable(CommandType.Text, "SELECT * FROM CVCalisma WHERE CvId = @CvId",
                                              new SqlParameter("@CvId", id)
                                              );

                if (k2.Rows.Count > 0)
                {
                    return(Ok("Kullanıcının çalışma bilgileri mevcuttur silinemez"));
                }

                var k3 = sql.ExecuteDataTable(CommandType.Text, "SELECT * FROM IlanBasvuru WHERE CvId = @CvId",
                                              new SqlParameter("@CvId", id)
                                              );

                if (k3.Rows.Count > 0)
                {
                    return(Ok("Kullanıcının firma başvuru bilgileri mevcuttur silinemez"));
                }


                var b = sql.ExecuteNonQuery(CommandType.StoredProcedure, "sp_CvSil",
                                            new SqlParameter("@Id", id)
                                            ) > 0;

                if (b)
                {
                    return(Ok());
                }
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);

                return(BadRequest());
            }

            return(BadRequest());
        }
예제 #20
0
        public IActionResult GetAll()
        {
            try
            {
                var users = _userService.GetAll();
                return(Ok(users));
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);

                return(BadRequest());
            }
        }
예제 #21
0
        //TryCatch
        public void FileNameNullOrEmpty_ThrowsNullExceptionTryCatch()
        {
            //arrange
            FileProccess fp = new FileProccess();

            try
            {
                fp.FileExit(@"C:\Users\annac\NTUSER.DAT");
            }
            catch (Exception ex)
            {
                Assert.Fail("Errow");
            }
        }
        public IEnumerable <FirmaIlan> FirmaIlanGetir([FromBody]  SearchFilter SearchFilter)
        {
            try
            {
                DataTable dt = sql.ExecuteDataTable(CommandType.StoredProcedure, "sp_FirmaIlanGetir");

                var result = (from rw in dt.Select()
                              select new FirmaIlan
                {
                    FirmaId = Convert.ToInt32(rw["FirmaId"]),
                    IlanAciklama = Convert.ToString(rw["IlanAciklama"]),
                    Konum = Convert.ToString(rw["Konum"]),
                    SonaErmeSuresi = Convert.ToDateTime(rw["SonaErmeSuresi"])
                }).ToList();

                if (!string.IsNullOrEmpty(SearchFilter.searchString))
                {
                    result = result.Where(s => s.IlanAciklama.Contains(SearchFilter.searchString) ||
                                          s.Konum.Contains(SearchFilter.searchString)).ToList();
                }

                switch (SearchFilter.sortOrder)
                {
                case "name_desc":
                    result = result.OrderByDescending(s => s.IlanAciklama).ToList();
                    break;

                case "Date":
                    result = result.OrderBy(s => s.SonaErmeSuresi).ToList();
                    break;

                case "date_desc":
                    result = result.OrderByDescending(s => s.SonaErmeSuresi).ToList();
                    break;

                default:
                    result = result.OrderBy(s => s.IlanAciklama).ToList();
                    break;
                }

                return(result);
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);

                return(null);
            }
        }
예제 #23
0
        public IEnumerable <Blog> Get([FromBody]  SearchFilter SearchFilter)
        {
            try
            {
                DataTable dt = sql.ExecuteDataTable(CommandType.StoredProcedure, "sp_BlogGet");

                var result = (from rw in dt.Select()
                              select new Blog
                {
                    Id = Convert.ToInt32(rw["Id"]),
                    BlogDescription = Convert.ToString(rw["BlogDescription"]),
                    UserName = Convert.ToString(rw["UserName"]),
                    InstertDate = Convert.ToDateTime(rw["InstertDate"])
                }).ToList();

                if (!string.IsNullOrEmpty(SearchFilter.searchString))
                {
                    result = result.Where(s => s.BlogDescription.Contains(SearchFilter.searchString) ||
                                          s.UserName.Contains(SearchFilter.searchString)).ToList();
                }

                switch (SearchFilter.sortOrder)
                {
                case "name_desc":
                    result = result.OrderByDescending(s => s.UserName).ToList();
                    break;

                case "Date":
                    result = result.OrderBy(s => s.InstertDate).ToList();
                    break;

                case "date_desc":
                    result = result.OrderByDescending(s => s.InstertDate).ToList();
                    break;

                default:
                    result = result.OrderBy(s => s.UserName).ToList();
                    break;
                }

                return(result);
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);

                return(null);
            }
        }
예제 #24
0
        //TryCatch
        public void FileNameNullOrEmpty_ThrowsNullExceptionTryCatch()
        {
            //arrange
            FileProccess fp = new FileProccess();

            try
            {
                fp.FileExit("");
            }
            catch (Exception ex)
            {
                return;
            }
            Assert.Fail("Errow");
        }
        public void FileNameNullOrEmpty_ThrowsArgumentNullException()
        {
            FileProccess fp = new FileProccess();

            try
            {
                fp.FileExists("");
            }
            catch (ArgumentNullException)
            {
                // Test was a success
                return;
            }

            // Fail the test
            Assert.Fail("Call to FileExists() did NOT throw an ArgumentNullException.");
        }
예제 #26
0
        public IActionResult Authenticate([FromBody] User userParam)
        {
            try
            {
                var user = _userService.Authenticate(userParam.KullaniciAdi, userParam.Sifre);

                if (user == null)
                {
                    return(BadRequest(new { message = "Kullanici veya şifre hatalı!" }));
                }

                return(Ok(user));
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);

                return(BadRequest());
            }
        }
        public ActionResult CVCalismaSil(int id)
        {
            try
            {
                var b = sql.ExecuteNonQuery(CommandType.StoredProcedure, "sp_CvCalismaSil",
                                            new SqlParameter("@Id", id)
                                            ) > 0;

                if (b)
                {
                    return(Ok());
                }
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);

                return(BadRequest());
            }

            return(BadRequest());
        }
예제 #28
0
        public IActionResult Register(User user)
        {
            try
            {
                bool isUserExist;
                isUserExist = _userService.IsUserExist(user);

                if (isUserExist)
                {
                    return(BadRequest("Kullanıcı adı sistemde kayıtlıdır."));
                }

                var users = _userService.Insert(user);

                return(Ok(users));
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);

                return(BadRequest());
            }
        }
예제 #29
0
        public ActionResult <Blog> GetbyId(int id)
        {
            try
            {
                DataTable dt = sql.ExecuteDataTable(CommandType.StoredProcedure, "sp_BlogGetbyId", new SqlParameter("@Id", id));

                var result = new Blog
                {
                    Id = Convert.ToInt32(dt.Rows[0]["Id"]),
                    BlogDescription = Convert.ToString(dt.Rows[0]["BlogDescription"]),
                    UserName        = Convert.ToString(dt.Rows[0]["UserName"]),
                    InstertDate     = Convert.ToDateTime(dt.Rows[0]["InstertDate"])
                };

                return(result);
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);

                return(null);
            }
        }
예제 #30
0
        public ActionResult Insert(Blog blog)
        {
            try
            {
                var b = sql.ExecuteNonQuery(CommandType.StoredProcedure, "sp_BlogInsert",
                                            new SqlParameter("@BlogDescription", blog.BlogDescription),
                                            new SqlParameter("@UserName", blog.UserName)
                                            ) > 0;

                if (b)
                {
                    return(Ok());
                }
            }
            catch (Exception ex)
            {
                FileProccess.WriteLog(ex.Message);

                return(BadRequest());
            }

            return(BadRequest());
        }