public bool UpdateStatus(List <int> id, short RowFlag, bool IsShow, bool IsJunk) { // var data = qDB.view_ProductShipments.Where(m => id.Contains(m.ProductShipmentID)); var str = "UPDATE b2bProductShipment SET RowFlag = {0} WHERE ProductShipmentID = {3}"; using (var trans = new TransactionScope()) { for (var i = 0; i < id.Count(); i++) { qDB.ExecuteCommand(str, RowFlag, IsShow, IsJunk, id[i]); qDB.SubmitChanges(); } trans.Complete(); } for (var i = 0; i < id.Count(); i++) { qDB.ExecuteCommand("UPDATE b2bProductShipment SET RowFlag = {0} , IsShow = {1} , IsJunk = {2} WHERE ProductShipmentID = {3}", RowFlag, IsShow, IsJunk, id[i]); qDB.SubmitChanges(); } return(IsResult); }
public bool UpdateByCondition <T>(string sqlUpdate, string sqlWhere) { Type t = typeof(T); string query = "UPDATE " + t.Name + " SET " + sqlUpdate + " WHERE " + sqlWhere; try { qDB.ExecuteCommand(@query); return(IsResult = true); } catch (Exception ex) { MsgError.Add(ex); return(IsResult = false); } }