本文整理汇总了C#中SharedDbConnectionScope类的典型用法代码示例。如果您正苦于以下问题:C# SharedDbConnectionScope类的具体用法?C# SharedDbConnectionScope怎么用?C# SharedDbConnectionScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SharedDbConnectionScope类属于命名空间,在下文中一共展示了SharedDbConnectionScope类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CapnhatSoluong
public static ActionResult CapnhatSoluong(long id, int soluongngay,byte cachtinhsoluong)
{
try
{
using (var scope = new TransactionScope())
{
using (var sh = new SharedDbConnectionScope())
{
new Update(NoitruPhanbuonggiuong.Schema)
.Set(NoitruPhanbuonggiuong.Columns.SoLuong).EqualTo(soluongngay)
.Set(NoitruPhanbuonggiuong.Columns.CachtinhSoluong).EqualTo(cachtinhsoluong)
.Where(NoitruPhanbuonggiuong.Columns.Id).IsEqualTo(id).Execute();
}
scope.Complete();
return ActionResult.Success;
}
}
catch (Exception exception)
{
Utility.CatchException(exception);
return ActionResult.Error;
}
}
开发者ID:khaha2210,项目名称:CodeNewHis,代码行数:25,代码来源:noitru_nhapvien.cs
示例2: TongHopChiPhi
/// <summary>
///
/// </summary>
/// <param name="objPatientExam"></param>
/// <param name="Khoanoitru_tonghop">true= Khoa nội trú tự chốt dữ liệu;fasle= Khoa tổng hợp chốt dữ liệu</param>
/// <returns></returns>
public static ActionResult TongHopChiPhi(KcbLuotkham objPatientExam,short idKhoanoitru, bool Khoanoitru_tonghop)
{
try
{
using (var scope = new TransactionScope())
{
using (var sh = new SharedDbConnectionScope())
{
new Update(KcbLuotkham.Schema)
.Set(KcbLuotkham.Columns.TrangthaiNoitru).EqualTo(Utility.Int32Dbnull(objPatientExam.TrangthaiNoitru))
.Set(KcbLuotkham.Columns.TthaiThopNoitru).EqualTo(Utility.Int32Dbnull(objPatientExam.TthaiThopNoitru))
.Set(KcbLuotkham.Columns.NguoiSua).EqualTo(globalVariables.UserName)
.Set(KcbLuotkham.Columns.NgaySua).EqualTo(DateTime.Now)
.Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objPatientExam.MaLuotkham)
.And(KcbLuotkham.Columns.IdBenhnhan)
.IsEqualTo(Utility.Int32Dbnull(objPatientExam.IdBenhnhan))
.Execute();
SPs.NoitruChotdulieuravien(objPatientExam.MaLuotkham, objPatientExam.IdBenhnhan, idKhoanoitru, Utility.Bool2byte(Khoanoitru_tonghop), (byte)(Utility.Byte2Bool(KcbLuotkham.Columns.TthaiThopNoitru) ? 1 : 0)).Execute();
}
scope.Complete();
return ActionResult.Success;
}
}
catch (Exception ex)
{
return ActionResult.Error;
}
}
开发者ID:khaha2210,项目名称:CodeNewHis,代码行数:35,代码来源:noitru_tonghopchiphi.cs
示例3: ChuyenPhong
public static ActionResult ChuyenPhong(long IdKham,string LydoChuyen, DmucDichvukcb objDichvuKcb)
{
try
{
ActionResult _ActionResult = ActionResult.Success;
using (var Scope = new TransactionScope())
{
using (var dbScope = new SharedDbConnectionScope())
{
new Update(KcbDangkyKcb.Schema)
.Set(KcbDangkyKcb.Columns.IdPhongkham).EqualTo(objDichvuKcb.IdPhongkham)
.Set(KcbDangkyKcb.Columns.IdDichvuKcb).EqualTo(objDichvuKcb.IdDichvukcb)
.Set(KcbDangkyKcb.Columns.IdKieukham).EqualTo(objDichvuKcb.IdKieukham)
.Set(KcbDangkyKcb.Columns.TenDichvuKcb).EqualTo(objDichvuKcb.TenDichvukcb)
.Set(KcbDangkyKcb.Columns.NgayDangky).EqualTo(globalVariables.SysDate)
.Set(KcbDangkyKcb.Columns.NguoiChuyen).EqualTo(globalVariables.UserName)
.Set(KcbDangkyKcb.Columns.NgayChuyen).EqualTo(globalVariables.SysDate)
.Set(KcbDangkyKcb.Columns.LydoChuyen).EqualTo(LydoChuyen)
.Set(KcbDangkyKcb.Columns.TrangthaiChuyen).EqualTo(1)
.Where(KcbDangkyKcb.Columns.IdKham).IsEqualTo(IdKham)
.Execute();
}
Scope.Complete();
return ActionResult.Success;
}
}
catch (Exception ex)
{
Utility.ShowMsg("Lỗi khi chuyển đối tượng:\n"+ex.Message);
return ActionResult.Exception;
}
}
开发者ID:khaha2210,项目名称:VXIS,代码行数:32,代码来源:ChuyenPhongkham.cs
示例4: On_ActionAdd
protected override void On_ActionAdd(object sender, EventArgs e)
{
if (AppContext.Context.CompanyType == CompanyType.MealCompany)
{
txtMessage.InnerHtml = "阁下的商家类型无权使用此功能";
return;
}
if (!ValidateData( ))
{
txtMessage.InnerHtml = "保存失败!";
return;
}
try
{
using (TransactionScope ts = new TransactionScope( ))
{
using (SharedDbConnectionScope ss = new SharedDbConnectionScope( ))
{
SaveData( );
OrderBLL.UpdateBalance( );
ts.Complete( );
}
}
txtMessage.InnerHtml = "保存成功!";
ResetField( );
}
catch (Exception ex)
{
Logging.Log("FinanceCash->On_ActionAdd", ex, true);
txtMessage.InnerHtml = ex.Message;
}
}
开发者ID:eleooo,项目名称:App,代码行数:32,代码来源:FinanceCash.aspx.cs
示例5: UpdateDynamicValues
public ActionResult UpdateDynamicValues(List<DynamicValue> lstValues)
{
try
{
using (var scope = new TransactionScope())
{
using (var sp = new SharedDbConnectionScope())
{
foreach (DynamicValue _object in lstValues)
{
if (_object.Id > 0)
{
_object.MarkOld();
_object.IsNew = false;
_object.Save();
}
else//Insert
{
_object.IsNew = true;
_object.Save();
}
}
}
scope.Complete();
return ActionResult.Success;
}
}
catch (Exception exception)
{
Utility.ShowMsg(exception.Message);
return ActionResult.Error;
}
}
开发者ID:khaha2210,项目名称:CodeNewHis,代码行数:34,代码来源:frm_DynamicInput.cs
示例6: On_ActionEdit
protected override void On_ActionEdit(object sender, EventArgs e)
{
using (TransactionScope ts = new TransactionScope( ))
{
using (SharedDbConnectionScope ss = new SharedDbConnectionScope( ))
{
try
{
if (CompanyBLL.IsMaxPointLevel(CurrentUser.CompanyId.Value, 0))
txtMessage.InnerHtml = "累计赠送的积分已经超过500,须进行积分结算后才能继续操作系统";
else if (formView.Save<SysCompanyAd>(AdsID) == 0)
{
ts.Complete( );
txtMessage.InnerHtml = "保存成功";
//formView.ClearValue( );
}
else
txtMessage.InnerHtml = "保存失败";
}
catch (Exception ex)
{
Logging.Log("CompanyAdsEdit->On_ActionEdit", ex, true);
txtMessage.InnerHtml = ex.Message;
}
}
}
On_ActionQuery(sender, e);
}
开发者ID:eleooo,项目名称:App,代码行数:28,代码来源:CompanyAdsEdit.aspx.cs
示例7: CHOT_CAPPHAT
public ActionResult CHOT_CAPPHAT(List<int> lstIDDonthuoc, DateTime Ngay_Chot)
{
int v_intResult;
ActionResult actResult;
try
{
using (var scope = new TransactionScope())
{
using (var dbscope = new SharedDbConnectionScope())
{
TLichsuChotthuoc _newItem = new TLichsuChotthuoc();
_newItem.NgayChot = Ngay_Chot;
_newItem.NguoiChot = globalVariables.UserName;
_newItem.IsNew = true;
_newItem.Save();
object obj = TLichsuChotthuoc.CreateQuery().GetMax("ID_CHOT");
TPhieuXuatthuocBenhnhanCollection vCollection = new TPhieuXuatthuocBenhnhanCollection();
v_intResult = new Update(TPhieuXuatthuocBenhnhan.Schema.TableName).Set(TPhieuXuatthuocBenhnhan.NgayChotColumn).EqualTo(Ngay_Chot)
.Set(TPhieuXuatthuocBenhnhan.IdChotColumn).EqualTo(Utility.Int32Dbnull(obj, -1))
.Where(TPhieuXuatthuocBenhnhan.NgayChotColumn).IsNull()
.And(TPhieuXuatthuocBenhnhan.IdDonthuocColumn).In(lstIDDonthuoc)
.Execute();
}
scope.Complete();
return ActionResult.Success;
}
}
catch (Exception ex)
{
Utility.ShowMsg("Lỗi:\n" + ex.ToString());
return ActionResult.Error;
}
}
开发者ID:khaha2210,项目名称:VXIS,代码行数:33,代码来源:ChotThuoc.cs
示例8: Capnhattrangthaithanhtoan
public ActionResult Capnhattrangthaithanhtoan(long IdThanhtoan)
{
try
{
using (var scope = new TransactionScope())
{
using (var dbscope = new SharedDbConnectionScope())
{
new Update(KcbThanhtoan.Schema)
.Set(KcbThanhtoan.Columns.NguoiIn).EqualTo(globalVariables.UserName)
.Set(KcbThanhtoan.Columns.NgayIn).EqualTo(globalVariables.SysDate)
.Set(KcbThanhtoan.Columns.TrangthaiIn).EqualTo(1)
.Where(KcbThanhtoan.Columns.IdThanhtoan).IsEqualTo(IdThanhtoan).Execute();
}
scope.Complete();
return ActionResult.Success;
}
}
catch (Exception exception)
{
log.InfoException("Ban ra loi exception=", exception);
return ActionResult.Error;
}
}
开发者ID:khaha2210,项目名称:CodeNewHis,代码行数:26,代码来源:KCB_THANHTOAN.cs
示例9: On_ActionEdit
protected override void On_ActionEdit(object sender, EventArgs e)
{
if (!CompanyBLL.CheckIsOwnerUser(UserID, CurrentUser.CompanyId.Value))
{
txtMessage.InnerHtml = "你无权编辑非本店会员";
goto lbl_end;
}
if (UserID == CurrentUser.Id)
{
txtMessage.InnerHtml = "此账号为系统内置账号,不能修改.";
goto lbl_end;
}
using (TransactionScope ts = new TransactionScope( ))
{
using (SharedDbConnectionScope ss = new SharedDbConnectionScope( ))
{
if (formView.Save<SysMember>(UserID) == 0)
{
if(isChangePhoneNum)
{
UcFormView.FormViewRow phone = formView.GetViewRow(SysMember.MemberPhoneNumberColumn);
CompanyBLL.UpdateUserPhone(phone.ParamValue, phone.DbValue);
}
ts.Complete( );
txtMessage.InnerHtml = "保存成功!";
}
else
txtMessage.InnerHtml = "保存失败";
}
}
lbl_end:
On_ActionQuery(sender, e);
}
开发者ID:eleooo,项目名称:App,代码行数:33,代码来源:MemberEdit.aspx.cs
示例10: UpdateBienLaiHoaDon
/// <summary>
/// hàm thực hiệnv iệc update thông tin của biên lại hóa đơn
/// </summary>
/// <param name="objhoalog"></param>
/// <param name="objPayment"></param>
/// <param name="HOADON_CAPPHAT_ID"></param>
/// <returns></returns>
public ActionResult UpdateBienLaiHoaDon(HoadonLog objhoalog, KcbThanhtoan objPayment, int HOADON_CAPPHAT_ID)
{
try
{
using (var Scope = new TransactionScope())
{
using (var dbScope = new SharedDbConnectionScope())
{
objhoalog.IdThanhtoan = Utility.Int32Dbnull(objPayment.IdThanhtoan);
objhoalog.IdBenhnhan = Utility.Int32Dbnull(objPayment.IdBenhnhan);
objhoalog.MaLuotkham = Utility.sDbnull(objPayment.MaLuotkham);
objhoalog.MaNhanvien = globalVariables.UserName;
objhoalog.NgayIn = globalVariables.SysDate;
objhoalog.TrangThai = 0;
objhoalog.IsNew = true;
objhoalog.Save();
new Update(HoadonCapphat.Schema)
.Set(HoadonCapphat.Columns.SerieHientai).EqualTo(objhoalog.Serie)
.Set(HoadonCapphat.Columns.TrangThai).EqualTo(1)
.Where(HoadonCapphat.Columns.IdCapphat).IsEqualTo(HOADON_CAPPHAT_ID).
Execute();
}
Scope.Complete();
return ActionResult.Success;
}
}
catch (Exception exception)
{
return ActionResult.Error;
}
}
开发者ID:khaha2210,项目名称:VXIS,代码行数:39,代码来源:KCB_HOADONDO.cs
示例11: NoptienTamung
public static bool NoptienTamung(NoitruTamung objTamung)
{
try
{
using (var scope = new TransactionScope())
{
using (var sh = new SharedDbConnectionScope())
{
objTamung.Save();
KcbLuotkham objKcbLuotkham = Utility.getKcbLuotkham(objTamung.IdBenhnhan, objTamung.MaLuotkham);
if (objKcbLuotkham != null)
{
objKcbLuotkham.IsNew = false;
objKcbLuotkham.MarkOld();
if (Utility.ByteDbnull(objKcbLuotkham.TrangthaiNoitru, 0) == 1)
{
objKcbLuotkham.TrangthaiNoitru = 2;
objKcbLuotkham.Save();
}
}
}
scope.Complete();
}
return true;
}
catch (Exception ex)
{
return false;
}
}
开发者ID:vmshis2020,项目名称:VMSHISServer,代码行数:30,代码来源:noitru_TamungHoanung.cs
示例12: ChuyentoanboVTTHvaogoi
public ActionResult ChuyentoanboVTTHvaogoi(long IdDonthuoc,int id_goi)
{
try
{
using (var scope = new TransactionScope())
{
using (var sh = new SharedDbConnectionScope())
{
new Update(KcbDonthuoc.Schema)
.Set(KcbDonthuoc.Columns.IdGoi).EqualTo(id_goi)
.Set(KcbDonthuoc.Columns.TrongGoi).EqualTo(1)
.Where(KcbDonthuoc.Columns.IdDonthuoc).IsEqualTo(IdDonthuoc).Execute();
new Update(KcbDonthuocChitiet.Schema)
.Set(KcbDonthuocChitiet.Columns.IdGoi).EqualTo(id_goi)
.Set(KcbDonthuocChitiet.Columns.TrongGoi).EqualTo(1)
.Where(KcbDonthuocChitiet.Columns.IdDonthuoc).IsEqualTo(IdDonthuoc).Execute();
}
scope.Complete();
return ActionResult.Success;
}
}
catch (Exception exception)
{
log.Error("loi trong qua trinh xoa phieu dieu tri {0}", exception.ToString());
return ActionResult.Error;
}
}
开发者ID:khaha2210,项目名称:CodeNewHis,代码行数:27,代码来源:noitru_phieudieutri.cs
示例13: DanhdautrangthaiTiem
public ActionResult DanhdautrangthaiTiem(KcbDonthuocChitiet objChitiet, long _IdKham, bool Da_tiem)
{
try
{
using (var scope = new TransactionScope())
{
using (var sh = new SharedDbConnectionScope())
{
if (objChitiet != null)
{
objChitiet.IsNew = false;
objChitiet.DaDung = Utility.Bool2byte(Da_tiem);
objChitiet.MarkOld();
objChitiet.Save();
}
else
{
new Update(KcbDonthuocChitiet.Schema)
.Set(KcbDonthuocChitiet.Columns.DaDung).EqualTo(Utility.Bool2byte(Da_tiem))
.Where(KcbDonthuocChitiet.Columns.IdKham).IsEqualTo(_IdKham)
.Execute();
}
}
scope.Complete();
return ActionResult.Success;
}
}
catch (Exception exception)
{
log.Error("Loi trong qua trinh chuyen vien khoi noi tru {0}", exception);
return ActionResult.Error;
}
}
开发者ID:vmshis2020,项目名称:VMSHISServer,代码行数:34,代码来源:KCB_THAMKHAM.cs
示例14: On_ActionDelete
protected override void On_ActionDelete(object sender, EventArgs e)
{
TransactionScope ts = new TransactionScope( );
SharedDbConnectionScope ss = new SharedDbConnectionScope( );
try
{
int cashID = Utilities.ToInt(EVENTARGUMENT);
string message;
if (OrderBLL.DeleteMemberCash(cashID, AppContext.Context.Company, out message))
{
OrderBLL.UpdateBalance( );
ts.Complete( );
}
txtMessage.InnerHtml = message;
}
catch (Exception ex)
{
Logging.Log("FinanceList->On_ActionDelete", ex, true);
txtMessage.InnerHtml = ex.Message;
}
finally
{
ss.Dispose( );
ts.Dispose( );
}
On_ActionQuery(sender, e);
}
开发者ID:eleooo,项目名称:App,代码行数:27,代码来源:FinanceList.aspx.cs
示例15: Capnhatgia
public static ActionResult Capnhatgia(long id, decimal don_gia, byte cachtinh_gia)
{
try
{
using (var scope = new TransactionScope())
{
using (var sh = new SharedDbConnectionScope())
{
new Update(NoitruPhanbuonggiuong.Schema)
.Set(NoitruPhanbuonggiuong.Columns.DonGia).EqualTo(don_gia)
.Set(NoitruPhanbuonggiuong.Columns.CachtinhGia).EqualTo(cachtinh_gia)
.Where(NoitruPhanbuonggiuong.Columns.Id).IsEqualTo(id).Execute();
}
scope.Complete();
return ActionResult.Success;
}
}
catch (Exception exception)
{
Utility.CatchException(exception);
return ActionResult.Error;
}
}
开发者ID:khaha2210,项目名称:CodeNewHis,代码行数:25,代码来源:noitru_nhapvien.cs
示例16: BoHoadondo
public ActionResult BoHoadondo( long IdHdonLog)
{
try
{
using (var scope = new TransactionScope())
{
using (var db = new SharedDbConnectionScope())
{
new Delete().From(HoadonLog.Schema)
.Where(HoadonLog.Columns.IdHdonLog).IsEqualTo(IdHdonLog).Execute();
new Update(KcbThanhtoan.Schema)
.Set(KcbThanhtoan.Columns.Serie).EqualTo("")
.Set(KcbThanhtoan.Columns.MauHoadon).EqualTo("")
.Set(KcbThanhtoan.Columns.MaQuyen).EqualTo("")
.Set(KcbThanhtoan.Columns.KiHieu).EqualTo("")
.Set(KcbThanhtoan.Columns.IdHdonLog).EqualTo(-1)
.Set(KcbThanhtoan.Columns.IdCapphat).EqualTo(-1)
.Set(KcbThanhtoan.Columns.TrangthaiSeri).EqualTo(0)
.Where(KcbThanhtoan.Columns.IdHdonLog).IsEqualTo(IdHdonLog).Execute();
}
scope.Complete();
return ActionResult.Success;
}
}
catch
{
return ActionResult.Exception;
}
}
开发者ID:khaha2210,项目名称:CodeNewHis,代码行数:29,代码来源:KCB_THANHTOAN.cs
示例17: HuyXacNhanPhieuTraLaiKho
/// <summary>
/// hàm thực hiện việc xác nhận thông tin
/// </summary>
/// <param name="objPhieuNhap"></param>
/// <returns></returns>
public ActionResult HuyXacNhanPhieuTraLaiKho(TPhieuNhapxuatthuoc objPhieuNhap)
{
HisDuocProperties objHisDuocProperties = PropertyLib._HisDuocProperties;
string errorMessage = "";
try
{
using (var Scope = new TransactionScope())
{
using (var dbScope = new SharedDbConnectionScope())
{
SqlQuery sqlQuery = new Select().From(TPhieuNhapxuatthuocChitiet.Schema)
.Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu);
TPhieuNhapxuatthuocChitietCollection objPhieuNhapCtCollection =
sqlQuery.ExecuteAsCollection<TPhieuNhapxuatthuocChitietCollection>();
foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapCt in objPhieuNhapCtCollection)
{
//Kiểm tra ở kho nhập xem thuốc đã sử dụng chưa
ActionResult _Kiemtrathuochuyxacnhan = Kiemtrathuochuyxacnhan(objPhieuNhap, objPhieuNhapCt);
if (_Kiemtrathuochuyxacnhan != ActionResult.Success) return _Kiemtrathuochuyxacnhan;
int id_thuockho = -1;
StoredProcedure sp = SPs.ThuocNhapkhoOutput(objPhieuNhapCt.NgayHethan, objPhieuNhapCt.GiaNhap, objPhieuNhapCt.GiaBan,
objPhieuNhapCt.SoLuong, Utility.DecimaltoDbnull(objPhieuNhapCt.Vat),
objPhieuNhapCt.IdThuoc, objPhieuNhap.IdKhonhap, objPhieuNhapCt.MaNhacungcap,
objPhieuNhapCt.SoLo, objPhieuNhapCt.SoDky, objPhieuNhapCt.SoQdinhthau, -1, id_thuockho,
objPhieuNhap.NgayXacnhan, objPhieuNhapCt.GiaBhyt, objPhieuNhapCt.GiaPhuthuDungtuyen, objPhieuNhapCt.GiaPhuthuTraituyen, objPhieuNhapCt.KieuThuocvattu);
sp.Execute();
sp = SPs.ThuocXuatkho(objPhieuNhap.IdKhoxuat, objPhieuNhapCt.IdThuoc,
objPhieuNhapCt.NgayHethan, objPhieuNhapCt.GiaNhap,objPhieuNhapCt.GiaBan,
Utility.DecimaltoDbnull(objPhieuNhapCt.Vat),
Utility.Int32Dbnull(objPhieuNhapCt.SoLuong), objPhieuNhapCt.IdThuockho, objPhieuNhapCt.MaNhacungcap, objPhieuNhapCt.SoLo, objHisDuocProperties.XoaDulieuKhiThuocDaHet ? 1 : 0, errorMessage);
sp.Execute();
errorMessage = Utility.sDbnull(sp.OutputValues[0]);
}
//Xóa toàn bộ chi tiết trong TBiendongThuoc
new Delete().From(TBiendongThuoc.Schema)
.Where(TBiendongThuoc.IdPhieuColumn).IsEqualTo(objPhieuNhap.IdPhieu).Execute();
new Update(TPhieuNhapxuatthuoc.Schema)
.Set(TPhieuNhapxuatthuoc.Columns.IdNhanvien).EqualTo(null)
.Set(TPhieuNhapxuatthuoc.Columns.NguoiXacnhan).EqualTo(null)
.Set(TPhieuNhapxuatthuoc.Columns.NgayXacnhan).EqualTo(null)
.Set(TPhieuNhapxuatthuoc.Columns.TrangThai).EqualTo(0)
.Where(TPhieuNhapxuatthuoc.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu).Execute();
}
Scope.Complete();
return ActionResult.Success;
}
}
catch (Exception exception)
{
log.Error("Loi ban ra tu sp :{0}", errorMessage);
log.Error("Loi trong qua trinh xac nhan don thuoc :{0}", exception);
return ActionResult.Error;
}
}
开发者ID:vmshis2015,项目名称:VMSPharmacy,代码行数:62,代码来源:PhieuTralaiThuocKhoaVeKho.cs
示例18: cmdSave_Click
private void cmdSave_Click(object sender, EventArgs e)
{
try
{
using (var Scope = new TransactionScope())
{
using (var dbScope = new SharedDbConnectionScope())
{
var exists = Exists();
if (exists)
{
int record = new Update(BangGium.Schema).Set(BangGium.Columns.Price).EqualTo(nmrPrice.Value)
.Where(BangGium.Columns.TestTypeId).IsEqualTo(_TestTypeId).And(
BangGium.Columns.TestDataId)
.IsEqualTo(-1).Execute();
if (record <= 0)
{
BangGium bangGium = new BangGium();
bangGium.TestTypeId = _TestTypeId;
bangGium.TestDataId = "-1";
bangGium.Price = Utility.DecimaltoDbnull(nmrPrice.Value, 0);
bangGium.IsNew = true;
bangGium.Save();
}
}
else
{
decimal price = Utility.DecimaltoDbnull(grdDataControl.CurrentRow.Cells["Price"].Value, 0);
nmrPrice.Value = price;
int record = new Update(BangGium.Schema).Set(BangGium.Columns.Price).EqualTo(nmrPrice.Value)
.Where(BangGium.Columns.TestTypeId).IsEqualTo(_TestTypeId)
.And(BangGium.Columns.TestDataId).IsEqualTo(_TestDataId).Execute();
if (record <= 0)
{
BangGium bangGium = new BangGium();
bangGium.TestTypeId = _TestTypeId;
bangGium.TestDataId = _TestDataId;
bangGium.Price = Utility.DecimaltoDbnull(nmrPrice.Value, 0);
bangGium.IsNew = true;
bangGium.Save();
}
}
}
Scope.Complete();
//Utility.ShowMsg("Lưu thông tin thành công.");
}
}
catch (Exception)
{
Utility.ShowMsg("Có lỗi trong quá trình lưu thông tin");
throw;
}
}
开发者ID:khaha2210,项目名称:CodeNewTeam,代码行数:56,代码来源:frm_BANGGIA.cs
示例19: Add
public ActionResult Add(string format)
{
PointDataSummary newSummary = null;
using (TransactionScope ts = new TransactionScope())
using (SharedDbConnectionScope sharedConnectionScope = new SharedDbConnectionScope())
{
try
{
newSummary = new PointDataSummary();
// Get POST data
TryUpdateModel<PointDataSummary>(newSummary, new[] { "Description", "LayerId", "Latitude", "Longitude", "Guid", "Name", "Tag" });
if (newSummary.Latitude == 0)
{
string lat = HttpContext.Request["Latitude"];
newSummary.Latitude = decimal.Parse(lat, CultureInfo.InvariantCulture);
}
if (newSummary.Longitude == 0)
{
string longi = HttpContext.Request["Longitude"];
newSummary.Longitude = decimal.Parse(longi, CultureInfo.InvariantCulture);
}
PointDataSummary testSummary = GetSummary(newSummary.Guid, newSummary.LayerId);
if (testSummary != null) {
throw new Exception("PointDataSummary already exists in database guid, layerId");
}
newSummary.Description = newSummary.Description ?? string.Empty;
newSummary.Tag = newSummary.Tag ?? string.Empty;
newSummary.CreatedOn = DateTime.UtcNow;
newSummary.ModifiedOn = newSummary.CreatedOn;
newSummary.CreatedById = CurrentUserId;
newSummary.Save();
if (RoleEnvironment.IsAvailable)
SearchEngine.Instance.Index(newSummary.Id);
ts.Complete();
// Set 201 status code, and Location header
HttpContext.Response.StatusCode = 201;
string location = this.BuildUrlFromExpression<SummariesController>(c => c.ShowById(newSummary.Id, format));
HttpContext.Response.AddHeader("Location", location);
}
catch (Exception ex)
{
HttpContext.Response.StatusCode = 400;
return Json( CreateErrorObject(ex) );
}
}
return Json(newSummary);
}
开发者ID:remiolivier,项目名称:Openturf,代码行数:56,代码来源:SummariesController.cs
示例20: Connection_Should_Not_Be_Reused_When_Within_SharedConnectionScope_When_Provider_Is_Different
public void Connection_Should_Not_Be_Reused_When_Within_SharedConnectionScope_When_Provider_Is_Different()
{
var p1 = ProviderFactory.GetProvider(TestConfiguration.MsSql2008TestConnectionString, DbClientTypeName.MsSql);
using (var scope = new SharedDbConnectionScope(p1))
{
var p2 = ProviderFactory.GetProvider(TestConfiguration.SQLiteTestsConnectionString, DbClientTypeName.SqlLite);
Assert.NotSame(p1.CurrentSharedConnection, p2.CurrentSharedConnection);
Assert.Same(scope.CurrentConnection, p1.CurrentSharedConnection);
}
}
开发者ID:alonsorobles,项目名称:SubSonic-3.0,代码行数:10,代码来源:SharedConnectionScopeTests.cs
注:本文中的SharedDbConnectionScope类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论