public void LoadAllStandardInclusions(int pbrandid, int pregiongroupid, int pagid, string productid, string productname) { DateTime dateSelected = (DateTime)System.Data.SqlTypes.SqlDateTime.MinValue; client = new SQSAdminServiceClient(); client.Endpoint.Address = new System.ServiceModel.EndpointAddress(CommonVariables.WcfEndpoint); DataSet ds = client.SQSAdmin_StandardInclusion_GetStandardInclusions(pbrandid, pregiongroupid, pagid, loginstateid, productid, productname); client.Close(); SQSAllStandardInclusions.Clear(); foreach (DataRow dr in ds.Tables[0].Rows) { StandardInclusionPAG p = new StandardInclusionPAG(); p.SIBrandID = int.Parse(dr["brandid"].ToString()); p.SIBrandName = dr["brandname"].ToString(); p.PAGID = int.Parse(dr["productareagroupid"].ToString()); p.ProductID = dr["productid"].ToString(); p.ProductName = dr["productname"].ToString(); p.ProductDescription = dr["productdescription"].ToString(); p.Quantity = decimal.Parse(dr["quantity"].ToString()); p.Active = bool.Parse(dr["active"].ToString()); p.StandardInclusionID = int.Parse(dr["idstandardinclusions"].ToString()); p.AreaName = dr["areaname"].ToString(); p.GroupName = dr["groupname"].ToString(); p.SIRegionGroupID = int.Parse(dr["regiongroupid"].ToString()); p.SIRegionGroupName = dr["regiongroupname"].ToString(); DateTime.TryParse(dr["EffectiveDate"].ToString(), out dateSelected); if (dateSelected != (DateTime)System.Data.SqlTypes.SqlDateTime.MinValue) { p.EffectiveDate = dateSelected.AddHours(3).ToString("dd/MM/yyyy"); } SQSAllStandardInclusions.Add(p); } }