Esempio n. 1
0
        //update main category

        public int UpdateMain(Master_MainCategory a)
        {
            int i;

            using (SqlConnection con = new SqlConnection(cs))
            {
                con.Open();
                string     q   = "update Master_MainCategory set MainCategoryname=@MainCategoryname,MainCategoryDes=@MainCategoryDes where MainCategoryID=@MainCategoryID";
                SqlCommand com = new SqlCommand(q, con);
                com.Parameters.AddWithValue("@MainCategoryID", a.MainCategoryID);
                com.Parameters.AddWithValue("@MainCategoryname", a.MainCategoryname);
                com.Parameters.AddWithValue("@MainCategoryDes", a.MainCategoryDes);

                i = com.ExecuteNonQuery();
            }
            return(i);
        }
Esempio n. 2
0
        //add main category

        public int AddMainM(Master_MainCategory m)
        {
            int i;

            using (SqlConnection con = new SqlConnection(cs))
            {
                con.Open();
                string q = "insert into Master_MainCategory(MainCategoryname,MainCategoryDes,SuperCategoryID) values(@MainCategoryname,@MainCategoryDes,@SuperCategoryID)";

                SqlCommand com = new SqlCommand(q, con);
                // com.Parameters.AddWithValue("@MainCategoryID", m.MainCategoryID);
                com.Parameters.AddWithValue("@MainCategoryname", m.MainCategoryname);
                com.Parameters.AddWithValue("@MainCategoryDes", m.MainCategoryDes);
                com.Parameters.AddWithValue("@SuperCategoryID", m.SuperCategoryID);

                i = com.ExecuteNonQuery();
            }
            return(i);
        }
 public JsonResult update(Master_MainCategory m)
 {
     return(Json(db.UpdateMain(m), JsonRequestBehavior.AllowGet));
 }
 public JsonResult AddMain(Master_MainCategory m)
 {
     return(Json(db.AddMainM(m), JsonRequestBehavior.AllowGet));
 }