Esempio n. 1
0
 /// <summary>
 /// initialize link fields
 /// </summary>
 /// <param name="currRec"></param>
 public void InitLinkFields(com.magicsoftware.unipaas.management.data.IRecord currRec)
 {
     //init the cureent rec fields that belong to the link
     foreach (Field field in Fields)
     {
         bool   isNull = field.isNull();
         String result = field.getValue(false);;
         field.getInitExpVal(ref result, ref isNull);
         //this function knows to take either the null value or the defualt value
         ((Record)currRec).SetFieldValue(field.getId(), isNull, result);
         field.invalidate(true, false);
     }
 }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        internal override ReturnResultBase Execute()
        {
            if (Field.IsVirtual)
            {
                return(new ReturnResult());
            }

            // check the conditions which will allow the update
            if (Field.IsLinkField)
            {
                LinkView linkView = TaskViews.LinkViews[Field.getDataviewHeaderId()];
                IRecord  record   = DataviewSynchronizer.GetCurrentRecord();

                if ((linkView.DataviewHeader.Mode == LnkMode.Write && linkView.GetPosition(record) == null) ||
                    linkView.DataviewHeader.Mode == LnkMode.Create)
                {
                    return(new ReturnResult());
                }
            }

            // update not allowed - return the error
            return(new ReturnResult(MsgInterface.RT_STR_NON_MODIFIABLE));
        }
Esempio n. 3
0
        /// <summary>
        /// update link result
        /// </summary>
        /// <param name="curRec">current record</param>
        /// <param name="ret">link success</param>
        public void SetReturnValue(com.magicsoftware.unipaas.management.data.IRecord curRec, bool ret, bool recompute)
        {
            Field retFld = ReturnField;

            if (retFld != null)
            {
                bool enforceValiableChange = retFld.getTask() != Task;

                //if we are fetching first chunk we didn't updated the executuion stack yet
                ClientManager.Instance.EventsManager.pushNewExecStacks();
                //same as NonRecomputeVarChangeEvent on server fetch.cpp

                //if the return field is numeric, then convert result value toNum() before passing to setValueAndStartRecompute().
                string result = ret ? "1" : "0";
                if (retFld.getType() == StorageAttribute.NUMERIC)
                {
                    result = DisplayConvertor.Instance.toNum(result, new PIC(retFld.getPicture(), StorageAttribute.NUMERIC, 0), 0);
                }

                retFld.setValueAndStartRecompute(result, false, recompute, false, false, enforceValiableChange);

                ClientManager.Instance.EventsManager.popNewExecStacks();

                if (!recompute)
                {
                    retFld.setModified();
                }

                retFld.invalidate(true, false);

                // If field is from another task, need to update the display as well
                if (retFld.getTask() != Task)
                {
                    retFld.updateDisplay();
                }
            }
        }