Пример #1
0
        private ProductManagerGroupInfo CovertVMtoEntity(PMGroupVM data)
        {
            ProductManagerGroupInfo msg = new ProductManagerGroupInfo();

            msg.SysNo       = data.SysNo;
            msg.PMGroupName = new LanguageContent(data.PMGroupName);
            msg.UserInfo    = new UserInfo()
            {
                SysNo = Convert.ToInt32(data.PMUserSysNo)
            };
            msg.ProductManagerInfoList = data.PMList;
            msg.Status = data.Status == "有效" ? PMGroupStatus.Active : PMGroupStatus.DeActive;

            return(msg);
        }
Пример #2
0
        public override void OnPageLoad(object sender, EventArgs e)
        {
            base.OnPageLoad(sender, e);

            facade = new PMGroupFacade(this);

            pmGroupSysNo = this.Request.Param;

            if (!string.IsNullOrEmpty(pmGroupSysNo))
            {
                facade.GetPMGroupBySysNo(int.Parse(pmGroupSysNo), (obj, args) =>
                {
                    PMGroupVM vm = new PMGroupVM();

                    vm.PMGroupName             = args.Result.PMGroupName.Content;
                    vm.PMUserSysNo             = args.Result.UserInfo.SysNo.Value.ToString();
                    vm.Status                  = Convert.ToInt32(args.Result.Status).ToString();
                    this.DataContext           = vm;
                    checkBoxListPM.ItemsSource = args.Result.ProductManagerInfoList;
                    if (args.Result.Status == PMGroupStatus.Active)
                    {
                        cmbPMGroupStatus.SelectedIndex = 0;
                    }
                    else
                    {
                        cmbPMGroupStatus.SelectedIndex = 1;
                    }
                    txtPMGroupName.IsReadOnly = true;
                });
            }
            else
            {
                //查询PM列表
                facade.GetPMListByPMGroupSysNo(-1, (obj, args) =>
                {
                    this.DataContext           = new PMGroupVM();
                    checkBoxListPM.ItemsSource = args.Result;
                });
            }
        }
Пример #3
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (!ValidationManager.Validate(this))
            {
                return;
            }
            PMGroupVM vm = this.DataContext as PMGroupVM;

            vm.SysNo = Convert.ToInt32(pmGroupSysNo);

            //获取选中的项目
            IEnumerable <ProductManagerInfo> list = (IEnumerable <ProductManagerInfo>)checkBoxListPM.ItemsSource;

            vm.PMList = list.Where(p => p.IsExistGroup == 1).ToList();

            if (vm.SysNo > 0)
            {
                facade.UpdatePMGroup(vm, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    Window.Alert(ResPMGroupMaintain.Info_SaveSuccessfully);
                });
            }
            else
            {
                facade.CreatePMGroup(vm, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    Window.Alert(ResPMGroupMaintain.Info_SaveSuccessfully);
                });
            }
        }
Пример #4
0
        /// <summary>
        /// 修改PM组信息
        /// </summary>
        /// <param name="data"></param>
        /// <param name="callback"></param>
        public void UpdatePMGroup(PMGroupVM data, EventHandler <RestClientEventArgs <ProductManagerGroupInfo> > callback)
        {
            string relativeUrl = "/IMService/ProductManagerGroup/UpdateProductManagerGroupInfo";

            restClient.Update <ProductManagerGroupInfo>(relativeUrl, CovertVMtoEntity(data), callback);
        }