示例#1
0
        public ActionResult CreateCate()
        {
            OLoaiTrangTinh data = new OLoaiTrangTinh();

            data.TrangThai = false;

            return(View("UpdateCate", data));
        }
示例#2
0
        public void Add(OLoaiTrangTinh item)
        {
            conn.connect();
            var comm = new SqlCommand("LoaiTrangTinh_Add", conn.db);

            comm.CommandType = System.Data.CommandType.StoredProcedure;
            comm.Parameters.Add(new SqlParameter("@MoTa", item.MoTa ?? (object)DBNull.Value));
            comm.Parameters.Add("@TenLoai", SqlDbType.NVarChar).Value   = item.TenLoai;
            comm.Parameters.Add("@IsActive", SqlDbType.Bit).Value       = item.TrangThai;
            comm.Parameters.Add("@TenVanTat", SqlDbType.NVarChar).Value = Help.Helper.convertToUnSign3(item.TenLoai);
            comm.ExecuteNonQuery();
            conn.Close();
        }
示例#3
0
        public OLoaiTrangTinh GetByShortName(string shortname)
        {
            conn.connect();
            var comm = new SqlCommand("LoaiTrangTinh_GetByShortName", conn.db);

            comm.CommandType = CommandType.StoredProcedure;

            OLoaiTrangTinh item = new OLoaiTrangTinh();

            comm.Parameters.Add("@TenVanTat", SqlDbType.NVarChar).Value = shortname;

            DataTable dt = new DataTable();

            dt.Load(comm.ExecuteReader());
            item = Help.DAL.ConvertDataTable <OLoaiTrangTinh>(dt).FirstOrDefault();
            conn.Close();
            return(item);
        }
示例#4
0
        public OLoaiTrangTinh Get(int id)
        {
            conn.connect();
            var comm = new SqlCommand("LoaiTrangTinh_Get", conn.db);

            comm.CommandType = CommandType.StoredProcedure;

            OLoaiTrangTinh item = new OLoaiTrangTinh();

            comm.Parameters.Add("@MaLoai", SqlDbType.Int).Value = id;

            DataTable dt = new DataTable();

            dt.Load(comm.ExecuteReader());
            item = Help.DAL.ConvertDataTable <OLoaiTrangTinh>(dt).FirstOrDefault();
            conn.Close();
            return(item);
        }
示例#5
0
        public ActionResult CreateCate(OLoaiTrangTinh model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    model.TenVanTat = Help.Helper.convertToUnSign3(model.TenLoai);
                    loaiTrangTinhService.Add(model);
                    return(RedirectToAction("SearchCate", "QuanLyTrangTinh"));
                }
                catch (Exception e)
                {
                }
            }

            ViewBag.IsEdit = true;
            return(View("Update", model));
        }