Example #1
0
        public List <ProcessCategoryEntity> GetProcessCategorys()
        {
            if (ProcessCategorys.Count > 0)
            {
                return(ProcessCategorys);
            }
            List <ProcessCategoryEntity> list = new List <ProcessCategoryEntity>();

            DataSet ds = SystemDAL.BaseProvider.GetProcessCategory();

            foreach (DataRow tr in ds.Tables[0].Rows)
            {
                ProcessCategoryEntity model = new ProcessCategoryEntity();
                model.FillData(tr);
                model.CategoryItems = new List <CategoryItemsEntity>();
                foreach (DataRow itemtr in ds.Tables[1].Select("CategoryID='" + model.CategoryID + "'"))
                {
                    CategoryItemsEntity item = new CategoryItemsEntity();
                    item.FillData(itemtr);
                    switch (item.Mark % 10)
                    {
                    case 1:
                        item.Desc = "材料";
                        break;

                    case 2:
                        item.Desc = "制版";
                        break;

                    case 3:
                        item.Desc = "裁片";
                        break;

                    case 4:
                        item.Desc = "车缝";
                        break;

                    case 5:
                        item.Desc = "发货";
                        break;

                    case 6:
                        item.Desc = "加工成本";
                        break;

                    default:
                        item.Desc = "";
                        break;
                    }
                    model.CategoryItems.Add(item);
                }
                list.Add(model);
            }

            ProcessCategorys = list;

            return(ProcessCategorys);
        }
Example #2
0
        public ProcessCategoryEntity GetProcessCategoryByID(string categoryid)
        {
            var list = GetProcessCategorys();

            if (list.Where(m => m.CategoryID.ToLower() == categoryid.ToLower()).Count() > 0)
            {
                return(list.Where(m => m.CategoryID.ToLower() == categoryid.ToLower()).FirstOrDefault());
            }
            ProcessCategoryEntity model = new ProcessCategoryEntity();

            DataSet ds = SystemDAL.BaseProvider.GetProcessCategoryByID(categoryid);

            if (ds.Tables[0].Rows.Count > 0)
            {
                model.FillData(ds.Tables[0].Rows[0]);
                model.CategoryItems = new List <CategoryItemsEntity>();
                foreach (DataRow itemtr in ds.Tables[1].Rows)
                {
                    CategoryItemsEntity item = new CategoryItemsEntity();
                    item.FillData(itemtr);
                    switch (item.Mark % 10)
                    {
                    case 1:
                        item.Desc = "材料";
                        break;

                    case 2:
                        item.Desc = "制版";
                        break;

                    case 3:
                        item.Desc = "裁片";
                        break;

                    case 4:
                        item.Desc = "车缝";
                        break;

                    case 5:
                        item.Desc = "发货";
                        break;

                    case 6:
                        item.Desc = "加工成本";
                        break;

                    default:
                        item.Remark = "";
                        break;
                    }
                    model.CategoryItems.Add(item);
                }
                list.Add(model);
            }
            return(model);
        }