Exemple #1
0
        private void addButton_Click(object sender, EventArgs e)
        {
            var tmp = _regionTreeControl.SelectItem;

            if (tmp == null || _regionList.Count(p => p.nodeNo == tmp.nodeNo) != 0)
            {
                return;
            }
            _regionList.Add(tmp);
        }
Exemple #2
0
 private RegionList GetRegions(Boolean refresh)
 {
     if (_regions.IsNull() || refresh)
     {
         _regions = new RegionList();
         _regions.Add(RegionTest.GetOneRegion(GetUserContext()));
     }
     return(_regions);
 }
        /// <summary>
        /// Get regions from list of WebRegions.
        /// </summary>
        /// <param name="userContext">User context.</param>
        /// <param name="webRegions">List of WebRegions.</param>
        /// <returns>RegionList.</returns>
        protected RegionList GetRegions(IUserContext userContext,
                                        List <WebRegion> webRegions)
        {
            RegionList regionList = new RegionList();

            foreach (WebRegion webRegion in webRegions)
            {
                regionList.Add(GetRegion(userContext, webRegion));
            }
            return(regionList);
        }
Exemple #4
0
        public void AddRegionEventCall(object sender)
        {
            RegionEventArgs eventArgs = new RegionEventArgs()
            {
                Region = new Region(Side, Region, Group, Root, End, ComObject, ComRegion, ComWeight)
            };

            AddRegionEventHandler?.Invoke(this, eventArgs);

            if (eventArgs.Success == true)
            {
                RegionList.Add(eventArgs.Region);
                Root = "";
                End  = "";
            }
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            decimal num;
            decimal num2;

            if (ValidateValues(out num, out num2))
            {
                Region region2 = new Region();
                region2.RegionsId      = txtRegion_Id.Text;
                region2.Regions        = txtRegion.Value;
                region2.RegionPrice    = num;
                region2.RegionAddPrice = num2;
                Region item = region2;
                RegionList.Add(item);
                BindRegion();
                txtRegion_Id.Text      = string.Empty;
                txtRegion.Value        = string.Empty;
                txtRegionPrice.Text    = "0";
                txtAddRegionPrice.Text = "0";
            }
        }
Exemple #6
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            decimal regionPrice = 0m;

            decimal addRegionPrice = 0m;

            if (ValidateValues(out regionPrice, out addRegionPrice))
            {
                Region item = new Region();
                item.RegionsId      = txtRegion_Id.Text;
                item.Regions        = txtRegion.Value;
                item.RegionPrice    = regionPrice;
                item.RegionAddPrice = addRegionPrice;
                RegionList.Add(item);
                BindRegion();
                txtRegion_Id.Text      = string.Empty;
                txtRegion.Value        = string.Empty;
                txtRegionPrice.Text    = "0";
                txtAddRegionPrice.Text = "0";
            }
        }
Exemple #7
0
        public void MirrorFilteredRegionCall(object sender)
        {
            List <Region> NewRegionList = new List <Region>();

            foreach (Region region in RegionListViewSource.View)
            {
                if (region.Side.Contains(MirrorReplaceText) || region.Side.Contains(MirrorReplaceWithText))
                {
                    MirrorRegionEventArgs eventArgs = new MirrorRegionEventArgs();
                    if (region.Side.Contains(MirrorReplaceText))
                    {
                        eventArgs.Region           = region;
                        eventArgs.Replace          = MirrorReplaceText;
                        eventArgs.ReplaceWith      = MirrorReplaceWithText;
                        eventArgs.JointReplace     = JointReplaceText;
                        eventArgs.JointReplaceWith = JointReplaceWithText;
                    }
                    else
                    {
                        eventArgs.Region           = region;
                        eventArgs.Replace          = MirrorReplaceWithText;
                        eventArgs.ReplaceWith      = MirrorReplaceText;
                        eventArgs.JointReplace     = JointReplaceWithText;
                        eventArgs.JointReplaceWith = JointReplaceText;
                    }

                    MirrorFilteredRegionsHandler?.Invoke(this, eventArgs);

                    if (eventArgs.NewRegion != null)
                    {
                        NewRegionList.Add(eventArgs.NewRegion);
                    }
                }
            }

            foreach (Region newRegion in NewRegionList)
            {
                RegionList.Add(newRegion);
            }
        }
 private void BindControl(ShippingModeInfo modeItem)
 {
     txtModeName.Text  = Globals.HtmlDecode(modeItem.Name);
     txtWeight.Text    = modeItem.Weight.ToString();
     txtAddWeight.Text = modeItem.AddWeight.ToString();
     if (modeItem.AddPrice.HasValue)
     {
         txtAddPrice.Text = modeItem.AddPrice.Value.ToString("F2");
     }
     txtPrice.Text = modeItem.Price.ToString("F2");
     RegionList.Clear();
     if ((modeItem.ModeGroup != null) && (modeItem.ModeGroup.Count > 0))
     {
         foreach (ShippingModeGroupInfo info in modeItem.ModeGroup)
         {
             Region region2 = new Region();
             region2.RegionPrice    = decimal.Parse(info.Price.ToString("F2"));
             region2.RegionAddPrice = decimal.Parse(info.AddPrice.ToString("F2"));
             Region        item     = region2;
             StringBuilder builder  = new StringBuilder();
             StringBuilder builder2 = new StringBuilder();
             foreach (ShippingRegionInfo info2 in info.ModeRegions)
             {
                 builder.Append(info2.RegionId + ",");
                 builder2.Append(RegionHelper.GetFullRegion(info2.RegionId, ",") + ",");
             }
             if (!string.IsNullOrEmpty(builder.ToString()))
             {
                 item.RegionsId = builder.ToString().Substring(0, builder.ToString().Length - 1);
             }
             if (!string.IsNullOrEmpty(builder2.ToString()))
             {
                 item.Regions = builder2.ToString().Substring(0, builder2.ToString().Length - 1);
             }
             RegionList.Add(item);
         }
     }
 }
Exemple #9
0
        public SimpleExaminationViewModel(BaseScene scene, String json) : base(scene, json)
        {
            CanAnalysis = true;
            init();
            JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
            var response = javaScriptSerializer.Deserialize <SimpleExaminationScene>(json);

            examination = response.Convert();
            if (examination.ExaminationQuestions != null)
            {
                foreach (var v in examination.ExaminationQuestions)
                {
                    QuestionVM vm = new QuestionVM();
                    vm.Set(v);
                    QuestionList.Add(vm);
                    TotalScore += v.Score;
                }
            }
            if (examination.Voters != null)
            {
                foreach (var v in examination.Voters)
                {
                    StudentVM studentNM = new StudentVM();
                    studentNM.Set(v);
                    StudentList.Add(studentNM);
                }
            }
            if (response.RegionScenes != null)
            {
                RegionList.Clear();
                foreach (var v in response.RegionScenes)
                {
                    RegionList.Add(v.convert());
                }
            }
        }
Exemple #10
0
 public void AddRegion(string side, string name, string group, string root, string end, string comObject, string comRegion, float comWeight)
 {
     RegionList.Add(new Region(side, name, group, root, end, comObject, comRegion, comWeight));
 }