예제 #1
0
        public static String GetDecodedParameter(String paName)
        {
            String lcParamValue;

            if (!String.IsNullOrWhiteSpace(lcParamValue = GetParameter(paName)))
            {
                lcParamValue = HttpUtility.UrlDecode(lcParamValue);
                lcParamValue = General.Base64Decode(lcParamValue);
            }

            return(lcParamValue);
        }
예제 #2
0
        private void UpdateDataRecord()
        {
            String           lcDataBlock;
            DataRecordUpdate lcDataRecordUpdate;

            if (!String.IsNullOrWhiteSpace(lcDataBlock = ApplicationFrame.GetParameter(ctARGDataBlock)))
            {
                if ((lcDataRecordUpdate = DataRecordUpdate.CreateInstance(General.Base64Decode(lcDataBlock))) != null)
                {
                    if (lcDataRecordUpdate.UpdateData())
                    {
                        clServiceResponse.Success = true;
                    }
                }
            }
        }
예제 #3
0
        private string unwrap(string server_resp)
        {
            if (string.IsNullOrEmpty(server_resp))
            {
                return(null);
            }

            if (server_resp.StartsWith("Error:"))
            {
                return(null);
            }

            JObject JData = JObject.Parse(server_resp);

            if (JData == null)
            {
                return(null);
            }

            if (JData["data"] == null)
            {
                return(null);
            }

            if (JData["compression"] == null)
            {
                return(null);
            }

            string output = "";

            if (JData["compression"].ToString() == "bzip")
            {
                output = General.DecompressStringBZIP(JData["data"].ToString());
            }
            else if (JData["compression"].ToString() == "gzip")
            {
                output = General.DecompressStringGZIP(JData["data"].ToString());
            }
            else if (JData["compression"].ToString() == "none")
            {
                output = General.Base64Decode(JData["data"].ToString());
            }

            return(output);
        }
예제 #4
0
        private Dictionary<String, String> DecodeFilterInfo(String  paEncodedFilterInfo)
        {
         //   JavaScriptSerializer        lcJavaScriptSerializer;
            String                      lcJSONString;            

           //  lcJavaScriptSerializer = new JavaScriptSerializer();            

            try 
            { 
                lcJSONString = General.Base64Decode(paEncodedFilterInfo, true);
                return(General.JSONDeserialize<Dictionary<String, String>>(lcJSONString));
            }
            catch
            {
                return(null);
            }
        }
예제 #5
0
        private static Dictionary <String, String> DecryptBlock(String paBlock)
        {
            // JavaScriptSerializer lcJavaScriptSerializer;
            Dictionary <String, String> lcDictionary;
            String lcJSONString;

            // lcJavaScriptSerializer = new JavaScriptSerializer();

            try
            {
                // lcJSONString = RijdaelEncryption.GetInstance().DecryptString(paBlock);
                lcJSONString = General.Base64Decode(paBlock);
                lcDictionary = General.JSONDeserialize <Dictionary <String, String> >(lcJSONString);
                lcDictionary = new Dictionary <string, string>(lcDictionary, StringComparer.OrdinalIgnoreCase);

                return(lcDictionary);
            }
            catch
            {
                return(null);
            }
        }
예제 #6
0
        public WebStateBlock()
        {
            String lcWebStateBlock;
            MetaDataBlockCollection lcMetaBlockCollection;

            if (!String.IsNullOrEmpty(lcWebStateBlock = ApplicationFrame.GetParameter(ctWebStateParam)))
            {
                lcWebStateBlock = General.Base64Decode(lcWebStateBlock, true);
                if ((lcMetaBlockCollection = new MetaDataBlockCollection(lcWebStateBlock)) != null)
                {
                    clMetaDataBlock = lcMetaBlockCollection[0];
                }
                else
                {
                    clMetaDataBlock = new MetaDataBlock();
                }
            }
            else
            {
                clMetaDataBlock = new MetaDataBlock();
            }
        }
예제 #7
0
        static public void DecodeFormName(String paEncodedFormName, out String paFormName, out Dictionary <String, String> paFormParam)
        {
            String[] lcStrArray;

            paFormParam = new Dictionary <string, string>(StringComparer.InvariantCultureIgnoreCase); // Make Sure Param is not null.
            paFormName  = String.Empty;

            if (!String.IsNullOrWhiteSpace(paEncodedFormName))
            {
                paFormName = HttpUtility.UrlDecode(General.Base64Decode(paEncodedFormName));

                lcStrArray = paFormName.Split(new char[] { ctParamDelimiter }, 2, StringSplitOptions.RemoveEmptyEntries);
                if (lcStrArray.Length > 1)
                {
                    paFormParam = lcStrArray[1].Split(new[] { ctSecondLevelDelimiter }, StringSplitOptions.RemoveEmptyEntries)
                                  .Select(part => part.Split(new[] { ctFirstLevelDelimiter }, StringSplitOptions.None))
                                  .ToDictionary(split => split[0], split => split[1]);
                }

                paFormName = lcStrArray.Length > 0 ? lcStrArray[0] : paFormName;
            }
        }
예제 #8
0
        //private void PlaceOrder()
        //{
        //    String lcItemList;
        //    String lcDeliveryInfo;
        //    OrderInfoManager lcOrderInfoManager;
        //    int lcOrderNo;

        //    if ((!String.IsNullOrWhiteSpace(lcItemList = ApplicationFrame.GetParameter(ctARGItemList))) &&
        //        (!String.IsNullOrWhiteSpace(lcDeliveryInfo = ApplicationFrame.GetParameter(ctARGDeliveryInfo))))
        //    {
        //        if ((lcOrderInfoManager = OrderInfoManager.CreateInstance(General.Base64Decode(lcDeliveryInfo), General.Base64Decode(lcItemList))) != null)
        //            if((lcOrderNo = lcOrderInfoManager.SubmitNewOrder()) > 0)
        //            {
        //                clServiceResponse.AddResponse(CobraServiceResponse.RSP_Result.ToString(), lcOrderNo);
        //                clServiceResponse.Success = true;
        //            }
        //    }
        //}

        //private void UpdateOrder()
        //{
        //    int     lcOrderNo;
        //    String  lcRemark;
        //    String  lcItemList;
        //    OrderInfoManager lcOrderInfoManager;

        //    if ((!String.IsNullOrWhiteSpace(lcItemList = ApplicationFrame.GetParameter(ctARGItemList))) &&
        //        ((lcOrderNo = General.ParseInt(ApplicationFrame.GetParameter(ctARGParameter), -1)) > 0))
        //    {
        //        if ((lcOrderInfoManager = OrderInfoManager.CreateInstance(lcOrderNo, General.Base64Decode(lcItemList))) != null)
        //            if (lcOrderInfoManager.UpdateOrderDetail())
        //            {
        //                lcRemark = ApplicationFrame.GetParameter(ctARGSecondParameter, String.Empty);
        //                lcOrderInfoManager.UpdateOrderInfoRemark(lcRemark);
        //                clServiceResponse.Success = true;
        //            }
        //    }
        //}

        //private void POSUpdateReceiptRecord()
        //{
        //    String              lcMasterBlock;
        //    String              lcDetailListBlock;
        //    int                 lcReceiptNo;

        //    if ((!String.IsNullOrWhiteSpace(lcMasterBlock = ApplicationFrame.GetParameter(ctARGMasterBlock))) &&
        //        (!String.IsNullOrWhiteSpace(lcDetailListBlock = ApplicationFrame.GetParameter(ctARGDetailListBlock))))
        //    {
        //        if ((lcReceiptNo = POSReceiptManager.UpdateReceiptRecord(General.Base64Decode(lcMasterBlock), lcDetailListBlock)) > 0)
        //        {
        //            clServiceResponse.AddResponse(CobraServiceResponse.RSP_Serial.ToString(), lcReceiptNo.ToString());
        //            clServiceResponse.Success = true;
        //        }
        //    }
        //}

        private void GetUpdatedControl()
        {
            CompositeForm lcForm;
            String        lcUpdatedControl;
            String        lcFormParam;
            String        lcRenderMode;

            if ((lcFormParam = ApplicationFrame.GetParameter(ctARGParamBlock)) != null)
            {
                lcFormParam = General.Base64Decode(lcFormParam);
                ApplicationFrame.GetInstance().ActiveFormInfoManager.AddFormParam(lcFormParam, true);
            }

            lcForm = new CompositeForm(ApplicationFrame.GetInstance().ActiveFormInfoManager);

            lcRenderMode = ApplicationFrame.GetParameter(ctARGParameter);

            lcUpdatedControl = lcForm.GetSerializedControl(true, lcRenderMode);

            clServiceResponse.Success = true;
            clServiceResponse.AddResponse(CobraServiceResponse.RSP_HTML.ToString(), lcUpdatedControl);
        }
예제 #9
0
        private String GetFormStack()
        {
            String lcFormStackStr;

            String[] lcFormStack;
            String   lcNewFromStack;
            String   lcLastFormName;

            if ((ActiveFormInfoManager != null) && (!String.IsNullOrEmpty(lcFormStackStr = General.Base64Decode(GetStateParameter(ctPRMFormStack)))))
            {
                if (!clFormInfoManager.IsAttributeSet(FormInfoManager.FormAttribute.Desktop))
                {
                    lcFormStack = lcFormStackStr.Split(new String[] { ctFormStackDelimiter.ToString() }, StringSplitOptions.RemoveEmptyEntries);

                    if (lcFormStack.Length > 0)
                    {
                        lcLastFormName = lcFormStack[lcFormStack.Length - 1].Trim().Split(',')[0];
                        if (lcLastFormName.Trim() == ActiveFormInfoManager.ActiveRow.FormName.Trim())
                        {
                            Array.Resize(ref lcFormStack, lcFormStack.Length - 1);
                        }
                    }
                    //if ((lcFormStack.Length > 0) && (lcFormStack[lcFormStack.Length - 1].Trim() == ActiveFormInfoManager.ActiveRow.FormName.Trim()))
                    //    Array.Resize(ref lcFormStack, lcFormStack.Length - 1);

                    lcNewFromStack = String.Join(ctFormStackDelimiter.ToString(), lcFormStack);
                }
                else
                {
                    lcNewFromStack = String.Empty;
                }

                lcNewFromStack = General.Base64Encode(lcNewFromStack);
                ActiveWebStateBlock.StoreWebStateVariable(ctPRMFormStack, lcNewFromStack);

                return(lcNewFromStack);
            }
            return(String.Empty);
        }
예제 #10
0
        private void GetDataRowQuery()
        {
            String lcDataBlock;
            String lcQueryName;
            Dictionary <String, String> lcDataRowDictionary;

            if ((!String.IsNullOrWhiteSpace(lcQueryName = ApplicationFrame.GetParameter(ctARGParameter))) &&
                (!String.IsNullOrWhiteSpace(lcDataBlock = ApplicationFrame.GetParameter(ctARGDataBlock))))
            {
                if ((lcDataRowDictionary = DynamicQueryManager.GetInstance().GetDataRowDictionary(lcQueryName, General.Base64Decode(lcDataBlock))) != null)
                {
                    clServiceResponse.AddResponse <String, String>(lcDataRowDictionary);
                    clServiceResponse.AddResponse(CobraServiceResponse.RSP_KeyDetect.ToString(), (lcDataRowDictionary != null).ToString().ToLower());
                    clServiceResponse.Success = true;
                }
            }
        }
예제 #11
0
        private void ResetPassword()
        {
            String lcDataBlock;
            String lcQueryName;
            String lcResult;

            if ((!String.IsNullOrWhiteSpace(lcQueryName = ApplicationFrame.GetParameter(ctARGParameter))) &&
                (!String.IsNullOrWhiteSpace(lcDataBlock = ApplicationFrame.GetParameter(ctARGDataBlock))))
            {
                try
                {
                    if ((lcResult = DynamicQueryManager.GetInstance().GetStringResult(DynamicQueryManager.ExecuteMode.Scalar, lcQueryName, General.Base64Decode(lcDataBlock))) != null)
                    {
                        clServiceResponse.AddResponse(CobraServiceResponse.RSP_Result.ToString(), lcResult);
                        clServiceResponse.Success = true;
                    }
                }
                catch (Exception paException)
                {
                    if (paException.InnerException != null)
                    {
                        TranslateException(paException.InnerException);
                    }
                }
            }
        }