示例#1
0
 private void addData(MatHangObj mh)
 {
     mh.MaMh   = txtmamh.Text.Trim();
     mh.TenMh  = txttenmh.Text.Trim();
     mh.Cd     = ConnectToSql.GetFieldValues("SELECT MACD FROM CONGDUNG WHERE TENCD= N'" + cmbcd.Text + "'");
     mh.Cl     = ConnectToSql.GetFieldValues("SELECT MACL FROM CHATLIEU WHERE TENCL= N'" + cmbcl.Text + "'");
     mh.Dgb    = txtdgb.Text.Trim();
     mh.Dgn    = txtdgn.Text.Trim();
     mh.Dl     = ConnectToSql.GetFieldValues("SELECT MADL FROM DUNGLUONG WHERE TENDL= N'" + cmbdl.Text + "'");
     mh.GhiChu = txtgc.Text.Trim();
     mh.Hd     = ConnectToSql.GetFieldValues("SELECT MAHD FROM HINHDANG WHERE TENHD= N'" + cmbhd.Text + "'");
     mh.Loai   = ConnectToSql.GetFieldValues("SELECT MAL FROM LOAI WHERE TENL= N'" + cmbloai.Text + "'");
     mh.Mau    = ConnectToSql.GetFieldValues("SELECT MAM FROM MAUSAC WHERE TENM= N'" + cmbmau.Text + "'");
     mh.Ncc    = ConnectToSql.GetFieldValues("SELECT MANCC FROM NHACC WHERE TENNCC= N'" + cmbncc.Text + "'");
     mh.Nd     = ConnectToSql.GetFieldValues("SELECT MADO FROM DORUOU WHERE TENDO= N'" + cmbnd.Text + "'");
     mh.Nsx    = ConnectToSql.GetFieldValues("SELECT MANSX FROM NUOCSX WHERE TENNSX= N'" + cmbnsx.Text + "'");
     mh.Tgbh   = txttgbh.Text.Trim();
     mh.Sl     = txtsl.Text.Trim();
 }
示例#2
0
 public bool UpdData(MatHangObj mhObj)
 {
     cmd.CommandText = "UPDATE DMHANGHOA SET TENH = N'" + mhObj.TenMh + "', MAL = N'" + mhObj.Loai + "', MADL = N'" + mhObj.Dl + "', MACD= N'" + mhObj.Cd + "', MACL = N'" + mhObj.Cl + "', MAHD = N'" + mhObj.Hd + "', MADO = N'" + mhObj.Nd + "', MAM = N'" + mhObj.Mau + "', MANSX = '" + mhObj.Nsx + "', SOLUONG = N'" + mhObj.Sl + "', DGNHAP = N'" + mhObj.Dgn + "', DGBAN = N'" + mhObj.Dgb + "', THOIGIANBH = N'" + mhObj.Tgbh + "', GHICHU = N'" + mhObj.GhiChu + "',MANCC = N'" + mhObj.Ncc + "', ANH = '" + View.ucMatHang.name_Image + "' WHERE MAH = '" + mhObj.MaMh + "'";
     cmd.CommandType = CommandType.Text;
     cmd.Connection  = con.Connection;
     try
     {
         con.OpenConn();
         cmd.ExecuteNonQuery();
         con.CloseConn();
         return(true);
     }
     catch (Exception ex)
     {
         string mex = ex.Message;
         cmd.Dispose();
         con.CloseConn();
     }
     return(false);
 }
示例#3
0
 public bool AddData(MatHangObj mhObj)
 {
     //cmd.CommandText = "INSERT INTO DMHANGHOA VALUES ('MH002', N'chivas','L001','DL001','CD001','CL001','HD001','DO001','M001','NSX001','20','10','10','1','a','NCC001','C:\\Users\\HongSon\\Desktop\\NET\\QL_BanRuou\\QL_BanRuou\\AnhNv\\DHS.jpg')";
     cmd.CommandText = "INSERT INTO DMHANGHOA VALUES ('" + mhObj.MaMh + "', N'" + mhObj.TenMh + "', N'" + mhObj.Loai + "', N'" + mhObj.Dl + "', N'" + mhObj.Cd + "', N'" + mhObj.Cl + "', N'" + mhObj.Hd + "',N'" + mhObj.Nd + "', N'" + mhObj.Mau + "', N'" + mhObj.Nsx + "', '" + mhObj.Sl + "', '" + mhObj.Dgn + "', '" + mhObj.Dgb + "', '" + mhObj.Tgbh + "', N'" + mhObj.GhiChu + "','" + mhObj.Ncc + "','" + View.ucMatHang.name_Image + "')";
     cmd.CommandType = CommandType.Text;
     cmd.Connection  = con.Connection;
     try
     {
         con.OpenConn();
         cmd.ExecuteNonQuery();
         con.CloseConn();
         return(true);
     }
     catch (Exception ex)
     {
         string mex = ex.Message;
         cmd.Dispose();
         con.CloseConn();
     }
     return(false);
 }
示例#4
0
 public bool updData(MatHangObj mhObj)
 {
     return(mhMod.UpdData(mhObj));
 }
示例#5
0
 public bool addData(MatHangObj mhObj)
 {
     return(mhMod.AddData(mhObj));
 }