예제 #1
0
        private static void ValSetter2(ref TSM tTSM, string ptr, object tval, bool IsJSON)
        {
            switch (ptr) //int
            {
            case "TXT":
                tTSM.TXT = TheCommonUtils.CStr(tval);
                break;

            case "TIM":
                if (IsJSON)
                {
                    if (tval != null)
                    {
                        long tim = TheCommonUtils.CLng(tval.ToString().Substring(6, tval.ToString().Length - 8));
                        tTSM.TIM = new DateTimeOffset(1970, 1, 1, 0, 0, 0, DateTimeOffset.Now.Offset).Add(new TimeSpan(tim * 10000));
                    }
                }
                else
                {
                    if (tval != null)
                    {
                        tTSM.TIM = TheCommonUtils.CDate(tval.ToString());
                    }
                }
                break;

            case "FLG":
                tTSM.FLG = (ushort)TheCommonUtils.CInt(tval);
                break;

            case "PLS":
                tTSM.PLS = TheCommonUtils.CStr(tval);
                break;

            case "ORG":
                tTSM.ORG = TheCommonUtils.CStr(tval);    //ORG-OK
                break;

            case "QDX":
                tTSM.QDX = TheCommonUtils.CInt(tval);
                break;

            case "LVL":
                if (tval.Equals("l1_Error"))
                {
                    tTSM.LVL = eMsgLevel.l1_Error;
                }
                else if (tval.Equals("l2_Warning"))
                {
                    tTSM.LVL = eMsgLevel.l2_Warning;
                }
                else if (tval.Equals("l3_ImportantMessage"))
                {
                    tTSM.LVL = eMsgLevel.l3_ImportantMessage;
                }
                else if (tval.Equals("l4_Message"))
                {
                    tTSM.LVL = eMsgLevel.l4_Message;
                }
                else if (tval.Equals("l5_HostMessage"))
                {
                    tTSM.LVL = eMsgLevel.l5_HostMessage;
                }
                else if (tval.Equals("l6_Debug"))
                {
                    tTSM.LVL = eMsgLevel.l6_Debug;
                }
                else if (tval.Equals("l7_HostDebugMessage"))
                {
                    tTSM.LVL = eMsgLevel.l7_HostDebugMessage;
                }
                else if (tval.Equals("ALL"))
                {
                    tTSM.LVL = eMsgLevel.ALL;
                }
                else
                {
                    tTSM.LVL = 0;
                }
                break;

            case "ENG":
                tTSM.ENG = TheCommonUtils.CStr(tval);
                break;

            case "FID":
                tTSM.FID = TheCommonUtils.CStr(tval);
                break;

            case "SID":
                tTSM.SID = TheCommonUtils.CStr(tval);
                break;

            case "SEID":
                tTSM.SEID = TheCommonUtils.CStr(tval);
                break;

            case "UID":
                tTSM.UID = TheCommonUtils.CStr(tval);
                break;

            case "CST":
                tTSM.CST = TheCommonUtils.CStr(tval);
                break;

            case "OWN":
                tTSM.OWN = TheCommonUtils.CStr(tval);
                break;

            case "PLB":
                if (tval != null)
                {
                    tTSM.PLB = Convert.FromBase64String(tval.ToString());
                }
                break;
            }
        }