示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //LanguageCode     Enum.TryParse<LanguageCode>("zh-cn");

            string _modelid    = "8DCEE4B7-FBDE-4C5D-9752-ED2F2FBD00BF";// "ADAM-4520";
            string _categoryid = "Data_Acquisition_Modules";

            //Model _model = ModelBusinessLogic.GetCompleteModelByModelID(_modelid);
            Model _model = ModelBusinessLogic.GetModelByCategory_ModelID(_categoryid, _modelid);

            List <Category> _ParentCategory = _model.Parent_Category;
            StringBuilder   sb = new StringBuilder();

            foreach (Category _category in _ParentCategory)
            {
                Category _ca = _category;

                for (int i = 1; i < 7; i++)
                {
                    sb.Insert(0, _ca.Display_Name);
                    if (_ca.Parent_Category != null)
                    {
                        sb.Insert(0, " > ");
                        _ca = _ca.Parent_Category;
                    }
                    else
                    {
                        break;
                    }
                }
                sb.Insert(0, "<br />");
            }
            this.CategoryPath.Text = sb.ToString();

            this.ModelName.Text         = _model.Model_Name;
            this.ModelDescription.Text  = _model.Description;
            this.ModelIntroduction.Text = _model.Introduction;

            //PartBusinessLogic.GetModel(part1.PartNumber);

            //將此料號所屬的model主檔顯示在GridView
            //GridView2.DataSource = _models;
            //GridView2.DataBind();



            //示範將第一個model下的預設features取出並顯示在GridView
            //Model _model = _models[0];
            List <Feature> _defaultFeature = _model.Features;

            GridView3.DataSource = _defaultFeature;
            GridView3.DataBind();

            //示範將第一個model下的簡體中文版本features取出並顯示在GridView
            List <Feature> Simplified = _model.GetFeaturesByLanguage(LanguageCode.zh_cn);

            GVFeature.DataSource = Simplified;
            GVFeature.DataBind();

            //示範將第一個model下的主圖,大圖與小圖取出並顯示在GridView
            List <Literature> _mainpic  = _model.GetMainPictures();
            List <Literature> _bigpic   = _model.GetBigPictures();
            List <Literature> _smallpic = _model.GetSmallPictures();


            GVMainPIC.DataSource = _mainpic;
            GVMainPIC.DataBind();

            GVBigPIC.DataSource = _bigpic;
            GVBigPIC.DataBind();

            GVSmallPIC.DataSource = _smallpic;
            GVSmallPIC.DataBind();

            GVSpec.DataSource = _model.ModelSpecs;
            GVSpec.DataBind();

            GVParts.DataSource = _model.Parts;
            GVParts.DataBind();

            if (_model.Parts.Count > 0)
            {
                GVFistPartSpec.DataSource = _model.Parts[0].PartSpecs;
                GVFistPartSpec.DataBind();
            }
            //this.SAPDescription.Text = part1.SAPDescription;
            //this.PISDescription.Text = part1.PISDescription;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string _partno = "";

            //_partno = "ADAM-4520I-AE";
            //_partno = "ADAM-5510KW-A1E";
            _partno = "AIMB-762G2-00A1E";

            //透過Business Layer來取得Part物件,並且包含了Part在PIS中所對應的Model
            //而Model的相關資訊(Description, Features, Images, Specs)一開始不會載入,在調用該屬性時再動態載入
            Part part1 = PartBusinessLogic.GetPartWithBasicModelInformation(_partno);

            //透過Business Layer來取得Part物件,
            //並且包含了Part在PIS中所對應的Model與Model完整的資訊,例如:Description, Features, Images, Specs
            //Part part1 = PartBusinessLogic.GetPartWithCompleteModelInformation(_partno);

            //調用Part的規格
            GVSpec.DataSource = part1.PartSpecs;
            GVSpec.DataBind();

            //調用Part在SAP中所維護的描述
            this.SAPDescription.Text = part1.SAPDescription;
            //調用Part在PIS中所維護的描述,空白表示沒有被維護,請取用part1.SAPDescription
            this.PISDescription.Text = part1.PISDescription;

            //從Part中取得此Part所對應的Model實體
            List <Model> _models = part1.Models;

            //將此料號所屬的model主檔顯示在GridView
            GridView2.DataSource = _models;
            GridView2.DataBind();

            //示範將第一個model下的預設features取出並顯示在GridView
            Model          _model          = _models[0];
            List <Feature> _defaultFeature = _model.Features;

            GridView3.DataSource = _defaultFeature;
            GridView3.DataBind();

            //語系代碼轉換方式
            Advantech.Myadvantech.DataAccess.LanguageCode _lang_zh_cn = LanguageCode.en_us;
            Enum.TryParse <LanguageCode>("zh_cn", true, out _lang_zh_cn);

            //示範將第一個model下的簡體中文版本features取出並顯示在GridView
            List <Feature> Simplified = _model.GetFeaturesByLanguage(_lang_zh_cn);

            GVFeature.DataSource = Simplified;
            GVFeature.DataBind();

            //調用第一個model下的主圖顯示在GridView
            List <Literature> _mainpic = _model.GetMainPictures();

            GVMainPIC.DataSource = _mainpic;
            GVMainPIC.DataBind();

            //調用第一個model下的大圖顯示在GridView
            List <Literature> _bigpic = _model.GetBigPictures();

            GVBigPIC.DataSource = _bigpic;
            GVBigPIC.DataBind();

            //調用第一個model下的小圖取出並顯示在GridView
            List <Literature> _smallpic = _model.GetSmallPictures();

            GVSmallPIC.DataSource = _smallpic;
            GVSmallPIC.DataBind();
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //多个Part的调用方法
            List <Part> parts = new List <Part>();

            Part part = new Part();

            //part.SoldToErpID = "EFESAI04";
            part.OrgID      = "EU10";
            part.PartNumber = "PCI-1220U-AE";
            //part.PlantID = "EUH1";
            //part.Currency = "EUR";
            parts.Add(part);

            Part part2 = new Part();

            // part2.Insert();
            //part2.SoldToErpID = "EFESAI04";
            part2.OrgID      = "EU10";
            part2.PartNumber = "ADAM-4502-AE";
            part2.PlantID    = "EUH1";
            part2.Currency   = "EUR";
            parts.Add(part2);
            Part part3 = new Part();

            //part3.SoldToErpID = "EFESAI04";
            part3.OrgID      = "EU10";
            part3.PartNumber = "IPC-100-60SE";
            part3.PlantID    = "EUH1";
            // part3.ListPrice
            part3.Currency = "EUR";
            parts.Add(part3);
            string errorMsg = "";

            PartBusinessLogic.GetPrice(parts, ref errorMsg);
            GridView1.DataSource = parts;
            GridView1.DataBind();
            //单一Part的调用方法
            Part part1 = new Part("ADAM-4520-EE");

            //part1.SoldToErpID = "ESTORE";
            part1.OrgID = "CN01";
            //part1.PartNo = "1654002538";
            part1.PlantID = "CNH1";
            //part1.Currency = "EUR";
            PartBusinessLogic.GetPrice(part1, ref errorMsg);
            List <Part> parts1 = new List <Part>();

            parts1.Add(part1);
            DetailsView1.DataSource = parts1;
            DetailsView1.DataBind();

            GridView2.DataSource = part1.Models;
            GridView2.DataBind();

            //part1.g



            Model          _model          = new Model(part1.Models[0].Model_Name);
            List <Feature> _defaultFeature = _model.Features;

            GridView3.DataSource = _defaultFeature;
            GridView3.DataBind();


            List <Feature> aaa = _model.GetFeaturesByLanguage(LanguageCode.zh_cn);

            GVFeature.DataSource = aaa;
            GVFeature.DataBind();


            List <Literature> _mainpic  = _model.GetMainPictures();
            List <Literature> _bigpic   = _model.GetBigPictures();
            List <Literature> _smallpic = _model.GetSmallPictures();


            GVMainPIC.DataSource = _mainpic;
            GVMainPIC.DataBind();

            GVBigPIC.DataSource = _bigpic;
            GVBigPIC.DataBind();

            GVSmallPIC.DataSource = _smallpic;
            GVSmallPIC.DataBind();
        }