Ejemplo n.º 1
0
        private void Validation(IsTakip isTakip)
        {
            var result = _isTakipValidator.Validate(isTakip);

            if (result.Errors.Count > 0)
            {
                throw new ValidationException(result.Errors);
            }
        }
Ejemplo n.º 2
0
        public int Modify(IsTakip isTakip, string procedureName)
        {
            string        connString = ConfigurationManager.ConnectionStrings["MatriksStajCRM"].ConnectionString;
            SqlConnection connection = new SqlConnection(connString);

            SqlCommand command = new SqlCommand
            {
                Connection  = connection,
                CommandType = System.Data.CommandType.StoredProcedure,
                CommandText = procedureName
            };

            if (procedureName == "IsDegistir")
            {
                command.Parameters.Add(new SqlParameter("@IsID", isTakip.IsID));
            }
            command.Parameters.Add(new SqlParameter("@KullaniciID", Session["ID"]));
            command.Parameters.Add(new SqlParameter("@FirmaAdi", isTakip.FirmaAdi));
            command.Parameters.Add(new SqlParameter("@ProjeAd", isTakip.ProjeAd));
            command.Parameters.Add(new SqlParameter("@ProjeYeri", isTakip.ProjeYeri));
            DateTime TeklifTarihi = DateTime.Parse(isTakip.TeklifTarihi);

            command.Parameters.Add(new SqlParameter("@TeklifTarihi", TeklifTarihi));
            DateTime SonGorusmeTarihi = DateTime.Parse(isTakip.TeklifTarihi);

            command.Parameters.Add(new SqlParameter("@SonGorusmeTarihi", isTakip.SonGorusmeTarihi));
            command.Parameters.Add(new SqlParameter("@ProjeVadesi", isTakip.ProjeVadesi));

            if (procedureName == "IsDegistir")
            {
                connection.Open();
                int effectedRows = command.ExecuteNonQuery();
                if (effectedRows != 0)
                {
                    return(effectedRows);
                }
            }
            if (procedureName == "TakipIs")
            {
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                if (reader.HasRows)
                {
                    reader.Read();
                    int IsId = reader.GetInt32(0);
                    connection.Close();
                    return(IsId);
                }
            }

            return(0);
        }
Ejemplo n.º 3
0
        public ActionResult IsTakip()
        {
            List <IsTakip> IsListesi = new List <IsTakip>();

            string        connString = ConfigurationManager.ConnectionStrings["MatriksStajCRM"].ConnectionString;
            SqlConnection connection = new SqlConnection(connString);
            SqlCommand    command    = new SqlCommand
            {
                Connection  = connection,
                CommandType = System.Data.CommandType.StoredProcedure,
                CommandText = "IsListele"
            };

            command.Parameters.Add(new SqlParameter("@KullaniciID", Session["ID"]));
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    try
                    {
                        IsTakip YeniProje = new IsTakip();
                        YeniProje.IsID             = reader.GetInt32(0);
                        YeniProje.FirmaAdi         = reader.GetString(1);
                        YeniProje.ProjeAd          = reader.GetString(2);
                        YeniProje.ProjeYeri        = reader.GetString(3);
                        YeniProje.TeklifTarihi     = reader.GetDateTime(4).ToShortDateString();
                        YeniProje.SonGorusmeTarihi = reader.GetDateTime(5).ToShortDateString();
                        YeniProje.ProjeVadesi      = reader.GetString(6);
                        IsListesi.Add(YeniProje);
                    }
                    catch
                    {
                        Console.WriteLine("A null value has reached");
                    }
                }
            }
            return(View(IsListesi));
        }
Ejemplo n.º 4
0
 public JsonResult ModifyIs(IsTakip isTakip)
 {
     return(Json(Modify(isTakip, "IsDegistir")));
 }
Ejemplo n.º 5
0
 public JsonResult CreateIs(IsTakip isTakip)
 {
     return(Json(Modify(isTakip, "TakipIs")));
 }
Ejemplo n.º 6
0
 public void Update(IsTakip isTakip)
 {
     Validation(isTakip);
     _isTakipDal.Update(isTakip);
 }
Ejemplo n.º 7
0
 public void Delete(IsTakip isTakip)
 {
     _isTakipDal.Delete(isTakip);
 }
Ejemplo n.º 8
0
 public void Add(IsTakip isTakip)
 {
     Validation(isTakip);
     _isTakipDal.Add(isTakip);
 }