/// <summary> /// vuong hung ================================= /// </summary> /// <param name="HanhDong"></param> /// <param name="PhieuThuID"></param> public int sp_Xoa_KiemKeKho(Entities.KiemKeKho ddh) { int Trave = 0; try { dh = new Constants.KiemKeKho(); Sql = new Constants.Sql(); string sql = Sql.sp_Xoa_KiemKeKho; conn = new Connection(); cn = conn.openConnection(); cmd = new SqlCommand(sql, cn); cmd.Parameters.Add(dh.HanhDong, SqlDbType.NVarChar, 20).Value = ddh.Hanhdong; cmd.Parameters.Add(dh.MaKiemKe, SqlDbType.VarChar).Value = ddh.MaKiemKe; Trave = cmd.ExecuteNonQuery(); } catch (Exception ex) { string s = ex.Message.ToString(); } finally { cmd.Connection.Dispose(); cn.Close(); conn.closeConnection(); } return(Trave); }
/// <summary> /// vuong hung =================xu ly don dat hang================ /// </summary> /// <returns></returns> public int sp_XuLy_KiemKeKho(Entities.KiemKeKho ddh) { int Trave = 0; try { Sql = new Constants.Sql(); string sql = Sql.sp_XuLy_KiemKeKho; conn = new Connection(); cn = conn.openConnection(); dh = new Constants.KiemKeKho(); cmd = new SqlCommand(sql, cn); cmd.Parameters.Add(dh.HanhDong, SqlDbType.NVarChar, 20).Value = ddh.Hanhdong; cmd.Parameters.Add(dh.PhieuKiemKeKhoID, SqlDbType.Int).Value = ddh.PhieuKiemKeKhoID; cmd.Parameters.Add(dh.MaKiemKe, SqlDbType.VarChar, 20).Value = ddh.MaKiemKe; cmd.Parameters.Add(dh.NgayKiemKe, SqlDbType.DateTime).Value = ddh.NgayKiemKe; cmd.Parameters.Add(dh.MaKho, SqlDbType.VarChar).Value = ddh.MaKho; cmd.Parameters.Add(dh.GhiChu, SqlDbType.NVarChar, 100).Value = ddh.GhiChu; cmd.Parameters.Add(dh.Deleted, SqlDbType.Bit).Value = ddh.Deleted; Trave = cmd.ExecuteNonQuery(); } catch (Exception ex) { string s = ex.Message.ToString(); } finally { cmd.Connection.Dispose(); cn.Close(); conn.closeConnection(); } return(Trave); }
/// <summary> /// khoi tao gia tri /// </summary> public KiemKeKho() { dh = null; Sql = null; conn = null; cmd = null; arr = null; dr = null; dondathang = null; cn = null; }
/// <summary> /// vuong hung =================lay bang DonDatHang================ /// </summary> /// <returns></returns> public Entities.KiemKeKho[] sp_LayBang_KiemKeKho(Entities.KiemKeKho kk) { Entities.KiemKeKho[] arrC = null; try { dh = new Constants.KiemKeKho(); Sql = new Constants.Sql(); string sql = Sql.sp_LayBang_KiemKeKho; conn = new Connection(); cn = conn.openConnection(); cmd = new SqlCommand(sql, cn); cmd.Parameters.Add(dh.MaKiemKe, SqlDbType.VarChar, 20).Value = kk.MaKiemKe; dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); arr = new ArrayList(); while (dr.Read()) { dondathang = new Entities.KiemKeKho(); dondathang.PhieuKiemKeKhoID = Convert.ToInt32(dr[dh.PhieuKiemKeKhoID].ToString()); dondathang.MaKiemKe = "" + dr[dh.MaKiemKe].ToString(); dondathang.NgayKiemKe = System.Convert.ToDateTime("" + dr[dh.NgayKiemKe].ToString()); dondathang.MaKho = dr[dh.MaKho].ToString(); dondathang.Tenkho = dr[dh.TenKho].ToString(); dondathang.GhiChu = "" + dr[dh.GhiChu].ToString(); dondathang.Deleted = Convert.ToBoolean(dr[dh.Deleted].ToString()); arr.Add(dondathang); } int n = arr.Count; if (n == 0) { return(null); } arrC = new Entities.KiemKeKho[n]; for (int i = 0; i < n; i++) { arrC[i] = (Entities.KiemKeKho)arr[i]; } } catch (Exception ex) { string s = ex.Message.ToString(); } finally { cmd.Connection.Dispose(); cn.Close(); conn.closeConnection(); } return(arrC); }