Exemple #1
0
        List <Product> GetProducts()
        {
            var Pds = new Dictionary <uint, Product>();

            string Cont = GetHtmlPrdcts();

            if (Cont.Contains("__GETTASK_ERROR__"))
            {
                return(Pds.Values.ToList());
            }

            string[] Lines = Cont.Split("\n".ToCharArray());

            foreach (string Line in Lines)
            {
                if (string.IsNullOrEmpty(Line.Trim()))
                {
                    continue;
                }

                var Cols = Line.Split("\"".ToCharArray());
                int I    = 0;
                var PdId = Cols[I++].ToUint();
                if (PdId == 0)
                {
                    continue;                            //No Product
                }
                Product Pd = null;
                if (Pds.ContainsKey(PdId))
                {
                    Pd = Pds[PdId];
                }
                else
                {
                    Pd = new Product {
                        Id = PdId
                    };
                    Pds[PdId] = Pd;
                }

                Pd.Name = Cols[I++].ToName();
                Pd.PDM  = Cols[I++].Trim();

                var PlanId = Cols[I++].ToUint();
                if (PlanId == 0)
                {
                    continue;                              //No Plan
                }
                var Plan = Pd.GetPlan(PlanId);
                Plan.Title = Cols[I++].ToName();
                Plan.Begin = Cols[I++].ToDt();
                Plan.End   = Cols[I++].ToDt();

                var Nd = new Need {
                    Id = Cols[I++].ToUint()
                };
                if (Nd.Id == 0)
                {
                    continue;                             //No Need.
                }
                Nd.Title = Cols[I++].ToName();
                Nd.St    = Need.ToStatus(Cols[I++].Trim());
                Nd.Stg   = Need.ToStage(Cols[I++].Trim());
                Plan.AddNeed(Nd);
            }

            return(Pds.Values.ToList());
        }