//Insert public Int32 LH_Insert(DangKyHenKBModel obj) { Int32 iResult = Int32.MinValue; try { Database db = DatabaseFactory.CreateDatabase(ConnectionDefine.HIS_LICHHEN); using (DbCommand cmd = db.GetStoredProcCommand(_ProcedureName)) { db.AddInParameter(cmd, "@Action", DbType.String, "LH_Insert"); db.AddOutParameter(cmd, "@DangKyLichHen_Id", DbType.Int32, obj.DangKyLichHen_Id); db.AddInParameter(cmd, "@TenBenhNhan", DbType.String, obj.TenBenhNhan); db.AddInParameter(cmd, "@NgaySinh", DbType.DateTime, obj.NgaySinh); db.AddInParameter(cmd, "@GioiTinh", DbType.String, obj.GioiTinh); db.AddInParameter(cmd, "@SoDienThoai", DbType.String, obj.SoDienThoai); db.AddInParameter(cmd, "@Email", DbType.String, obj.Email); db.AddInParameter(cmd, "@NgayHen", DbType.Date, obj.NgayHen); db.AddInParameter(cmd, "@ChuyenKhoa_Id", DbType.Int32, obj.ChuyenKhoa_Id); db.AddInParameter(cmd, "@ThoiGianBatDau", DbType.Time, obj.ThoiGianBatDau); db.AddInParameter(cmd, "@ThoiGianKetThuc", DbType.Time, obj.@ThoiGianKetThuc); db.AddInParameter(cmd, "@CreateBy_Id", DbType.Int32, obj.CreateBy_Id); db.ExecuteNonQuery(cmd); iResult = Convert.ToInt32(cmd.Parameters["@DangKyLichHen_Id"].Value); return(iResult); } } catch (Exception ex) { return(-2); }; }
//Update public int LH_Update(DangKyHenKBModel mol) { Int32 iResult = Int32.MinValue; try { Database db = DatabaseFactory.CreateDatabase(ConnectionDefine.HIS_LICHHEN); using (DbCommand cm = db.GetStoredProcCommand(_ProcedureName)) { db.AddInParameter(cm, "@AcTion", DbType.String, "LH_Update"); db.AddInParameter(cm, "@DangKyLichHen_Id", DbType.Int32, mol.DangKyLichHen_Id); db.AddInParameter(cm, "@TenBenhNhan", DbType.String, mol.TenBenhNhan); db.AddInParameter(cm, "@NgaySinh", DbType.Date, mol.NgaySinh); db.AddInParameter(cm, "@GioiTinh", DbType.String, mol.GioiTinh); db.AddInParameter(cm, "@SoDienThoai", DbType.String, mol.SoDienThoai); db.AddInParameter(cm, "@Email", DbType.String, mol.Email); db.AddInParameter(cm, "@NgayHen", DbType.Boolean, mol.NgayHen); db.AddInParameter(cm, "@ChuyenKhoa_Id", DbType.Boolean, mol.ChuyenKhoa_Id); db.AddInParameter(cm, "@ThoiGianBatDau", DbType.Time, mol.ThoiGianBatDau); db.AddInParameter(cm, "@ThoiGianKetThuc", DbType.Time, mol.ThoiGianKetThuc); db.AddInParameter(cm, "@UpdateBy_Id", DbType.Int32, mol.UpdateBy_Id); iResult = db.ExecuteNonQuery(cm); return(iResult); } } catch (Exception ex) { return(-2); } }
//Update public int LH_Update(DangKyHenKBModel obj) { try { ViCareDAC tkdac = new ViCareDAC(); return(tkdac.LH_Update(obj)); } catch (Exception ex) { return(-2); } }
//DangKyHenKB_Update public int LH_Update(DangKyHenKBModel obj) { ViCareComponent objc = new ViCareComponent(); return(objc.LH_Update(obj)); }