示例#1
0
        private List <PXSqlContent> GetSortedContentsList(string mMainTableId, bool contructedFromPxs, BasicValueType[] contentsInPxs)
        {
            List <PXSqlContent> myOut = new List <PXSqlContent>();
            Dictionary <string, ContentsRow> altIBasen = mMetaQuery.GetContentsRows(mMainTableId, false);


            //side effect:
            ContentsRow someContentsRow = null;

            foreach (ContentsRow tmpRow in altIBasen.Values)
            { //just want any one of the rows
                someContentsRow = tmpRow;
                break;
            }

            couldHaveBeenByMainTableOnly = new PXSqlThingsThatWouldBeTheSameInAllPXSqlContent(someContentsRow, this, mConfig);

            PXSqlContact contact = new PXSqlContact(this, this.MainTable.MainTable);


            PXSqlContent mContent = null;

            if (this.ConstructedFromPxs)
            {
                int documentOrder = 0;
                foreach (BasicValueType contents in contentsInPxs)
                {
                    if (altIBasen.ContainsKey(contents.code))
                    {
                        mContent           = new PXSqlContent(altIBasen[contents.code], this, mConfig, contact);
                        mContent.SortOrder = documentOrder;
                        myOut.Add(mContent);
                        documentOrder++;
                    }
                }
            }
            else
            {
                foreach (KeyValuePair <string, ContentsRow> cont in altIBasen)
                {
                    mContent           = new PXSqlContent(cont.Value, this, mConfig, contact);
                    mContent.SortOrder = int.Parse(cont.Value.StoreColumnNo);
                    myOut.Add(mContent);
                }
            }

            if (myOut.Count < 1)
            {
                throw new ApplicationException("No contents to process");
            }
            myOut.Sort();
            return(myOut);
        }
示例#2
0
 public PXSqlValue(PXSqlContent content, int sortCode)
 {
     this.mContentsCode = content.Contents;
     //this.ValueCode = content.Contents;
     this.ValueCode  = content.PresCode; // ValueCode should be PresCode. Contents is no sent to Paxiom as Reference_ID an used as code in PXS.
     this.ValueTextL = content.PresText;
     this.ValueTextS = content.PresTextS;
     // SortCodePxs and SortCode are now set to the same value. Maybe no a good thing if sortorder should be reset to db
     // default after read from pxs. //TODO send two sortcodes from PXSQlMeta.
     this.SortCodePxs    = sortCode;
     this.mSortCodeValue = sortCode.ToString();
 }