Пример #1
0
 public System.Int32 AddDanhMucItem(DanhMucItemData data)
 {
     try
     {
         var domain = new DanhMucItemDomainObject(ConnectionString);
         return domain.Add(data);
     }
     catch (Exception ex)
     {
         ErrorLog.WebLog("[AddDanhMucItem]", ex.Message);
     }
     return -1;
 }
 public virtual System.Int32 Add(DanhMucItemData obj)
 {
     JDataAccess dao = new JDataAccess(ConnectionString);
     dao.SetCommandText(SP_DANHMUCITEM_INSERT, CommandType.StoredProcedure);
     dao.SetParameters(new IDataParameter[]{
         dao.CreateParameter("@ID", obj.ID),
         dao.CreateParameter("@MaLoaiDanhMuc", obj.MaLoaiDanhMuc),
         dao.CreateParameter("@MaDanhMuc", obj.MaDanhMuc),
         dao.CreateParameter("@TenDanhMuc", obj.TenDanhMuc),
         dao.CreateParameter("@MoTa", obj.MoTa),
         dao.CreateParameter("@ThuTu", obj.ThuTu),
         dao.CreateParameter("@IntVal1", obj.IntVal1),
         dao.CreateParameter("@IntVal2", obj.IntVal2),
         dao.CreateParameter("@IntVal3", obj.IntVal3),
         dao.CreateParameter("@DecVal1", obj.DecVal1),
         dao.CreateParameter("@DecVal2", obj.DecVal2),
         dao.CreateParameter("@DecVal3", obj.DecVal3),
         dao.CreateParameter("@StrVal1", obj.StrVal1),
         dao.CreateParameter("@StrVal2", obj.StrVal2),
         dao.CreateParameter("@StrVal3", obj.StrVal3),
         dao.CreateParameter("@Active", obj.Active)
     });
     return dao.SubmitChange();
 }
        protected virtual DanhMucItemData Convert(DataRow row)
        {
            dynamic data = new DynamicDataRow(row);

            DanhMucItemData obj = new DanhMucItemData();

            obj.ID = System.Convert.ToInt32(data.ID);
            obj.MaLoaiDanhMuc = System.Convert.ToString(data.MaLoaiDanhMuc);
            obj.MaDanhMuc = System.Convert.ToString(data.MaDanhMuc);
            obj.TenDanhMuc = System.Convert.ToString(data.TenDanhMuc);
            obj.MoTa = System.Convert.ToString(data.MoTa);
            obj.ThuTu = System.Convert.ToInt32(data.ThuTu);
            obj.IntVal1 = System.Convert.ToInt32(data.IntVal1);
            obj.IntVal2 = System.Convert.ToInt32(data.IntVal2);
            obj.IntVal3 = System.Convert.ToInt32(data.IntVal3);
            obj.DecVal1 = System.Convert.ToDecimal(data.DecVal1);
            obj.DecVal2 = System.Convert.ToDecimal(data.DecVal2);
            obj.DecVal3 = System.Convert.ToDecimal(data.DecVal3);
            obj.StrVal1 = System.Convert.ToString(data.StrVal1);
            obj.StrVal2 = System.Convert.ToString(data.StrVal2);
            obj.StrVal3 = System.Convert.ToString(data.StrVal3);
            obj.Active = System.Convert.ToBoolean(data.Active);

            return obj;
        }