79 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			79 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Text;
 | |
| using System.Data;
 | |
| using System.Data.SqlClient;
 | |
| using Csla;
 | |
| using Csla.Data;
 | |
| using System.IO;
 | |
| using Volian.Base.Library;
 | |
| 
 | |
| namespace VEPROMS.CSLA.Library
 | |
| {
 | |
| 	public partial class FigureInfoList
 | |
| 	{
 | |
| 		// GetByROFstAndImageIDs - Create any Figure records that are missing from the list
 | |
| 		[Serializable()]
 | |
| 		private class AddByROFstIDImageIDCriteria
 | |
| 		{
 | |
| 			private int _ROFstID;
 | |
| 			public int ROFstID
 | |
| 			{ get { return _ROFstID; } }
 | |
| 			private string _ImagedIDs;
 | |
| 			public string ImagedIDs
 | |
| 			{ get { return _ImagedIDs; } }
 | |
| 			public AddByROFstIDImageIDCriteria(int rOFstID, string imagedIDs)
 | |
| 			{
 | |
| 				_ROFstID = rOFstID;
 | |
| 				_ImagedIDs = imagedIDs;
 | |
| 			}
 | |
| 		}
 | |
| 		public static FigureInfoList AddByROFstIDImageIDs(int rOFstID,string imageIDs)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				FigureInfoList tmp = DataPortal.Fetch<FigureInfoList>(new AddByROFstIDImageIDCriteria(rOFstID,imageIDs));
 | |
| 				FigureInfo.AddList(tmp);
 | |
| 				tmp.AddEvents();
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on FigureInfoList.AddByROFstIDImageIDs", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(AddByROFstIDImageIDCriteria criteria)
 | |
| 		{
 | |
| 			this.RaiseListChangedEvents = false;
 | |
| 			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FigureInfoList.DataPortal_FetchROFstID", GetHashCode());
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						cm.CommandText = "addFiguresByROFstIDandImageIDs";
 | |
| 						cm.Parameters.AddWithValue("@ROFstID", criteria.ROFstID);
 | |
| 						cm.Parameters.AddWithValue("@ImageIDs", criteria.ImagedIDs);
 | |
| 						cm.CommandTimeout = Database.DefaultTimeout;
 | |
| 						using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 						{
 | |
| 							IsReadOnly = false;
 | |
| 							while (dr.Read()) this.Add(new FigureInfo(dr));
 | |
| 							IsReadOnly = true;
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				if (_MyLog.IsErrorEnabled) _MyLog.Error("FigureInfoList.DataPortal_FetchROFstID", ex);
 | |
| 				throw new DbCslaException("FigureInfoList.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 			this.RaiseListChangedEvents = true;
 | |
| 		}
 | |
| 
 | |
| 	}
 | |
| }
 |