예제 #1
0
        public HttpResponseMessage PostGiay(Giay1 giay1)
        {
            var response = Request.CreateResponse <Giay1>(HttpStatusCode.Created, null);

            string uri = Url.Link("GiayApi", null);

            response.Headers.Location = new Uri(uri);
            return(response);
        }
예제 #2
0
        private void CbxMaGiay_SelectedValueChanged(object sender, EventArgs e)
        {
            ComboBox combo = sender as ComboBox;

            if (combo.SelectedValue != null)
            {
                Giay1 g = combo.SelectedValue as Giay1;
                id_g = g.MaGiay.ToString();
            }
        }
예제 #3
0
        public HttpResponseMessage PutGiay(Giay1 giay1)
        {
            //GiayServices.setGiay(giay1.MaGiay, giay1.TenGiay, giay1.DaXoa, giay1.MaHieuGiay);
            var response = Request.CreateResponse <Giay1>(HttpStatusCode.Created, null);

            string uri = Url.Link("GiayApi", null);

            response.Headers.Location = new Uri(uri);
            return(response);
        }
        public static void DelGiay(Giay1 giay)
        {
            string connectionString = String.Format("Server={0};Database={1};Integrated Security={2};",
                                                    Properties.Resources.ServerName,
                                                    Properties.Resources.DatabaseName,
                                                    Properties.Resources.Integrated_Security
                                                    );

            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand("DEL_GIAY", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@MAGiAY", giay.MaGiay));

                cmd.ExecuteNonQuery();
            }
        }
        public static void AddGiay(Giay1 giay)
        {
            string connectionString = String.Format("Server={0};Database={1};Integrated Security={2};",
                                                    Properties.Resources.ServerName,
                                                    Properties.Resources.DatabaseName,
                                                    Properties.Resources.Integrated_Security
                                                    );

            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand("ADD_GIAY", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@TENGIAY", giay.TenGiay));
                cmd.Parameters.Add(new SqlParameter("@MAHIEUGIAY", giay.MaHieuGiay));
                cmd.Parameters.Add(new SqlParameter("@GIASI", giay.GiaSi));
                cmd.Parameters.Add(new SqlParameter("@GIALE", giay.Giale));
                cmd.Parameters.Add(new SqlParameter("@NGAYLAP", giay.Ngaylap));

                cmd.ExecuteNonQuery();
            }
        }