private bool SendDataToEBS_AllOrSingleSite(string siteCode, int ehID, string type, XElement data, bool isDeleted) { ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "SendDataToEBS_AllOrSingleSite"); bool result = default(bool); try { if ((siteCode.IsEmpty() || siteCode == "0")) { // get all the active sites var sites = _di.GetSites(string.Empty); if (sites != null) { bool result2 = true; try { Parallel.For(0, sites.Count, (i, l) => { DLSiteDto site = sites[i]; result2 &= this.SendDataToEBS(site.SiteId, ehID, type, data, isDeleted); if (!result2) { l.Break(); } }); } catch (Exception ex) { Log.Exception(PROC, ex); } finally { result = result2; } } } else { result = this.SendDataToEBS(siteCode, ehID, type, data, isDeleted); } } catch (Exception ex) { Log.Exception(PROC, ex); } return(result); }
public DLSiteCollectionDto GetSites(string siteCode) { ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "GetSites"); DLSiteCollectionDto result = new DLSiteCollectionDto(); try { using (Database db = DbFactory.OpenDB(_connectionString)) { db.Open(); DbParameter[] parameters = db.CreateParameters(1); parameters[0] = db.CreateParameter("@SiteCode", DBNull.Value); if (!siteCode.IsEmpty()) { parameters[0].Value = siteCode; } DataSet ds = db.ExecuteDataset("[dbo].[rsp_EBS_GetSiteDetails]", parameters); DataTable dt = ds.GetDataTable(0); if (dt != null) { foreach (DataRow dr in dt.Rows) { DLSiteDto dto = new DLSiteDto(); dto.SiteId = dr.Field <string>("SiteId"); dto.SiteName = dr.Field <string>("SiteName"); dto.IsActive = dr.Field <bool>("IsActive"); result.Add(dto); } } } } catch (Exception ex) { Log.Exception(PROC, ex); } return(result); }
public DLSiteCollectionDto GetSites(string siteCode) { ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "GetSites"); DLSiteCollectionDto result = new DLSiteCollectionDto(); try { using (Database db = DbFactory.OpenDB(_connectionString)) { db.Open(); DbParameter[] parameters = db.CreateParameters(1); parameters[0] = db.CreateParameter("@SiteCode", DBNull.Value); if (!siteCode.IsEmpty()) parameters[0].Value = siteCode; DataSet ds = db.ExecuteDataset("[dbo].[rsp_EBS_GetSiteDetails]", parameters); DataTable dt = ds.GetDataTable(0); if (dt != null) { foreach (DataRow dr in dt.Rows) { DLSiteDto dto = new DLSiteDto(); dto.SiteId = dr.Field<string>("SiteId"); dto.SiteName = dr.Field<string>("SiteName"); dto.IsActive = dr.Field<bool>("IsActive"); result.Add(dto); } } } } catch (Exception ex) { Log.Exception(PROC, ex); } return result; }