コード例 #1
0
 public int AddLoaiNCC(vo_LoaiNhaCungCap vo_loaiNCC)
 {
     try
     {
         dao_LoaiNhaCungCap dao = new dao_LoaiNhaCungCap();
         int value = dao.insertLoaiNCC(vo_loaiNCC);
         return(value);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
 public pl_windowThemLoaiNhaCungCap()
 {
     try
     {
         InitializeComponent();
         this.bus_LoaiNCC = new bus_LoaiNhaCungCap();
         this.vo_loaiNCC  = new vo_LoaiNhaCungCap();
         this.DataContext = vo_loaiNCC;
         // tao ma loai nha cung cap
         this.vo_loaiNCC.Id = bus_LoaiNCC.GetLastesIDLoaiNCC() + 1;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Loi!", MessageBoxButton.OK, MessageBoxImage.Information);
     }
 }
コード例 #3
0
 public ObservableCollection <vo_LoaiNhaCungCap> getListLoaiNhaCungCap()
 {
     try
     {
         dao_LoaiNhaCungCap dao = new dao_LoaiNhaCungCap();
         DataTable          dt  = dao.getAllLoaiNhaCungCap();
         ObservableCollection <vo_LoaiNhaCungCap> dsLoaiNCC = new ObservableCollection <vo_LoaiNhaCungCap>();
         foreach (DataRow row in dt.Rows)
         {
             vo_LoaiNhaCungCap vo = new vo_LoaiNhaCungCap(int.Parse(row["ID"].ToString()), row["TENLOAINHACUNGCAP"].ToString());
             dsLoaiNCC.Add(vo);
         }
         return(dsLoaiNCC);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #4
0
 public int insertLoaiNCC(params object[] oParams)
 {
     try
     {
         if (oParams != null)
         {
             vo_LoaiNhaCungCap vo_LoaiNCC = (vo_LoaiNhaCungCap)oParams[0];
             ConnectionString  cnn        = new ConnectionString();
             string            query      = "INSERT INTO LOAINHACUNGCAP(TENLOAINHACUNGCAP) output INSERTED.ID VALUES(@name)";
             string[]          arrParam   = new string[] { "@name" };
             SqlDbType[]       arrType    = new SqlDbType[] { SqlDbType.NVarChar };
             object[]          arrvalues  = new object[] { vo_LoaiNCC.Name };
             return(cnn.conn.ExecuteQueryReturnID(query, arrParam, arrvalues, arrType));
         }
         return(0);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }