예제 #1
0
        public ActionResult List()
        {
            var tab          = new Tab();
            var deptCategory = CategoryFactory.GetCategory("Market.ManDept", "责任部门", "ChargerDept");

            deptCategory.SetDefaultItem();
            deptCategory.Multi = false;
            tab.Categories.Add(deptCategory);

            var phaseCategory = CategoryFactory.GetCategory("Project.Phase", "设计阶段", "Phase");

            phaseCategory.SetDefaultItem();
            phaseCategory.Multi = false;
            tab.Categories.Add(phaseCategory);

            var projectClassCategory = CategoryFactory.GetCategory("Market.BusinessType", "业务类型", "ProjectClass");

            projectClassCategory.SetDefaultItem();
            projectClassCategory.Multi = false;
            tab.Categories.Add(projectClassCategory);

            var stateCategory = CategoryFactory.GetCategory(typeof(Project.Logic.ProjectCommoneState), "项目状态", "State");

            stateCategory.SetDefaultItem();
            stateCategory.Multi = false;
            tab.Categories.Add(stateCategory);

            tab.IsDisplay = true;
            ViewBag.Tab   = tab;
            return(View());
        }
예제 #2
0
        static void Main(string[] args)
        {
            var types = Assembly.GetExecutingAssembly().GetTypes();

            Console.WriteLine("Select a category \n");

            foreach (var type in types)
            {
                var iCategory = type.GetInterface("ICategory");
                if (iCategory is null)
                {
                    continue;
                }

                Console.WriteLine("  {0} ", type.Name);
            }

            Console.WriteLine();
            var userInput = Console.ReadLine();

            var category = new CategoryFactory().CreteCategory(userInput);

            category?.PrintMe();

            var warrentyExpirationDate = new CategoryFactory().GetField(userInput, "warrentyExpirationDate");

            Console.WriteLine("Warrenty Expiration Date : {0}", warrentyExpirationDate);
        }
예제 #3
0
        public ActionResult ProjectList()
        {
            var tab          = new Tab();
            var deptCategory = CategoryFactory.GetCategory("Market.ManDept", "责任部门", "ChargeDeptID");

            deptCategory.SetDefaultItem();
            deptCategory.Multi = false;
            tab.Categories.Add(deptCategory);

            var phaseCategory = CategoryFactory.GetCategory("Project.Phase", "设计阶段", "PhaseValue");

            phaseCategory.SetDefaultItem();
            phaseCategory.Multi = false;
            tab.Categories.Add(phaseCategory);
            var RelativeArea = CategoryFactory.GetCategory("Base.ProjectClass", "业务类型", "ProjectClass");

            RelativeArea.SetDefaultItem();
            RelativeArea.Multi = false;
            tab.Categories.Add(RelativeArea);

            var state = CategoryFactory.GetCategory(typeof(Project.Logic.ProjectCommoneState), "项目状态", "State", true);

            state.SetDefaultItem();
            state.Multi = true;
            tab.Categories.Add(state);

            tab.IsDisplay = true;
            ViewBag.Tab   = tab;
            return(View());
        }
예제 #4
0
        //    cate1  cate2    =>   cate1 cate2
        //    /                            \
        //  cate3                         cate3
        public void UpdateCategoryTest10()
        {
            var cateObj = Generator.GenerateCategory(Generator.RandomString(5,
                                                                            Generator.RandomCharacterGroup.AlphaOnly));
            var cate1 = CategoryFactory.AddCategory(ApiMsgHandler, cateObj);

            cateIds1.Add(cate1.Id.Value);

            cateObj = Generator.GenerateCategory(Generator.RandomString(5,
                                                                        Generator.RandomCharacterGroup.AlphaOnly));
            var cate2 = CategoryFactory.AddCategory(ApiMsgHandler, cateObj);

            cateIds1.Add(cate2.Id.Value);

            cateObj = Generator.GenerateCategory(Generator.RandomString(5,
                                                                        Generator.RandomCharacterGroup.AlphaOnly), parentCategoryId: cate1.Id);
            var cate3 = CategoryFactory.AddCategory(ApiMsgHandler, cateObj);

            cateIds1.Add(cate3.Id.Value);

            cate3.ParentCategoryId = cate2.Id;
            var updateCate = CategoryFactory.UpdateCategory(ApiMsgHandler, cate3, cate3.Id.Value, null);

            Assert.AreEqual(cate2.Id, updateCate.ParentCategoryId);

            //verify its old parent
            var getCate = CategoryFactory.GetCategory(ApiMsgHandler, cate1.Id.Value);

            Assert.AreEqual(0, getCate.ChildCount.Value);

            //verify its new parent
            getCate = CategoryFactory.GetCategory(ApiMsgHandler, cate2.Id.Value);
            Assert.AreEqual(1, getCate.ChildCount.Value);
        }
예제 #5
0
        public void GetCategoriesTest1()
        {
            var cates = CategoryFactory.GetCategories(ApiMsgHandler);

            if (cates.TotalCount < 3)
            {
                Assert.Inconclusive("Total categories is less than 3.");
            }
            int pageSize           = (int)(cates.TotalCount / 2);
            int totalCount         = 0;
            int startIndex         = 0;
            int expectedTotalCount = 0;

            while (true)
            {
                cates = CategoryFactory.GetCategories(ApiMsgHandler, startIndex: startIndex, pageSize: pageSize, expectedCode: HttpStatusCode.OK);
                Assert.AreEqual(startIndex, cates.StartIndex);
                Assert.AreEqual((cates.TotalCount + cates.PageSize - 1) / cates.PageSize, cates.PageCount);
                totalCount += cates.Items.Count;
                startIndex += pageSize;
                if (cates.Items.Count < pageSize)
                {
                    expectedTotalCount = (int)cates.TotalCount;
                    break;
                }
            }
            Assert.AreEqual(expectedTotalCount, totalCount);
        }
예제 #6
0
        public void GetCategoryTest1()
        {
            var cates   = CategoryFactory.GetCategories(ApiMsgHandler);
            var getCate = CategoryFactory.GetCategory(ApiMsgHandler, cates.Items.Last().Id.Value);

            Assert.AreEqual(cates.Items.Last().Id, getCate.Id);
        }
예제 #7
0
        public void GetChildCategoriesTest4()
        {
            var cates  = CategoryFactory.GetCategories(ApiMsgHandler, sortBy: "id desc");
            var cates1 = CategoryFactory.GetChildCategories(ApiMsgHandler, cates.Items.First().Id.Value + 14, expectedCode: HttpStatusCode.NotFound);

            Assert.AreEqual(0, cates1.TotalCount);
        }
예제 #8
0
        public void TestEqualsCategoryGroup()
        {
            string nameGEq  = "group";
            string nameGNEq = "group1";

            ICategory      l1      = CategoryFactory.CreateCategory(leafName, null);
            ICategory      l2      = CategoryFactory.CreateCategory(leafName, null);
            IGroupCategory g1      = CategoryFactory.CreateRoot(nameGEq);
            IGroupCategory gEqual  = CategoryFactory.CreateRoot(nameGEq);
            IGroupCategory gNEqual = CategoryFactory.CreateRoot(nameGNEq);

            // l1 | l2 | g1 | gEqual | gNEqual
            Assert.AreEqual(g1, g1);
            Assert.AreEqual(g1, gEqual);
            Assert.AreNotEqual(g1, gNEqual);

            // l2 | g1 -> l1 | gEqual | gNEqual
            //g1 ha un figlio mentre gEqual no
            g1.AddChild(l1);
            Assert.AreNotEqual(g1, gEqual);
            // g1 -> l1 | gEqual -> l2| gNEqual
            //(Confrontando i nomi e i path g1 e gEqual sono due gerarchie identifiche)
            gEqual.AddChild(l2);
            Assert.AreEqual(g1, gEqual);
            // gNEqual -> g1 -> l1 | gEqual -> l2
            // g1 ha un padre mentre l2 no, non sono due gerarchi identifiche
            g1.Parent = gNEqual;
            Assert.AreNotEqual(g1, gEqual);
            // gNEqual -> g1 -> l1 | gRoot -> gEqual -> l2
            //(Confrontando i nomi e i path sono due gerarchie identifiche)
            IGroupCategory gRoot = CategoryFactory.CreateRoot(nameGNEq);

            gEqual.Parent = gRoot;
            Assert.AreEqual(g1, gEqual);
        }
예제 #9
0
        public void TestParentAddRemoveChild()
        {
            IGroupCategory root = CategoryFactory.CreateGroup(rootName, null);
            // root -> child
            IGroupCategory child = CategoryFactory.CreateGroup(childName, root);

            Assert.AreEqual(1, root.Children.Length);
            Assert.AreSame(child, root.Children[0]);
            Assert.AreSame(root, child.Parent);

            ICategory leaf = CategoryFactory.CreateCategory(leafName, null);

            // root -> child -> leaf
            leaf.Parent = child;
            Assert.AreEqual(1, child.Children.Length);
            Assert.AreEqual(1, root.Children.Length);
            Assert.AreSame(leaf, child.Children[0]);
            Assert.AreSame(child, leaf.Parent);

            // root -> child    |  leaf
            leaf.Parent = null;
            Assert.AreEqual(0, child.Children.Length);
            Assert.AreEqual(1, root.Children.Length);
            // root     | child     | leaf
            root.RemoveChild(child);
            Assert.AreEqual(0, child.Children.Length);
            Assert.AreEqual(0, root.Children.Length);
        }
        /// <summary>
        /// Gestisce l'azione dell'add button permettendo l'inserimento di una
        /// nuova categoria
        /// </summary>
        private void AddHandler(Object sender, EventArgs eventArgs)
        {
            ICategory selectedNode = _categoryTree.SelectedNode?.Tag as ICategory ?? null;

            if (selectedNode == null)
            {
                MessageBox.Show("Devi selezionare una categoria radice");
                return;
            }
            // Genero una finestra di dialogo per inserire il nome della categoria
            string catName = "";

            using (StringDialog sd = new StringDialog("Inserisci il nome della categoria"))
            {
                if (sd.ShowDialog() == DialogResult.OK)
                {
                    catName = sd.Response;
                }
                else
                {
                    return;
                }
            }
            // Se il nodo selezionato non è un contenitore lo elimino e lo faccio diventare
            // un contenitore
            if (!(selectedNode is IGroupCategory))
            {
                IGroupCategory parent = selectedNode.Parent;
                parent.RemoveChild(selectedNode);
                selectedNode = CategoryFactory.CreateGroup(selectedNode.Name, parent);
            }
            // Creo la categoria
            CategoryFactory.CreateCategory(catName, selectedNode as IGroupCategory);
        }
예제 #11
0
        public ActionResult MileStonePlanManageList()
        {
            var tab = new Tab();

            var stateCategory = CategoryFactory.GetCategory(typeof(MileStoneState), "State");

            stateCategory.SetDefaultItem(MileStoneState.Plan.ToString());
            tab.Categories.Add(stateCategory);

            var yearCategory = CategoryFactory.GetYearCategory("Year", 5);

            yearCategory.SetDefaultItem(DateTime.Now.Year.ToString());
            tab.Categories.Add(yearCategory);

            var quarterCategory = CategoryFactory.GetQuarterCategory("Season");

            quarterCategory.SetDefaultItem((((DateTime.Now.Month - 1) / 3) + 1).ToString());
            tab.Categories.Add(quarterCategory);

            var monthCategory = CategoryFactory.GetMonthCategory("Month");

            tab.Categories.Add(monthCategory);

            var deptCategory = CategoryFactory.GetCategory("System.ManDept", "部门", "DeptID");

            deptCategory.SetDefaultItem();
            tab.Categories.Add(deptCategory);

            tab.IsDisplay = true;
            ViewBag.Tab   = tab;
            return(View());
        }
        public void Init()
        {
            IsInit = false;

            List <CategoryModel> categories = null;

            if (DbWorker.GetCategories().Count == 0)
            {
                categories = CategoryFactory.GetCategories().ToList();
                foreach (var category in categories)
                {
                    DbWorker.AddCategory(category);
                }
            }
            else
            {
                categories = DbWorker.GetCategories();
            }

            foreach (var category in categories)
            {
                Categories.Add(new CategoryViewModel(category));
            }

            foreach (var cost in DbWorker.GetCosts().Take(TOTAL_COUNT_COSTS))
            {
                Costs.Add(new CostViewModel(cost));
            }

            Accounts.Initialization();

            IsInit = true;
        }
예제 #13
0
        public ActionResult MajorList()
        {
            var tab           = new Tab();
            var majorCategory = CategoryFactory.GetCategory("Project.Major", "专业", "EngageMajor", true);
            var majorTable    = EnumBaseHelper.GetEnumTable("Project.Major");

            if (majorTable.Rows.Count > 0)
            {
                majorCategory.SetDefaultItem(majorTable.Rows[0]["value"].ToString());
            }
            majorCategory.Multi = true;
            tab.Categories.Add(majorCategory);

            var businessTypeCategory = CategoryFactory.GetCategory("Market.BusinessType", "业务类型", "ProjectClass", true);
            var businessTypeTable    = EnumBaseHelper.GetEnumTable("Market.BusinessType");

            if (businessTypeTable.Rows.Count > 0)
            {
                businessTypeCategory.SetDefaultItem(businessTypeTable.Rows[0]["value"].ToString());
            }
            businessTypeCategory.Multi = true;
            tab.Categories.Add(businessTypeCategory);

            tab.IsDisplay = true;
            ViewBag.Tab   = tab;
            var aputitudeTable = EnumBaseHelper.GetEnumTable("HR.UserAptitude");

            ViewBag.ColumnTable = aputitudeTable;
            return(View());
        }
예제 #14
0
        public ActionResult List()
        {
            var tab = new Tab();
            var planStateCategory = CategoryFactory.GetCategory(typeof(PlanReceiptState), "State");

            planStateCategory.SetDefaultItem(PlanReceiptState.UnReceipt.ToString());
            tab.Categories.Add(planStateCategory);

            var yearCategory = CategoryFactory.GetYearCategory("BelongYear", 5, 2);

            yearCategory.SetDefaultItem(DateTime.Now.Year.ToString());
            tab.Categories.Add(yearCategory);

            var quarterCategory = CategoryFactory.GetQuarterCategory("BelongQuarter");

            quarterCategory.SetDefaultItem(((DateTime.Now.Month - 1) / 3 + 1).ToString());
            tab.Categories.Add(quarterCategory);

            var monthCategory = CategoryFactory.GetMonthCategory("BelongMonth");

            tab.Categories.Add(monthCategory);

            tab.IsDisplay          = true;
            ViewBag.Tab            = tab;
            ViewBag.DefaultState   = PlanReceiptState.UnReceipt.ToString();
            ViewBag.DefaultYear    = DateTime.Now.Year.ToString();
            ViewBag.DefaultQuarter = ((DateTime.Now.Month - 1) / 3 + 1).ToString();
            ViewBag.DefaultMonth   = DateTime.Now.Month.ToString();
            return(View());
        }
예제 #15
0
        public ActionResult Report()
        {
            var dateNow = DateTime.Now;

            var tab          = new Tab();
            var yearCategory = CategoryFactory.GetYearCategory("MakeYear", 5, 2, false, "年份");

            yearCategory.SetDefaultItem(dateNow.Year.ToString());
            yearCategory.Multi = false;
            tab.Categories.Add(yearCategory);

            var monthCategory = CategoryFactory.GetMonthCategory("MakeMonth", false, "月份");

            monthCategory.SetDefaultItem(dateNow.Month.ToString());
            monthCategory.Multi = false;
            tab.Categories.Add(monthCategory);

            var deptCategory = CategoryFactory.GetCategory("EPC.FundPlanDept", "部门", "ChargerDept", true);

            deptCategory.Multi = false;
            tab.Categories.Add(deptCategory);

            tab.IsDisplay = true;
            ViewBag.Tab   = tab;

            var planMonths = GetPlanMonths(dateNow);

            ViewBag.planMonths = JsonHelper.ToJson(planMonths);

            return(View());
        }
예제 #16
0
        public void TestParentAddRemoveChildWithError()
        {
            IGroupCategory root  = CategoryFactory.CreateGroup(rootName, null);
            IGroupCategory child = CategoryFactory.CreateGroup(childName, root);

            // Aggiunto figlio nullo
            Assert.ThrowsException <ArgumentNullException>(() => root.AddChild(null));

            // child è figlio di root, e root vuole diventare figlio di child
            Assert.ThrowsException <Exception>(() => child.AddChild(root));

            // padre di me stesso
            Assert.ThrowsException <Exception>(() => root.AddChild(root));

            // padre di me stesso
            Assert.ThrowsException <Exception>(() => root.Parent = root);


            // root-> ( child, child ) !! Errore figlio uguale
            Assert.ThrowsException <Exception> (() => root.AddChild(child));
            Assert.AreEqual(0, child.Children.Length);
            Assert.AreEqual(1, root.Children.Length);
            Assert.AreSame(child, root.Children[0]);
            Assert.AreSame(root, child.Parent);
        }
예제 #17
0
        public ActionResult ProjectCostAnylise()
        {
            //绘制数据过滤标签
            var tab = new Tab();
            //项目费用科目
            var dt = EnumBaseHelper.GetEnumTable(typeof(CBSType));
            var cbsTypeCategory = CategoryFactory.GetCategory(typeof(CBSType), "费用科目", "CBSType", true);

            cbsTypeCategory.SetDefaultItem();
            cbsTypeCategory.Multi = false;
            tab.Categories.Add(cbsTypeCategory);
            //年份
            var yearCategory = CategoryFactory.GetYearCategory("BelongYear");

            yearCategory.SetDefaultItem();
            yearCategory.Multi = false;
            tab.Categories.Add(yearCategory);
            //月份
            var monthCategory = CategoryFactory.GetMonthCategory("BelongMonth");

            yearCategory.SetDefaultItem();
            monthCategory.Multi = false;
            tab.Categories.Add(monthCategory);
            //季度
            var quarterCategory = CategoryFactory.GetQuarterCategory("BelongQuarter");

            yearCategory.SetDefaultItem();
            quarterCategory.Multi = false;
            tab.Categories.Add(quarterCategory);
            tab.IsDisplay = true;
            ViewBag.Tab   = tab;
            return(View());
        }
예제 #18
0
        public void TestContains()
        {
            // root -> ( child -> leaf, newLeaf )
            IGroupCategory root    = CategoryFactory.CreateGroup(rootName, null);
            IGroupCategory child   = CategoryFactory.CreateGroup(childName, root);
            ICategory      leaf    = CategoryFactory.CreateCategory(leafName, child);
            ICategory      newLeaf = CategoryFactory.CreateCategory(newLeafName, root);

            /* Contains by name */
            Assert.IsTrue(root.ContainsChild(newLeaf));
            Assert.IsTrue(root.ContainsChild(childName));
            Assert.IsFalse(root.ContainsChild(leafName));
            Assert.IsTrue(root.ContainsChild(leafName, deep: true));
            Assert.IsTrue(child.ContainsChild(leafName, deep: true));
            Assert.IsTrue(child.ContainsChild(leafName, deep: false));
            Assert.IsFalse(child.ContainsChild(newLeafName, deep: true));
            Assert.IsFalse(child.ContainsChild(newLeafName, deep: false));
            /* Contains by obj */
            Assert.IsTrue(root.ContainsChild(child));
            Assert.IsTrue(root.ContainsChild(newLeaf));
            Assert.IsTrue(root.ContainsChild(leaf, deep: true));
            Assert.IsFalse(root.ContainsChild(leaf));
            Assert.IsTrue(child.ContainsChild(leaf));
            Assert.IsFalse(child.ContainsChild(newLeaf));
            Assert.IsFalse(child.ContainsChild(newLeaf, deep: true));
            Assert.IsFalse(root.ContainsChild(root));
        }
예제 #19
0
        public void GetCategoryTest2()
        {
            var cates = CategoryFactory.GetCategories(ApiMsgHandler, sortBy: "id desc");

            CategoryFactory.GetCategory(ApiMsgHandler, cates.Items.First().Id.Value + 1,
                                        expectedCode: HttpStatusCode.NotFound);
        }
예제 #20
0
        public void TestEqualsCategory()
        {
            string nameEq  = "leaf";
            string nameNeq = "leaf2";

            ICategory c1 = CategoryFactory.CreateCategory(nameEq, null);

            Assert.AreEqual(c1, c1);

            ICategory c2 = CategoryFactory.CreateCategory(nameEq, null);

            Assert.AreEqual(c1, c2);
            Assert.AreEqual(c2, c1);

            ICategory      c3   = CategoryFactory.CreateCategory(nameNeq, null);
            IGroupCategory root = CategoryFactory.CreateRoot("ROOT");
            ICategory      c4   = CategoryFactory.CreateCategory(nameEq, root);

            // Nome diverso
            Assert.AreNotEqual(c1, c3);
            Assert.AreNotEqual(c3, c1);
            // padre diverso
            Assert.AreNotEqual(c1, c4);
            Assert.AreNotEqual(c4, c1);
            Assert.AreNotEqual(c1, root);
            Assert.AreNotEqual(root, c1);
            Assert.AreNotEqual(c3, c4);
        }
예제 #21
0
        public void CreateCategoryTest2()
        {
            if (TestBaseTenant.MasterCatalogs.First().Catalogs.Count < 2)
            {
                Assert.Inconclusive("The sites are less than 2");
            }
            var cates       = CategoryFactory.GetCategories(ApiMsgHandler);
            int count_site1 = (int)cates.TotalCount;

            //add a category to another site
            var msgHandler2 = ServiceClientMessageFactory.GetTestClientMessage(TestBaseTenant.Id, TestBaseTenant.MasterCatalogs.First().Id, TestBaseTenant.MasterCatalogs.First().Catalogs.Last().Id);

            cates = CategoryFactory.GetCategories(msgHandler2);
            int count_site2 = (int)cates.TotalCount;
            var cate        = CategoryFactory.AddCategory(msgHandler2, Generator.GenerateCategory(Generator.RandomString(5,
                                                                                                                         Generator
                                                                                                                         .RandomCharacterGroup
                                                                                                                         .AlphaOnly)));

            cateIds2.Add(cate.Id.Value);
            // verify the group category added to
            cates = CategoryFactory.GetCategories(msgHandler2);
            Assert.AreEqual(1 + count_site2, cates.TotalCount);

            // verify category total count for the not
            cates = CategoryFactory.GetCategories(ApiMsgHandler);
            Assert.AreEqual(count_site1, cates.TotalCount);
        }
예제 #22
0
        public ActionResult ProjectAnalysisList()
        {
            var tab = new Tab();
            //var levelCategory = CategoryFactory.GetCategory("Market.CustomerLevel", "项目等级", "CustomerLevel");
            //levelCategory.SetDefaultItem();
            //tab.Categories.Add(levelCategory);

            //业务类型
            var category = CategoryFactory.GetCategory("Market.BusinessType", "业务类型", "ProjectClass");

            category.SetDefaultItem();
            tab.Categories.Add(category);
            //主责部门
            category = CategoryFactory.GetCategory("Market.ManDept", "主责部门", "ChargerDept");
            category.SetDefaultItem();
            tab.Categories.Add(category);
            //设计阶段
            category = CategoryFactory.GetCategory("Project.Phase", "设计阶段", "Phase");
            category.SetDefaultItem();
            tab.Categories.Add(category);

            tab.IsDisplay = true;
            ViewBag.Tab   = tab;
            return(View());
        }
예제 #23
0
        public void DeleteCategoryTest1()
        {
            //cascadeDelete = null
            var cateObj = Generator.GenerateCategory(Generator.RandomString(5,
                                                                            Generator.RandomCharacterGroup.AlphaOnly));
            var cate4 = CategoryFactory.AddCategory(ApiMsgHandler, cateObj);

            CategoryFactory.DeleteCategoryById(ApiMsgHandler, cate4.Id.Value, null, expectedCode: HttpStatusCode.NoContent);
            CategoryFactory.GetCategory(ApiMsgHandler, cate4.Id.Value, expectedCode: HttpStatusCode.NotFound);
            //cascadeDelete = false
            cateObj = Generator.GenerateCategory(Generator.RandomString(5, Generator.RandomCharacterGroup.AlphaOnly));
            var cate1 = CategoryFactory.AddCategory(ApiMsgHandler, cateObj);

            cateIds1.Add(cate1.Id.Value);
            cate4 = CategoryFactory.AddCategory(ApiMsgHandler, Generator.GenerateCategory("cate4"));
            CategoryFactory.DeleteCategoryById(ApiMsgHandler, cate4.Id.Value, false, expectedCode: HttpStatusCode.NoContent);
            CategoryFactory.GetCategory(ApiMsgHandler, cate4.Id.Value, expectedCode: HttpStatusCode.NotFound);
            var result = CategoryFactory.GetCategory(ApiMsgHandler, cate1.Id.Value);

            //cascadeDelete = true
            cateObj = Generator.GenerateCategory(Generator.RandomString(5, Generator.RandomCharacterGroup.AlphaOnly));
            var cate2 = CategoryFactory.AddCategory(ApiMsgHandler, cateObj);

            cateIds1.Add(cate2.Id.Value);
            cate4 = CategoryFactory.AddCategory(ApiMsgHandler, Generator.GenerateCategory("cate4"));
            CategoryFactory.DeleteCategoryById(ApiMsgHandler, cate4.Id.Value, true, expectedCode: HttpStatusCode.NoContent);
            CategoryFactory.GetCategory(ApiMsgHandler, cate4.Id.Value, expectedCode: HttpStatusCode.NotFound);
            result = CategoryFactory.GetCategory(ApiMsgHandler, cate2.Id.Value);
        }
        public ActionResult List()
        {
            var engineeringInfo = this.GetEntityByID <S_I_Engineering>(Request["EngineeringInfoID"]);

            if (engineeringInfo == null)
            {
                throw new Formula.Exceptions.BusinessValidationException("工程信息不存在!");
            }

            var sql          = string.Format(@"select Top 1  ID,Name,SerialNumber,PartyA,PartyAName from S_M_ContractInfo where ProjectInfo='{0}' and ContractState='Sign' ", engineeringInfo.ID);
            var contractInfo = EPCSQLDB.ExecuteDataTable(sql);

            ViewBag.ContractInfo = JsonHelper.ToJson(contractInfo);

            var tab          = new Tab();
            var yearCategory = CategoryFactory.GetYearCategory("BelongYear", 5, 2, false, "年份");

            yearCategory.SetDefaultItem(DateTime.Now.Year.ToString());
            yearCategory.Multi = false;
            tab.Categories.Add(yearCategory);

            var monthCategory = CategoryFactory.GetMonthCategory("BelongMonth", false, "月份");

            monthCategory.SetDefaultItem(DateTime.Now.Month.ToString());
            monthCategory.Multi = false;
            tab.Categories.Add(monthCategory);
            tab.IsDisplay = true;
            ViewBag.Tab   = tab;

            return(View());
        }
예제 #25
0
        public ActionResult ProjectHourRpt()
        {
            var items = EnumBaseHelper.GetEnumDef("System.WorkHourType").EnumItem.ToList();

            ViewBag.WorkHourTypeInfo = items;

            var tab           = new Tab();
            var stateCategory = CategoryFactory.GetCategory(typeof(ProjectCommoneState), "State");

            stateCategory.SetDefaultItem();
            stateCategory.Multi = false;
            tab.Categories.Add(stateCategory);

            var deptCategory = CategoryFactory.GetCategory("System.ManDept", "负责部门", "ChargeDeptID");

            deptCategory.SetDefaultItem();
            deptCategory.Multi = false;
            tab.Categories.Add(deptCategory);

            var workHourCategory = CategoryFactory.GetCategory("System.DateFilder", "工时日期", "WorkHourDate");

            workHourCategory.SetDefaultItem();
            workHourCategory.Multi = false;
            tab.Categories.Add(workHourCategory);

            tab.IsDisplay = true;
            ViewBag.Tab   = tab;

            return(View());
        }
예제 #26
0
        public SyncroBasePresta()
            : base()
        {
            var logondata = LoginData();

            _url    = logondata.WebServiceUrl;
            _url   += "api/";
            _autKey = logondata.AuthKey;
            var config = ConfigurationManager.OpenExeConfiguration(
                Assembly.GetExecutingAssembly().Location);

            CheckModeDebug(config);
            if (config.AppSettings.Settings["Test"].Value == "1")
            {
                _url    = config.AppSettings.Settings["UrlPrestaShop"].Value;
                _autKey = config.AppSettings.Settings["AutKey"].Value;

                //StrumentiMusicali.Core.Manager.ManagerLog.Logger.Info("TEST _url ");
                //StrumentiMusicali.Core.Manager.ManagerLog.Logger.Info(_url);
            }

            _imageFactory          = new ImageFactory(_url, _autKey, "");
            _StockAvailableFactory = new StockAvailableFactory(_url, _autKey, "");
            _productFactory        = new ProductFactory(_url, _autKey, "");
            _categoriesFact        = new CategoryFactory(_url, _autKey, "");
            _taxRuleGroupFact      = new TaxRuleGroupFactory(_url, _autKey, "");
        }
예제 #27
0
        public override ActionResult List()
        {
            var tab = new Tab();
            var invoiceTypeCategory = CategoryFactory.GetCategory(typeof(InvoiceType), "InvoiceType");

            invoiceTypeCategory.SetDefaultItem("All");
            tab.Categories.Add(invoiceTypeCategory);

            var stateCategory = CategoryFactory.GetCategory(typeof(InvoiceState), "State");

            stateCategory.Multi = false;
            stateCategory.SetDefaultItem(InvoiceState.Normal.ToString());
            tab.Categories.Add(stateCategory);

            var yearCategory = CategoryFactory.GetYearCategory("BelongYear");

            yearCategory.SetDefaultItem(DateTime.Now.Year.ToString());
            tab.Categories.Add(yearCategory);

            var receiptStateCategory = CategoryFactory.GetCategory(typeof(InvoiceReceiptState), "ReceiptState");

            receiptStateCategory.SetDefaultItem("All");
            tab.Categories.Add(receiptStateCategory);

            tab.IsDisplay = true;
            ViewBag.Tab   = tab;
            return(View());
        }
예제 #28
0
        public void Run()
        {
            var categoryFactory   = new CategoryFactory();
            var categoryUtilities = categoryFactory.GetCategory(1);
            var categoryMobile    = categoryFactory.GetCategory(2);
            var serviceList       = new List <Service>
            {
                new Service()
                {
                    ServiceName = "Azerishiq",
                    Category    = categoryUtilities
                },
                new Service()
                {
                    ServiceName = "Bakcel",
                    Category    = categoryMobile
                },
                new Service()
                {
                    ServiceName = "Azercel",
                    Category    = categoryMobile
                }
            };

            foreach (var service in serviceList)
            {
                service.PromptInfo();
            }
        }
예제 #29
0
        public ActionResult IndicatorCompanyMonth()
        {
            var tab          = new Tab();
            var yearCategory = CategoryFactory.GetYearCategory("BelongYear", 5, 2, false, "年度");

            yearCategory.SetDefaultItem(DateTime.Now.Year.ToString());
            yearCategory.Multi = false;
            tab.Categories.Add(yearCategory);
            tab.IsDisplay = true;
            ViewBag.Tab   = tab;

            var fo   = FormulaHelper.CreateFO <IndicatorFO>();
            var list = fo.GetIndicatorDefine(IndicatorOrgType.Company);

            ViewBag.IndicatorDefines = list;

            var category = fo.GetIndicatorCategory(IndicatorOrgType.Company);

            ViewBag.Categories = category;
            var writeFiels = string.Empty;

            foreach (var item in list)
            {
                writeFiels += item.IndicatorCode + ",";
            }
            ViewBag.WriteFields = writeFiels.TrimEnd(',');
            return(View());
        }
예제 #30
0
        private IEnumerable <Category> GetCats()
        {
            List <Category> categories = new List <Category>();
            //var deptCategory = CategoryFactory.GetCategory("Market.ManDept", "责任部门", "ChargerDept");
            //deptCategory.SetDefaultItem();
            //deptCategory.Multi = false;
            //tab.Categories.Add(deptCategory);

            string pId1          = FormulaHelper.CreateGuid();
            var    phaseCategory = CategoryFactory.GetCategory("Base.ProjectModeType", "承包方式", "ContractMode");

            phaseCategory.SetDefaultItem();
            phaseCategory.Multi = false;

            string pId2 = FormulaHelper.CreateGuid();
            var    projectClassCategory = CategoryFactory.GetCategory("Base.ProjectClass", "项目类型", "ProjectClass");

            projectClassCategory.SetDefaultItem();
            projectClassCategory.Multi = false;

            string pId3          = FormulaHelper.CreateGuid();
            var    stateCategory = CategoryFactory.GetCategory(typeof(ProjectState), "项目状态", "State");

            stateCategory.SetDefaultItem();
            stateCategory.Multi = false;

            categories.Add(phaseCategory);
            categories.Add(projectClassCategory);
            categories.Add(stateCategory);

            return(categories);
        }