Beispiel #1
0
        /// <summary>
        /// 设置行可用性
        /// </summary>
        /// <param name="view"></param>
        /// <param name="entityKey"></param>
        /// <param name="row"></param>
        /// <param name="bEnabled"></param>
        /// <param name="exceptFieldkeys"></param>
        public static void SetEntityRowEnabled(this IDynamicFormView view, string entityKey, int row, bool bEnabled, IEnumerable <string> exceptFieldkeys = null)
        {
            Entity        entity = view.BillBusinessInfo.GetEntity(entityKey);
            DynamicObject rowObj = view.Model.GetEntityDataObject(entity, row);

            SetEntityRowEnabled(view, entityKey, rowObj, bEnabled, exceptFieldkeys);
        }
Beispiel #2
0
        /// <summary>
        /// 更新可视元素宽度
        /// </summary>
        /// <param name="formState"></param>
        /// <param name="key"></param>
        /// <param name="width"></param>
        public static void UpdateColumnWidth(this IDynamicFormView view, ControlAppearance gridAp, string colKey, int width)
        {
            IDynamicFormState formState = view.GetService <IDynamicFormState>();

            //SetFieldPropValue(formState, ctlAp.Key, "width", width, -1);
            SetColumnPropValue(formState, gridAp, colKey, "width", width);
        }
        // Methods
        private void AddActivityForm()
        {
            this._ActivityView = base.View.GetView(this._viewPageId);
            if (this._ActivityView != null)
            {
                this._ActivityView.Close();
                base.View.SendDynamicFormAction(this._ActivityView);
            }
            ListShowParameter param = new ListShowParameter
            {
                FormId    = "CRM_ACTIVITY",
                OpenStyle =
                {
                    TagetKey = "FActPanel",
                    ShowType = ShowType.InContainer
                },
                PageId            = this._viewPageId = Guid.NewGuid().ToString(),
                ParentPageId      = base.View.PageId,
                IsShowQuickFilter = false
            };
            string str = "";

            if (base.View.Model.GetPKValue() != null)
            {
                str = base.View.Model.GetPKValue().ToString();
            }
            param.CustomParams.Add("ClueID", str);
            base.View.ShowForm(param);
        }
Beispiel #4
0
        /// <summary>
        /// 设置某个菜单条的可见性
        /// </summary>
        /// <param name="view"></param>
        /// <param name="bVisible">可见性</param>
        /// <param name="barOwnerKey">工具条拥有者标识,单据主工具条不用传值,表格工具条请传表格标识,其它独立工具条请传工具条标识</param>
        public static void SetBarVisible(this IDynamicFormView view, bool bVisible, string barOwnerKey = "")
        {
            if (string.IsNullOrWhiteSpace(barOwnerKey))
            {
                FormAppearance formAppearance = view.LayoutInfo.GetFormAppearance();
                if (((formAppearance.Menu != null) && !string.IsNullOrWhiteSpace(formAppearance.Menu.Id)) && (formAppearance.ShowMenu == 1))
                {
                    foreach (var item in formAppearance.Menu.GetAllBarItems())
                    {
                        view.SetBarItemVisible(item.Key, bVisible, barOwnerKey);
                    }
                }
            }
            else
            {
                EntryEntityAppearance appearance3 = view.LayoutInfo.GetEntryEntityAppearance(barOwnerKey);
                if ((appearance3 != null) && (appearance3.Menu != null))
                {
                    foreach (var item in appearance3.Menu.GetAllBarItems())
                    {
                        view.SetBarItemVisible(item.Key, bVisible, barOwnerKey);
                    }
                }

                ToolBarCtrlAppearance appearance4 = view.LayoutInfo.GetToolbarCtrlAppearances().FirstOrDefault(o => o.Key == barOwnerKey);
                if ((appearance4 != null) && (appearance4.Menu != null))
                {
                    foreach (var item in appearance4.Menu.GetAllBarItems())
                    {
                        view.SetBarItemVisible(item.Key, bVisible, barOwnerKey);
                    }
                }
            }
        }
Beispiel #5
0
 public static void BuildCurrency(Context ctx, IDynamicFormView view, string controlName, bool isContianBWB = true)
 {
     if (!string.IsNullOrWhiteSpace(controlName) && (view != null))
     {
         DynamicObjectCollection objects = BMCommonServiceHelper.QueryData(ctx, "BD_Currency", "FCurrencyId,FName", "FDocumentStatus='C' and FForbidStatus='A'");
         if ((objects != null) && (objects.Count > 0))
         {
             List <EnumItem> items = new List <EnumItem>();
             List <string>   list2 = new List <string>();
             foreach (DynamicObject obj2 in objects)
             {
                 items.Add(CreateEnumItem(view, obj2["FCurrencyId"], (obj2["FName"] == null) ? "" : obj2["FName"].ToString()));
                 list2.Add(obj2["FCurrencyId"].ToString());
             }
             if (isContianBWB)
             {
                 items.Add(CreateEnumItem(view, 0, GetCurrencyName(ctx, 0L)));
             }
             object obj3 = view.Model.GetValue(controlName);
             if ((obj3 != null) && list2.Contains(obj3.ToString()))
             {
                 obj3 = view.Model.GetValue(controlName);
             }
             else
             {
                 obj3 = objects[0]["FCurrencyId"];
             }
             view.GetControl <ComboFieldEditor>(controlName).SetComboItems(items);
             view.Model.SetValue(controlName, obj3);
         }
     }
 }
Beispiel #6
0
 /// <summary>
 /// 开启一个表单交互
 /// </summary>
 /// <param name="srcFormView"></param>
 /// <param name="dstFormView"></param>
 /// <returns></returns>
 public static void BeginFormInteract(this IDynamicFormView srcFormView, IDynamicFormView dstFormView)
 {
     dctFormInteractFlags.AddOrUpdate(string.Format("{0}_{1}", srcFormView.PageId, dstFormView.PageId), "", (key, value) =>
     {
         throw new KDBusinessException("JN-BOS-000004", string.Format("源表单{0}与目标表单{1}正在数据交换,请稍候操作!", srcFormView.PageId, dstFormView.PageId));
     });
 }
Beispiel #7
0
        /// <summary>
        /// 结束表单交互
        /// </summary>
        /// <param name="srcFormView"></param>
        /// <param name="dstFormView"></param>
        public static void EndFormInteract(this IDynamicFormView srcFormView, IDynamicFormView dstFormView)
        {
            string key   = string.Format("{0}_{1}", srcFormView.PageId, dstFormView.PageId);
            string value = null;

            dctFormInteractFlags.TryRemove(key, out value);
        }
Beispiel #8
0
        /// <summary>
        /// 设置某个实体整体可用性
        /// </summary>
        /// <param name="view"></param>
        /// <param name="entityKey"></param>
        /// <param name="bEnabled"></param>
        public static void SetEntityEnabled(this IDynamicFormView view, string entityKey, bool bEnabled)
        {
            EntityAppearance entityAp = view.LayoutInfo.GetEntityAppearance(entityKey);

            if (entityAp == null)
            {
                return;
            }
            foreach (var ap in entityAp.Layoutinfo.Controls)
            {
                view.StyleManager.SetEnabled(ap, null, bEnabled);
            }
        }
 public static void CheckDefaultScheme(IDynamicFormView view, IDynamicFormModel model, ButtonClickEventArgs e, string curFilterSchemeId, string defaultSchemeId)
 {
     if (curFilterSchemeId == defaultSchemeId)
     {
         bool flag = false;
         if (model.GetValue("FChkScheme") != null)
         {
             flag = Convert.ToBoolean(model.GetValue("FChkScheme"));
         }
         if (flag)
         {
             view.ShowMessage(ResManager.LoadKDString("默认方案不能勾选“下次以此方案自动进入”,请去掉此选择再进行操作!", "003192000011320", SubSystemType.FIN, new object[0]), MessageBoxType.Notice);
             e.Cancel = true;
         }
     }
 }
Beispiel #10
0
 public static T GetValue <T>(IDynamicFormView view, string fieldName, T defaultValue = null)
 {
     try
     {
         object obj2 = view.Model.GetValue(fieldName);
         if ((obj2 != null) && !string.IsNullOrWhiteSpace(obj2.ToString()))
         {
             return((T)Convert.ChangeType(obj2, typeof(T)));
         }
         return(defaultValue);
     }
     catch
     {
         return(defaultValue);
     }
 }
Beispiel #11
0
        public void BindDataToView(Context ctx, IDynamicFormView formView, string sql, string entryName)
        {
            DynamicObjectCollection coll = GetObjects(ctx, sql);
            int i = 0;

            if (!string.IsNullOrWhiteSpace(entryName))
            {
                formView.Model.DeleteEntryData(entryName);

                if (coll != null && coll.Count > 0)
                {
                    foreach (var item in coll)
                    {
                        if (item != null)
                        {
                            formView.Model.InsertEntryRow(entryName, i);

                            formView.Model.SetValue("F_HS_ListID", SQLUtils.GetFieldValue(item, "F_HS_ListID"), i);
                            formView.Model.SetValue("F_HS_BrandName", SQLUtils.GetFieldValue(item, "F_HS_BrandName"), i);
                            formView.Model.SetValue("F_HS_MaterialId", SQLUtils.GetFieldValue(item, "F_HS_MaterialId"), i);
                            formView.Model.SetValue("F_HS_MaterialName", SQLUtils.GetFieldValue(item, "F_HS_MaterialName"), i);
                            formView.Model.SetValue("F_HS_Specification", SQLUtils.GetFieldValue(item, "F_HS_Specification"), i);
                            formView.Model.SetValue("F_HS_SalUnit", SQLUtils.GetFieldValue(item, "F_HS_SalUnit"), i);
                            formView.Model.SetValue("F_HS_OrderQty", SQLUtils.GetFieldValue(item, "F_HS_OrderQty"), i);
                            formView.Model.SetValue("F_HS_OrderAmount", SQLUtils.GetFieldValue(item, "F_HS_OrderAmount"), i);
                            formView.Model.SetValue("F_HS_StockQty", SQLUtils.GetFieldValue(item, "F_HS_StockQty"), i);
                            formView.Model.SetValue("F_HS_StockAmount", SQLUtils.GetFieldValue(item, "F_HS_StockAmount"), i);
                            formView.Model.SetValue("F_HS_FirstInStockDate", SQLUtils.GetFieldValue(item, "F_HS_FirstInStockDate"), i);
                            formView.Model.SetValue("F_HS_SKUGroupCode", SQLUtils.GetFieldValue(item, "F_HS_SKUGroupCode"), i);

                            i++;
                        }
                    }

                    formView.UpdateView(entryName);
                }
                else
                {
                    this.View.ShowErrMessage("", "没有需要查询的数据", MessageBoxType.Error);
                }
            }
        }
Beispiel #12
0
 /// <summary>
 /// 把当前表单的事件通知给另一个表单
 /// </summary>
 /// <param name="srcFormView"></param>
 /// <param name="dstFormView"></param>
 /// <param name="eventName"></param>
 /// <param name="eventData"></param>
 public static void SendFormInteractEvent(this IDynamicFormView srcFormView, IDynamicFormView dstFormView, string eventName, object eventData = null, bool bForceNoUpdateView = false)
 {
     if (dstFormView != null)
     {
         string eventDataJson = string.Empty;
         if (eventData != null)
         {
             try
             {
                 if ((eventData is string) || (eventData is ValueType))
                 {
                     eventDataJson = eventData.ToString();
                 }
                 else
                 {
                     eventDataJson = KDObjectConverter.SerializeObject(eventData);
                 }
             }
             catch
             {
                 //无法序列化时,则使用父级Session传递参数对象
                 eventDataJson = string.Format("{0}_{1}", srcFormView.PageId, eventName);
                 dstFormView.Session[eventDataJson] = eventData;
             }
         }
         try
         {
             (dstFormView as IDynamicFormViewService).CustomEvents(srcFormView.BusinessInfo.GetForm().Id, eventName, eventDataJson);
         }
         catch (KDBusinessException ex)
         {
             dstFormView.ShowMessage(ex.ToString());
         }
         finally
         {
             if (IsNeedRedirectEventHandler(srcFormView, dstFormView) && !bForceNoUpdateView)
             {
                 srcFormView.SendDynamicFormAction(dstFormView);
             }
         }
     }
 }
Beispiel #13
0
        private static FieldAppearance GetNextEditFieldAp(IDynamicFormView view, FieldAppearance fieldAp, int iRow)
        {
            FieldAppearance nextFieldAp = null;

            if (fieldAp != null)
            {
                EntryEntityAppearance entryEntityAp = view.LayoutInfo.GetEntryEntityAppearance(fieldAp.EntityKey);
                if (entryEntityAp != null)
                {
                    DynamicObject rowData       = view.Model.GetEntityDataObject(entryEntityAp.Entity, iRow);
                    int           iStartFindPos = entryEntityAp.Layoutinfo.Appearances.IndexOf(fieldAp);
                    if (iStartFindPos >= 0)
                    {
                        for (int i = iStartFindPos + 1; i < entryEntityAp.Layoutinfo.Appearances.Count; i++)
                        {
                            nextFieldAp = entryEntityAp.Layoutinfo.Appearances[i] as FieldAppearance;
                            if (nextFieldAp == null)
                            {
                                continue;
                            }
                            //跳过不可见或不可编辑的字段
                            if (nextFieldAp.IsLocked(view.OpenParameter.Status) == true ||
                                nextFieldAp.IsVisible(view.OpenParameter.Status) == false)
                            {
                                continue;
                            }

                            //单元格锁定也不填充
                            if (rowData != null && view.StyleManager.GetEnabled(fieldAp, rowData) == false)
                            {
                                continue;
                            }

                            break;
                        }
                    }
                }
            }

            return(nextFieldAp);
        }
        /// <summary>
        /// 打开PC的Web页面,暂时不好用
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="FormId"></param>
        /// <param name="pkid"></param>
        /// <returns></returns>
        private IDynamicFormView OpenWebView(Context ctx, string FormId, string pkid = null)
        {
            var          meta = MetaDataServiceHelper.Load(ctx, FormId) as FormMetadata;
            BusinessInfo info = meta.BusinessInfo;
            var          form = info.GetForm();

            BillOpenParameter param = new BillOpenParameter(form.Id, null);

            //param.SetCustomParameter("formID", form.Id);
            //param.SetCustomParameter("status", (pkid != null ? "View" : "AddNew"));
            //param.SetCustomParameter("formID", form.CreateFormPlugIns());
            param.Context               = ctx;
            param.ServiceName           = form.FormServiceName;
            param.PageId                = Guid.NewGuid().ToString();
            param.FormMetaData          = meta;
            param.LayoutId              = param.FormMetaData.GetLayoutInfo().Id;
            param.Status                = pkid != null ? OperationStatus.EDIT : OperationStatus.ADDNEW;
            param.PkValue               = pkid;
            param.CreateFrom            = CreateFrom.Default;
            param.ParentId              = 0;
            param.GroupId               = "";
            param.DefaultBillTypeId     = null;
            param.DefaultBusinessFlowId = null;
            param.SetCustomParameter("ShowConfirmDialogWhenChangeOrg", false);

            //IResourceServiceProvider provider = form.GetFormServiceProvider();
            //IDynamicFormView bv = provider.GetService(typeof(IDynamicFormView)) as IDynamicFormView;
            //(bv as IBillViewService).Initialize(param, provider);
            //(bv as IDynamicFormView).RegisterPlugIn(getFormStatePlugIn);
            Type             type = Type.GetType("Kingdee.BOS.Web.Import.ImportBillView,Kingdee.BOS.Web");
            IDynamicFormView bv   = (IDynamicFormView)Activator.CreateInstance(type);
            var provider          = form.GetFormServiceProvider();

            (bv as IBillViewService).Initialize(param, provider);
            (bv as IBillView).CreateNewModelData();
            if (param.Status != OperationStatus.ADDNEW)
            {
                (bv as IBillViewService).LoadData();
            }
            return(bv);
        }
        public override void AfterConvert(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.AfterConvertEventArgs e)
        {
            ExtendedDataEntity[] dataEntitys = e.Result.FindByEntityKey("FBillHead");
            if (dataEntitys == null || dataEntitys.Count() == 0)
            {
                return;
            }
            //入库单新增视图
            IDynamicFormView targetView = (IDynamicFormView)this.CreateTargetBillView(e.TargetBusinessInfo);

            foreach (var dataEntity in dataEntitys)
            {
                DynamicObject data = dataEntity.DataEntity;
                (targetView as IBillView).OpenParameter.PkValue = 0;
                (targetView as IBillView).OpenParameter.Status  = OperationStatus.ADDNEW;
                targetView.Refresh();
                targetView.Model.DataObject = data;
                //执行操作
                DoExecute(targetView);
            }
            targetView.Close();
        }
Beispiel #16
0
        public static void SetFlexFieldVisible(this IDynamicFormView view, string flexFieldKey, bool bVisible)
        {
            RelatedFlexGroupField flexField = view.BillBusinessInfo.GetField(flexFieldKey) as RelatedFlexGroupField;

            if (flexField == null)
            {
                return;
            }
            if (flexField.FlexDisplayFormat == FlexType.Format.POPUPBOX)
            {
                //this.View.StyleManager.SetVisible(controlFieldKey, null, bVisible);
                view.StyleManager.SetVisible(flexField.Key, null, bVisible);
            }
            else
            {
                foreach (var itemField in flexField.RelateFlexBusinessInfo.GetFieldList())
                {
                    string strColKey = string.Format("$${0}__{1}", flexField.Key, itemField.Key);
                    view.StyleManager.SetVisible(strColKey, null, bVisible);
                }
            }
        }
Beispiel #17
0
        /// <summary>
        /// 设置行可用性
        /// </summary>
        /// <param name="view"></param>
        /// <param name="entityKey"></param>
        /// <param name="rowObject"></param>
        /// <param name="bEnabled"></param>
        /// <param name="exceptFieldkeys"></param>
        public static void SetEntityRowEnabled(this IDynamicFormView view, string entityKey, DynamicObject rowObject, bool bEnabled, IEnumerable <string> exceptFieldkeys = null)
        {
            if (exceptFieldkeys == null)
            {
                exceptFieldkeys = new string[] { }
            }
            ;

            foreach (Field field in (from o in view.BillBusinessInfo.GetEntryEntity(entityKey).Fields
                                     where !exceptFieldkeys.Contains(o.Key)
                                     select o).ToList <Field>())
            {
                if (field is RelatedFlexGroupField)
                {
                    view.SetFlexFieldEnabled(field.Key, rowObject, bEnabled);
                }
                else
                {
                    view.StyleManager.SetEnabled(field, rowObject, null, bEnabled);
                }
            }
        }
Beispiel #18
0
        /// <summary>
        /// 设置按钮可用状态
        /// </summary>
        /// <param name="view"></param>
        /// <param name="barItemKey">按钮标识</param>
        /// <param name="bEnabled">可用性</param>
        /// <param name="barOwnerKey">工具条拥有者标识,单据主工具条不用传值,表格工具条请传表格标识,其它独立工具条请传工具条标识</param>
        public static void SetBarItemEnabled(this IDynamicFormView view, string barItemKey, bool bEnabled, string barOwnerKey = "")
        {
            Appearance ap = null;

            if (!string.IsNullOrWhiteSpace(barOwnerKey))
            {
                ap = view.LayoutInfo.GetAppearance(barOwnerKey);
            }

            BarItemControl barItem = null;

            if (ap == null)
            {
                barItem = view.GetMainBarItem(barItemKey);

                if (barItem != null)
                {
                    barItem.Enabled = bEnabled;
                }
            }

            foreach (var entityAp in view.LayoutInfo.GetEntityAppearances())
            {
                if (entityAp is HeadEntityAppearance || entityAp is SubHeadEntityAppearance)
                {
                    continue;
                }

                if (barOwnerKey.IsNullOrEmptyOrWhiteSpace() || entityAp.Key.EqualsIgnoreCase(barOwnerKey))
                {
                    barItem = view.GetBarItem(entityAp.Key, barItemKey);

                    if (barItem != null)
                    {
                        barItem.Enabled = bEnabled;
                    }
                }
            }
        }
Beispiel #19
0
        /// <summary>
        /// 显示列表
        /// </summary>
        /// <param name="view"></param>
        /// <param name="formId"></param>
        /// <param name="listType"></param>
        /// <param name="bMultiSel"></param>
        /// <param name="callback"></param>
        public static void ShowList(this IDynamicFormView view, string formId, BOSEnums.Enu_ListType listType, bool bMultiSel = true, string filter = "", Action <ListShowParameter> showPara = null, Action <FormResult> callback = null)
        {
            ListShowParameter listShowPara = new ListShowParameter();

            listShowPara.FormId       = formId;
            listShowPara.PageId       = Guid.NewGuid().ToString();
            listShowPara.ParentPageId = view.PageId;
            listShowPara.MultiSelect  = bMultiSel;
            listShowPara.ListType     = (int)listType;
            if (listType == BOSEnums.Enu_ListType.SelBill)
            {
                listShowPara.IsLookUp = true;
            }
            listShowPara.ListFilterParameter.Filter = listShowPara.ListFilterParameter.Filter.JoinFilterString(filter);
            listShowPara.IsShowUsed     = true;
            listShowPara.IsShowApproved = false;
            if (showPara != null)
            {
                showPara(listShowPara);
            }

            view.ShowForm(listShowPara, callback);
        }
Beispiel #20
0
        /// <summary>
        /// 移动表格分录
        /// </summary>
        /// <param name="view"></param>
        /// <param name="entityKey"></param>
        /// <param name="iSrcRowIndex"></param>
        /// <param name="iDstRowIndex"></param>
        /// <param name="callback"></param>
        public static void MoveEntryRow(this IDynamicFormView view, string entityKey, int iSrcRowIndex, int iDstRowIndex, Action <int, int> callback = null)
        {
            EntryEntity             entryEntity  = view.BillBusinessInfo.GetEntryEntity(entityKey);
            DynamicObjectCollection dataEntities = view.Model.GetEntityDataObject(entryEntity);

            if (iSrcRowIndex < 0 || iSrcRowIndex >= dataEntities.Count)
            {
                return;
            }
            if (iDstRowIndex < 0 || iDstRowIndex >= dataEntities.Count)
            {
                return;
            }
            var srcRow = dataEntities[iSrcRowIndex];
            var dstRow = dataEntities[iDstRowIndex];

            if (iSrcRowIndex > iDstRowIndex)
            {
                dataEntities.RemoveAt(iSrcRowIndex);
                dataEntities.Insert(iDstRowIndex, srcRow);
            }
            else
            {
                dataEntities.RemoveAt(iDstRowIndex);
                dataEntities.Insert(iSrcRowIndex, dstRow);
            }

            EntryGrid grid = view.GetControl <EntryGrid>(entityKey);

            grid.ExchangeRowIndex(iSrcRowIndex, iDstRowIndex);
            grid.SetFocusRowIndex(iDstRowIndex);

            if (callback != null)
            {
                callback(iSrcRowIndex, iDstRowIndex);
            }
        }
Beispiel #21
0
        public void BindDataToView(Context ctx, IDynamicFormView formView, string sql, string entryName)
        {
            List <SynchroLog> logs = GetSynchroLogDatas(ctx, sql);

            if (!string.IsNullOrWhiteSpace(entryName))
            {
                formView.Model.DeleteEntryData(entryName);

                if (logs != null && logs.Count > 0)
                {
                    for (int i = 0; i < logs.Count; i++)
                    {
                        if (logs[i] != null)
                        {
                            formView.Model.InsertEntryRow(entryName, i);
                            formView.Model.SetValue("F_HS_DataSourceType", logs[i].FDataSourceType, i);
                            formView.Model.SetValue("F_HS_DataSourceId", logs[i].sourceId, i);

                            formView.Model.SetValue("F_HS_BILLNO", logs[i].K3BillNo, i);
                            formView.Model.SetValue("F_HS_SynchroTime", logs[i].BeginTime, i);
                            formView.Model.SetValue("F_HS_IsSuccess", logs[i].IsSuccess, i);

                            formView.Model.SetValue("F_HS_ErrInfor", logs[i].ErrInfor, i);
                            formView.Model.SetValue("F_HS_DataSourceTypeDesc", logs[i].FDataSourceTypeDesc, i);
                            formView.Model.SetValue("F_HS_OperateId", logs[i].FOperateId, i);
                        }
                    }

                    formView.UpdateView(entryName);
                }
                else
                {
                    this.View.ShowErrMessage("", "没有需要查询的数据,请检查!", MessageBoxType.Error);
                }
            }
        }
Beispiel #22
0
        /// <summary>
        /// 显示表单
        /// </summary>
        /// <param name="view"></param>
        /// <param name="panelKey"></param>
        /// <returns></returns>
        public static void ShowForm(this IDynamicFormView view, string formId, string panelKey = null, string pageId = null, Action <FormResult> callback = null, Action <DynamicFormShowParameter> showParaCallback = null)
        {
            DynamicFormShowParameter showPara = new DynamicFormShowParameter();

            showPara.PageId       = string.IsNullOrWhiteSpace(pageId) ? Guid.NewGuid().ToString() : pageId;
            showPara.ParentPageId = view.PageId;
            if (string.IsNullOrWhiteSpace(panelKey))
            {
                showPara.OpenStyle.ShowType = ShowType.Default;
            }
            else
            {
                showPara.OpenStyle.ShowType = ShowType.InContainer;
                showPara.OpenStyle.TagetKey = panelKey;
            }
            showPara.FormId            = formId;
            showPara.OpenStyle.CacheId = pageId;
            if (showParaCallback != null)
            {
                showParaCallback(showPara);
            }

            view.ShowForm(showPara, callback);
        }
Beispiel #23
0
        /// <summary>
        /// 设置按钮可见状态
        /// </summary>
        /// <param name="view"></param>
        /// <param name="barItemKey">按钮标识</param>
        /// <param name="bVisible">可见性</param>
        /// <param name="barOwnerKey">工具条拥有者标识,单据主工具条不用传值,表格工具条请传表格标识,其它独立工具条请传工具条标识</param>
        public static void SetBarItemVisible(this IDynamicFormView view, string barItemKey, bool bVisible, string barOwnerKey = "")
        {
            Appearance ap = null;

            if (!string.IsNullOrWhiteSpace(barOwnerKey))
            {
                ap = view.LayoutInfo.GetAppearance(barOwnerKey);
            }

            BarItemControl barItem = null;

            if (ap == null)
            {
                barItem = view.GetMainBarItem(barItemKey);
            }
            else
            {
                barItem = view.GetBarItem(ap.Key, barItemKey);
            }
            if (barItem != null)
            {
                barItem.Visible = bVisible;
            }
        }
Beispiel #24
0
 public static EnumItem CreateEnumItem(IDynamicFormView view, object key, string displayValue)
 {
     return(CreateEnumItem(view.Context, key, key, displayValue));
 }
 public abstract void DoExecute(IDynamicFormView targetView);
Beispiel #26
0
        public void BindDataToView(Context ctx, IDynamicFormView formView, string sql, string entryName)
        {
            DynamicObjectCollection coll = GetObjects(ctx, sql);
            int i = 0;

            if (!string.IsNullOrWhiteSpace(entryName))
            {
                formView.Model.DeleteEntryData(entryName);

                if (coll != null && coll.Count > 0)
                {
                    foreach (var item in coll)
                    {
                        if (item != null)
                        {
                            formView.Model.InsertEntryRow(entryName, i);
                            if (!string.IsNullOrWhiteSpace(SQLUtils.GetFieldValue(item, "F_HS_UseOrgId")))
                            {
                                formView.Model.SetItemValueByID("F_HS_UseOrgId", SQLUtils.GetFieldValue(item, "F_HS_UseOrgId"), i);
                            }
                            else
                            {
                                formView.Model.SetItemValueByID("F_HS_UseOrgId", "100035", i);
                            }
                            formView.Model.SetItemValueByID("F_HS_Customer", SQLUtils.GetFieldValue(item, "F_HS_B2CCUSTID"), i);
                            //formView.Model.SetValue("F_HS_Customer", SQLUtils.GetFieldValue(item, "F_HS_B2CCUSTID"), i);
                            formView.Model.SetValue("F_HS_ChangeAmount", SQLUtils.GetFieldValue(item, "changedAmount"), i);

                            formView.Model.SetValue("F_HS_TradeType", SQLUtils.GetFieldValue(item, "F_HS_TradeType"), i);
                            formView.Model.SetValue("F_HS_ChangedType", GetChangeTypeDesc(SQLUtils.GetFieldValue(item, "changedType")), i);
                            formView.Model.SetValue("F_HS_ChangedCause", GetChangeCauseDesc(SQLUtils.GetFieldValue(item, "changedCause")), i);
                            formView.Model.SetValue("F_HS_BalanceAmount", SQLUtils.GetFieldValue(item, "balanceAmount"), i);
                            formView.Model.SetValue("F_HS_RateToUSA", SQLUtils.GetFieldValue(item, "F_HS_RateToUSA"), i);

                            //formView.Model.SetValue("F_HS_SettleCurrId", SQLUtils.GetFieldValue(item, "FSETTLECURRID"), i);
                            formView.Model.SetItemValueByID("F_HS_SettleCurrId", SQLUtils.GetFieldValue(item, "FSETTLECURRID"), i);

                            formView.Model.SetValue("F_HS_ChangedAmountUSD", SQLUtils.GetFieldValue(item, "changedAmountUSA"), i);
                            formView.Model.SetValue("F_HS_BalanceAmountUSD", SQLUtils.GetFieldValue(item, "balanceAmountUSA"), i);
                            formView.Model.SetValue("F_HS_CNYBalance", SQLUtils.GetFieldValue(item, "F_HS_CNYBalance"), i);
                            formView.Model.SetValue("F_HS_UpdateTime", SQLUtils.GetFieldValue(item, "updateTime"), i);

                            //formView.Model.SetValue("F_HS_UpdateUser", SQLUtils.GetFieldValue(item, "updateUser"), i);
                            formView.Model.SetItemValueByID("F_HS_UpdateUser", SQLUtils.GetFieldValue(item, "updateUser"), i);
                            formView.Model.SetValue("F_HS_BillNo", SQLUtils.GetFieldValue(item, "FBillNo"), i);

                            formView.Model.SetValue("F_HS_EntryId", SQLUtils.GetFieldValue(item, "fentryID"), i);
                            formView.Model.SetValue("F_HS_NeedFreezed", SQLUtils.GetFieldValue(item, "needfreezed"), i);
                            formView.Model.SetValue("F_HS_Remark", SQLUtils.GetFieldValue(item, "remark"), i);

                            i++;
                        }
                    }

                    formView.UpdateView(entryName);
                }
                else
                {
                    this.View.ShowErrMessage("", "没有需要查询的数据", MessageBoxType.Error);
                }
            }
        }
Beispiel #27
0
        /// <summary>
        /// 处理Excel块粘贴功能
        /// </summary>
        /// <param name="view"></param>
        /// <param name="e"></param>
        /// <param name="bAllowAutoNewRows">允许自动新增行</param>
        /// <param name="bCanPaste">是否允许填充某字段</param>
        public static void PasteBlockData(this IDynamicFormView view, EntityBlockPastingEventArgs e, bool bAllowAutoNewRows = false, Func <FieldAppearance, int, bool> bCanPaste = null)
        {
            if (e.BlockValue.IsNullOrEmptyOrWhiteSpace())
            {
                return;
            }
            FieldAppearance startFieldAp = view.LayoutInfo.GetFieldAppearance(e.StartKey);

            if (startFieldAp == null || (startFieldAp.Field.Entity is EntryEntity) == false)
            {
                return;
            }
            EntryEntity entryEntity = (EntryEntity)startFieldAp.Field.Entity;
            int         iTotalRows  = view.Model.GetEntryRowCount(entryEntity.Key);

            var copyOperation = view.BillBusinessInfo.GetForm().FormOperations
                                .FirstOrDefault(o => o.OperationId == 31 && string.Equals(o.Parmeter.OperationObjectKey, entryEntity.Key, StringComparison.InvariantCultureIgnoreCase));
            bool isCopyLinkEntry = false;

            //如果表格未配置复制行操作,则不允许自动新增行
            if (copyOperation == null)
            {
                bAllowAutoNewRows = false;
            }
            else
            {
                isCopyLinkEntry = GetIsCopyLinkEntryParam(copyOperation.Parmeter);
            }

            string[] strBlockDataRows = e.BlockValue.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
            int      iRow             = e.StartRow;

            foreach (var rowData in strBlockDataRows)
            {
                if (iRow >= iTotalRows)
                {
                    if (bAllowAutoNewRows)
                    {
                        view.Model.CopyEntryRow(entryEntity.Key, iRow - 1, iRow, isCopyLinkEntry);
                    }
                    else
                    {
                        break;
                    }
                }
                string[] strItemValues = rowData.Split(new char[] { '\t' });

                FieldAppearance fieldAp = startFieldAp;
                foreach (var value in strItemValues)
                {
                    if (fieldAp == null)
                    {
                        continue;
                    }
                    object objValue = value;

                    if (typeof(ValueType).IsAssignableFrom(fieldAp.Field.GetPropertyType()))
                    {
                        if (value.IsNullOrEmptyOrWhiteSpace())
                        {
                            objValue = 0;
                        }
                        else
                        {
                            ValueTypeConverter converter = new ValueTypeConverter();
                            if (value != null && converter.CanConvertTo(value.GetType()))
                            {
                                objValue = converter.ConvertTo(value, fieldAp.Field.GetPropertyType());
                            }
                        }
                    }
                    if (bCanPaste == null || bCanPaste(fieldAp, iRow))
                    {
                        (view as IDynamicFormViewService).UpdateValue(fieldAp.Key, iRow, objValue);
                    }
                    fieldAp = GetNextEditFieldAp(view, fieldAp, iRow);
                }

                iRow++;
            }
        }
Beispiel #28
0
        private static bool IsNeedRedirectEventHandler(IDynamicFormView srcFormView, IDynamicFormView dstFormView)
        {
            string pageId = null;

            return(!dctFormInteractFlags.TryGetValue(string.Format("{0}_{1}", dstFormView.PageId, srcFormView.PageId), out pageId));
        }
Beispiel #29
0
        /// <summary>
        /// 移动表格分录,保证模型与视图索引匹配
        /// </summary>
        /// <param name="view"></param>
        /// <param name="entityKey"></param>
        /// <param name="selRows"></param>
        /// <param name="iTargetPos"></param>
        /// <param name="isRelativePos"></param>
        /// <param name="callback"></param>
        public static void MoveEntryRow(this IDynamicFormView view, string entityKey, int[] selRows, int iTargetPos, bool isRelativePos = true, Action <int[], int, bool> callback = null)
        {
            if (selRows == null || selRows.Any() == false)
            {
                return;
            }

            var entryEntity = view.BillBusinessInfo.GetEntity(entityKey);
            DynamicObjectCollection dataEntities = view.Model.GetEntityDataObject(entryEntity);

            DynamicObject targetRowObj = null;

            if (!isRelativePos)
            {
                if (iTargetPos < 0 || iTargetPos >= dataEntities.Count)
                {
                    return;
                }

                targetRowObj = view.Model.GetEntityDataObject(entryEntity, iTargetPos);
                if (targetRowObj == null)
                {
                    return;
                }
            }

            var selRowObjItems = selRows.Select(o => view.Model.GetEntityDataObject(entryEntity, o))
                                 .ToList();

            List <int> lstNewSelRows = new List <int>();

            for (int i = selRowObjItems.Count - 1; i >= 0; i--)
            {
                if (selRowObjItems[i] == null)
                {
                    continue;
                }

                var selRowObj       = selRowObjItems[i];
                int iSrcRowIndex    = view.Model.GetRowIndex(entryEntity, selRowObj);
                int iTargetRowIndex = iSrcRowIndex + iTargetPos;
                if (!isRelativePos)
                {
                    iTargetRowIndex = view.Model.GetRowIndex(entryEntity, targetRowObj);
                }

                if (iTargetRowIndex > dataEntities.Count - 1 || iTargetRowIndex < 0)
                {
                    continue;
                }

                dataEntities.Remove(selRowObj);
                dataEntities.Insert(iTargetRowIndex, selRowObj);
                lstNewSelRows.Add(iTargetRowIndex);
            }

            int iSeq = 1;

            foreach (var dataEntity in dataEntities)
            {
                if (entryEntity.SeqDynamicProperty != null)
                {
                    entryEntity.SeqDynamicProperty.SetValue(dataEntity, iSeq++);
                }
            }

            if (callback != null)
            {
                callback(selRows, iTargetPos, isRelativePos);
            }

            view.UpdateView(entityKey);

            if (lstNewSelRows.IsEmpty())
            {
                lstNewSelRows.AddRange(selRows);
            }
            if (lstNewSelRows.Any())
            {
                EntryGrid grid = view.GetControl <EntryGrid>(entityKey);
                grid.SelectRows(lstNewSelRows.ToArray());
                grid.SetFocusRowIndex(lstNewSelRows.Last());
            }
        }
Beispiel #30
0
        public static void UpdateColumnHeader(this IDynamicFormView view, ControlAppearance gridAp, string colKey, string header)
        {
            IDynamicFormState formState = view.GetService <IDynamicFormState>();

            SetColumnPropValue(formState, gridAp, colKey, "header", header);
        }