Ejemplo n.º 1
0
        public void LoadAvailableStandardInclusionPAGs(string productid, string productname, int areaid, int groupid, int pbrandid, int pregiongroupid)
        {
            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_GetAvailableStandardInclusionPAG(areaid, groupid, productid, productname, pbrandid, pregiongroupid);

            client.Close();

            SQSProductAreaGroup.Clear();
            ProductAreaGroup pg;

            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    pg = new ProductAreaGroup();
                    pg.ProductAreaGroupID = int.Parse(dr["productareagroupid"].ToString());
                    pg.AreaID             = int.Parse(dr["areaid"].ToString());
                    pg.GroupID            = int.Parse(dr["groupid"].ToString());
                    pg.AreaName           = dr["areaname"].ToString();
                    pg.GroupName          = dr["groupname"].ToString();
                    pg.ProductID          = dr["productid"].ToString();
                    pg.ProductName        = dr["productname"].ToString();
                    pg.ProductDescription = dr["productdescription"].ToString();
                    pg.ProductIDName      = dr["productid"].ToString() + " - " + dr["productname"].ToString();
                    DateTime.TryParse(dr["EffectiveDate"].ToString(), out dateSelected);
                    if (dateSelected != (DateTime)System.Data.SqlTypes.SqlDateTime.MinValue)
                    {
                        pg.EffectiveDate = dateSelected.AddHours(3).ToString("dd/MM/yyyy");
                    }
                    SQSProductAreaGroup.Add(pg);
                }
            }
        }