/// <summary> /// Update Town in Area /// </summary> /// <param name="model"></param> /// <returns></returns> public long UpdateTownInArea(GroupTown model, int forUser) { long result = 0; //Check create new customer StringBuilder sql = new StringBuilder(); model.DEL_FLG = DeleteFlag.NON_DELETE; sql.Append(@" UPDATE [dbo].[MstTown] "); if (forUser == GroupForUser.Receive) { sql.Append("SET GROUP_CD_RECEIVE = @GROUP_CD, DSP_ORDER_RECEIVE = @DSP_ORDER "); } else { sql.Append("SET GROUP_CD_SENDER = @GROUP_CD, DSP_ORDER_SENDER = @DSP_ORDER "); } sql.Append("WHERE [CITY_CD] = @CITY_CD AND DISTRICT_CD = @DISTRICT_CD AND TOWN_CD = @TOWN_CD"); result = base.DbUpdate(sql.ToString(), model, new { CITY_CD = model.CITY_CD, DISTRICT_CD = model.DISTRICT_CD, TOWN_CD = model.TOWN_CD }); return(result); }
public long UpdateTownInArea(GroupTown model, int forUser) { long res = 0; // Declare new DataAccess object ManageDistrictDa dataAccess = new ManageDistrictDa(); using (var transaction = new TransactionScope()) { res = dataAccess.UpdateTownInArea(model, forUser); if (res <= 0) { transaction.Dispose(); } transaction.Complete(); } return(res); }