public int AddConsignmentBillEntry(ConsignmentBillEntryModel entry, int userId) { string sql = @" insert into SJConsignmentBillEntry(InterId,EntryId,ItemId,ItemName,CaseId,CaseName,BrandId,BrandName,IsChecked,ETotalQuantity,EUndoQuantity,ECurrencyQuantity,IsSystem) values(@InterId,@EntryId,@ItemId,@ItemName,@CaseId,@CaseName,@BrandId,@BrandName,@IsChecked,@ECurrencyQuantity,@ECurrencyQuantity,@ECurrencyQuantity,@IsSystem);Set @Id=SCOPE_IDENTITY(); insert into SJConsignmentBillUserCurrencyOperation (BillNo,UserId,InsEntryStatus,EId,InterId,CurrencyQuantity) select BillNo," + userId.ToString() + @",1,@Id,InterId,CurrencyQuantity from SJConsignmentBill where InterId=@InterId ; "; using (var connection = SqlDb.UpdateConnection) { var p = new DynamicParameters(); p.Add("@Id", dbType: DbType.Int32, direction: ParameterDirection.Output); p.Add("@InterId", entry.InterId, dbType: DbType.Int32, direction: ParameterDirection.Input); p.Add("@EntryId", entry.EntryId, dbType: DbType.Int32, direction: ParameterDirection.Input); p.Add("@ItemId", entry.ItemId, dbType: DbType.Int32, direction: ParameterDirection.Input); p.Add("@ItemName", entry.ItemName, dbType: DbType.String, direction: ParameterDirection.Input); p.Add("@CaseId", entry.CaseId, dbType: DbType.Int32, direction: ParameterDirection.Input); p.Add("@CaseName", entry.CaseName, dbType: DbType.String, direction: ParameterDirection.Input); p.Add("@BrandId", entry.BrandId, dbType: DbType.Int32, direction: ParameterDirection.Input); p.Add("@BrandName", entry.BrandName, dbType: DbType.String, direction: ParameterDirection.Input); p.Add("@IsChecked", entry.IsChecked, dbType: DbType.Boolean, direction: ParameterDirection.Input); p.Add("@ECurrencyQuantity", entry.ECurrencyQuantity, dbType: DbType.Single, direction: ParameterDirection.Input); p.Add("@IsSystem", entry.IsSystem, dbType: DbType.Boolean, direction: ParameterDirection.Input); connection.Execute(sql, p); return(p.Get <int>("@Id")); } }
public bool UpdateConsignmentBillEntry(ConsignmentBillEntryModel entry) { string sql = @" update SJConsignmentBillEntry set ECurrencyQuantity=@ECurrencyQuantity,IsChecked=@IsChecked where Id=@Id"; using (var connection = SqlDb.UpdateConnection) { return(connection.Execute(sql, entry) > 0); } }
public void WithParam(ConsignmentBillEntryModel entry, Action <int, ConsignmentBillEntryModel> callBack) { ConsignmentBillEntry = entry; _callBack = callBack; }