Example #1
0
        void IAleConnectionObserver.OnAleUserDataArrival(byte[] aleUserData)
        {
            try
            {
                var maslFrame = MaslFrame.Parse(aleUserData, 0, aleUserData.Length - 1);

                if (maslFrame.FrameType == MaslFrameType.AU1)
                {
                    LogUtility.Info(string.Format("{0}: Masl层当前状态{1},处理AU1。",
                                                  _rsspEndPoint.ID, _currentState.GetType().Name));

                    _currentState.HandleAu1Frame(maslFrame as MaslAu1Frame);
                }
                else if (maslFrame.FrameType == MaslFrameType.AU2)
                {
                    LogUtility.Info(string.Format("{0}: Masl层当前状态{1},处理AU2。",
                                                  _rsspEndPoint.ID, _currentState.GetType().Name));

                    _currentState.HandleAu2Frame(maslFrame as MaslAu2Frame);
                }
                else if (maslFrame.FrameType == MaslFrameType.AU3)
                {
                    LogUtility.Info(string.Format("{0}: Masl层当前状态{1},处理AU3。",
                                                  _rsspEndPoint.ID, _currentState.GetType().Name));

                    _currentState.HandleAu3Frame(maslFrame as MaslAu3Frame);
                }
                else if (maslFrame.FrameType == MaslFrameType.AR)
                {
                    LogUtility.Info(string.Format("{0}: Masl层当前状态{1},处理AR。",
                                                  _rsspEndPoint.ID, _currentState.GetType().Name));

                    _currentState.HandleArFrame(maslFrame as MaslArFrame);
                }
                else if (maslFrame.FrameType == MaslFrameType.DT)
                {
                    if (!(_currentState is MaslConnectedState))
                    {
                        LogUtility.Error(string.Format("{0}: Masl层当前状态{1},处理DT。",
                                                       _rsspEndPoint.ID, _currentState.GetType().Name));
                    }

                    _currentState.HandleDtFrame(maslFrame as MaslDtFrame);
                }
                else if (maslFrame.FrameType == MaslFrameType.DI)
                {
                    LogUtility.Info(string.Format("{0}: Masl层当前状态{1},处理DI。",
                                                  _rsspEndPoint.ID, _currentState.GetType().Name));

                    _currentState  = this.GetInitialState();
                    this.Connected = false;

                    //_currentState.HandleDiFrame(maslFrame as MaslDiFrame);
                }
            }
            catch (MaslException ex)
            {
                this.Disconnect(ex.MajorReason, ex.MinorReason);
                LogUtility.Error(ex.ToString());
            }
            catch (Exception ex)
            {
                this.Disconnect(MaslErrorCode.NotDefined, 0);
                LogUtility.Error(ex.ToString());
            }
        }
Example #2
0
        /// <summary>
        /// Makes the HTTP request (Sync).
        /// </summary>
        /// <param name="path">URL path.</param>
        /// <param name="method">HTTP method.</param>
        /// <param name="queryParams">Query parameters.</param>
        /// <param name="postBody">HTTP body (POST request).</param>
        /// <param name="headerParams">Header parameters.</param>
        /// <param name="formParams">Form parameters.</param>
        /// <param name="fileParams">File parameters.</param>
        /// <param name="pathParams">Path parameters.</param>
        /// <param name="contentType">Content Type of the request</param>
        /// <returns>Object</returns>
        public object CallApi(
            string path, Method method, Dictionary <string, string> queryParams, object postBody,
            Dictionary <string, string> headerParams, Dictionary <string, string> formParams,
            Dictionary <string, FileParameter> fileParams, Dictionary <string, string> pathParams,
            string contentType)
        {
            //declared separately to handle both regular call and download file calls
            int httpResponseStatusCode;
            IList <Parameter> httpResponseHeaders = null;
            string            httpResponseData    = string.Empty;

            LogUtility logUtility = new LogUtility();

            var response = new RestResponse();

            if (!string.IsNullOrEmpty(AcceptHeader))
            {
                var defaultAcceptHeader = "," + headerParams["Accept"];
                defaultAcceptHeader = AcceptHeader + defaultAcceptHeader.Replace("," + AcceptHeader, "");
                headerParams.Remove("Accept");
                headerParams.Add("Accept", defaultAcceptHeader);
            }

            //check if the Response is to be downloaded as a file, this value to be set by the calling API class
            if (string.IsNullOrEmpty(DownloadResponseFileName))
            {
                var request = PrepareRequest(
                    path, method, queryParams, postBody, headerParams, formParams, fileParams,
                    pathParams, contentType);

                // set timeout
                RestClient.Timeout = Configuration.Timeout;
                // set user agent
                RestClient.UserAgent = Configuration.UserAgent;

                RestClient.ClearHandlers();

                if (Configuration.Proxy != null)
                {
                    RestClient.Proxy = Configuration.Proxy;
                }

                // Adding Client Cert
                if (Configuration.MerchantConfigDictionaryObj.ContainsKey("enableClientCert") && Equals(bool.Parse(Configuration.MerchantConfigDictionaryObj["enableClientCert"]), true))
                {
                    string clientCertDirectory = Configuration.MerchantConfigDictionaryObj["clientCertDirectory"];
                    string clientCertFile      = Configuration.MerchantConfigDictionaryObj["clientCertFile"];
                    string clientCertPassword  = Configuration.MerchantConfigDictionaryObj["clientCertPassword"];
                    string fileName            = Path.Combine(clientCertDirectory, clientCertFile);
                    // Importing Certificates
                    var certificate = new X509Certificate2(fileName, clientCertPassword);
                    RestClient.ClientCertificates = new X509CertificateCollection {
                        certificate
                    };
                }

                // Logging Request Headers
                var headerPrintOutput = new StringBuilder();
                foreach (var param in request.Parameters)
                {
                    if (param.Type.ToString().Equals("HttpHeader"))
                    {
                        headerPrintOutput.Append($"{param.Name} : {param.Value}\n");
                    }
                }

                if (logUtility.IsMaskingEnabled(logger))
                {
                    logger.Debug($"HTTP Request Headers :\n{logUtility.MaskSensitiveData(headerPrintOutput.ToString())}");
                }
                else
                {
                    logger.Debug($"HTTP Request Headers :\n{headerPrintOutput}");
                }

                InterceptRequest(request);
                response = (RestResponse)RestClient.Execute(request);
                InterceptResponse(request, response);
            }
            else
            {
                //prepare a HttpWebRequest request object
                var requestT = PrepareHttpWebRequest(path, method, queryParams, postBody, headerParams, formParams, fileParams, pathParams, contentType);

                // Logging Request Headers
                var headerPrintOutput = new StringBuilder();

                foreach (var headerKey in requestT.Headers.AllKeys)
                {
                    var stringBuilder = new StringBuilder();
                    stringBuilder.Append($"{headerKey} : ");

                    foreach (var value in requestT.Headers.GetValues(headerKey))
                    {
                        stringBuilder.Append($"{value}, ");
                    }

                    headerPrintOutput.Append($"{stringBuilder.ToString().Remove(stringBuilder.Length - 2)}\n");
                }

                if (logUtility.IsMaskingEnabled(logger))
                {
                    logger.Debug($"HTTP Request Headers :\n{logUtility.MaskSensitiveData(headerPrintOutput.ToString())}");
                }
                else
                {
                    logger.Debug($"HTTP Request Headers :\n{headerPrintOutput.ToString()}");
                }

                //getting the response stream using httpwebrequest
                HttpWebResponse responseT = (HttpWebResponse)requestT.GetResponse();
                using (Stream responseStream = responseT.GetResponseStream())
                {
                    try
                    {
                        //setting high timeout to accomodate large files till 2GB, need to revisit for a dynamic approach
                        responseStream.ReadTimeout  = 8000000;
                        responseStream.WriteTimeout = 9000000;
                        using (Stream fileStream = File.OpenWrite(DownloadResponseFileName))
                        {
                            byte[] buffer    = new byte[4096];
                            int    bytesRead = responseStream.Read(buffer, 0, 4096);
                            while (bytesRead > 0)
                            {
                                fileStream.Write(buffer, 0, bytesRead);
                                bytesRead = responseStream.Read(buffer, 0, 4096);
                            }
                        }
                    }
                    catch (Exception err)
                    {
                        logger.Error($"ApiException : Error writing to path {DownloadResponseFileName}");
                        throw new ApiException(-1, $"Error writing to path : {DownloadResponseFileName}");
                    }
                }

                //setting the generic response with response headers
                foreach (var header in responseT.Headers)
                {
                    response.Headers.Add(new Parameter(header.ToString(), string.Join(",", responseT.Headers.GetValues(header.ToString()).ToArray()), ParameterType.HttpHeader));
                }

                //setting the generic RestResponse which is returned to the calling class
                response.StatusCode = responseT.StatusCode;
                if (responseT.StatusCode == HttpStatusCode.OK)
                {
                    response.Content = "Custom Message: Response downloaded to file " + DownloadResponseFileName;
                }
                else if (responseT.StatusCode == HttpStatusCode.NotFound)
                {
                    response.Content = "Custom Message: The requested resource is not found. Please try again later.";
                }
                else
                {
                    response.Content = responseT.StatusDescription;
                }
            }

            Configuration.DefaultHeader.Clear();

            // Logging Response Headers
            httpResponseStatusCode = (int)response.StatusCode;
            httpResponseHeaders    = response.Headers;
            httpResponseData       = response.Content;

            logger.Debug($"HTTP Response Status Code: {httpResponseStatusCode}");

            var responseHeadersBuilder = new StringBuilder();

            foreach (var header in httpResponseHeaders)
            {
                responseHeadersBuilder.Append($"{header}\n");
            }

            if (logUtility.IsMaskingEnabled(logger))
            {
                logger.Debug($"HTTP Response Headers :\n{logUtility.MaskSensitiveData(responseHeadersBuilder.ToString())}");
            }
            else
            {
                logger.Debug($"HTTP Response Headers :\n{responseHeadersBuilder.ToString()}");
            }

            if (!string.IsNullOrEmpty(httpResponseData))
            {
                if (logUtility.IsMaskingEnabled(logger))
                {
                    logger.Debug($"HTTP Response Body :\n{logUtility.MaskSensitiveData(httpResponseData)}");
                }
                else
                {
                    logger.Debug($"HTTP Response Body :\n{httpResponseData}");
                }
            }

            return(response);
        }
 public void Error(Exception x)
 {
     Error(LogUtility.BuildExceptionMessage(x));
 }
Example #4
0
    protected void InitializeColumnData(ref DataTable dt)
    {
        try
        {
            string displayName = string.Empty, groupName = string.Empty;
            bool   blnVisible = false, blnSortable = false, blnOrderable = false;

            foreach (DataColumn gridColumn in dt.Columns)
            {
                displayName  = gridColumn.ColumnName;
                blnVisible   = false;
                blnSortable  = false;
                blnOrderable = false;
                groupName    = string.Empty;

                switch (gridColumn.ColumnName)
                {
                case "X":
                    displayName = "&nbsp;";
                    blnVisible  = true;
                    break;

                case "PRIORITYTYPE":
                    displayName = "Priority Type";
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "Priority":
                    displayName = "Priority";
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "DESCRIPTION":
                    displayName = "Description";
                    blnVisible  = true;
                    break;

                //case "WorkRequest_Count":
                //	displayName = "Work Requests";
                //	blnVisible = true;
                //	blnSortable = true;
                //	break;
                case "WorkItem_Count":
                    displayName = "Primary Tasks";
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "SORT_ORDER":
                    displayName = "Sort Order";
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "ARCHIVE":
                    displayName = "Archive";
                    blnVisible  = true;
                    blnSortable = true;
                    break;
                }

                columnData.Columns.Add(gridColumn.ColumnName, displayName, blnVisible, blnSortable);
                columnData.Columns.Item(columnData.Columns.Count - 1).CanReorder = blnOrderable;
            }

            //Initialize the columnData
            columnData.Initialize(ref dt, ";", "~", "|");

            //Get sortable columns and default column order
            SortableColumns    = columnData.SortableColumnsToString();
            DefaultColumnOrder = columnData.DefaultColumnOrderToString();
            //Sort and Reorder Columns
            columnData.ReorderDataTable(ref dt, ColumnOrder);
            columnData.SortDataTable(ref dt, SortOrder);
            SelectedColumnOrder = columnData.CurrentColumnOrderToString();
        }
        catch (Exception ex)
        {
            LogUtility.LogException(ex);
        }
    }
Example #5
0
    protected void InitializeColumnData(ref DataTable dt)
    {
        try
        {
            string displayName = string.Empty, groupName = string.Empty;
            bool   blnVisible = false, blnSortable = false, blnOrderable = false;

            foreach (DataColumn gridColumn in dt.Columns)
            {
                displayName  = gridColumn.ColumnName;
                blnVisible   = false;
                blnSortable  = false;
                blnOrderable = false;
                groupName    = string.Empty;

                switch (gridColumn.ColumnName)
                {
                case "X":
                    blnVisible = true;
                    break;

                case "WORKITEMTYPEID":
                    blnVisible  = false;
                    blnSortable = false;
                    break;

                case "WORKITEMTYPE":
                    blnVisible  = false;
                    blnSortable = false;
                    break;

                case "STATUSID":
                    blnVisible  = false;
                    blnSortable = false;
                    break;

                case "STATUS":
                    displayName = "Status";
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "DESCRIPTION":
                    displayName = "Description";
                    blnVisible  = true;
                    break;

                case "ARCHIVE":
                    displayName = "Archive";
                    blnVisible  = true;
                    blnSortable = true;
                    break;
                }

                columnData.Columns.Add(gridColumn.ColumnName, displayName, blnVisible, blnSortable);
                columnData.Columns.Item(columnData.Columns.Count - 1).CanReorder = blnOrderable;
            }

            //Initialize the columnData
            columnData.Initialize(ref dt, ";", "~", "|");

            //Get sortable columns and default column order
            SortableColumns    = columnData.SortableColumnsToString();
            DefaultColumnOrder = columnData.DefaultColumnOrderToString();
            //Sort and Reorder Columns
            columnData.ReorderDataTable(ref dt, ColumnOrder);
            columnData.SortDataTable(ref dt, SortOrder);
            SelectedColumnOrder = columnData.CurrentColumnOrderToString();
        }
        catch (Exception ex)
        {
            LogUtility.LogException(ex);
        }
    }
        public void MultipartUploadPartCopyComplexStepTest()
        {
            //get target object name
            var targetObjectKey = OssTestUtils.GetObjectKey(_className);

            var initRequest = new InitiateMultipartUploadRequest(_bucketName, targetObjectKey);
            var initResult  = _ossClient.InitiateMultipartUpload(initRequest);

            // 设置每块为 512K
            const int partSize = 1024 * 512 * 1;

            var sourceObjectMeta = _ossClient.GetObjectMetadata(_bucketName, _sourceObjectKey);
            // 计算分块数目
            var partCount = OssTestUtils.CalculatePartCount(sourceObjectMeta.ContentLength, partSize);

            LogUtility.LogMessage("Object {0} is splitted to {1} parts for multipart upload part copy",
                                  _sourceObjectKey, partCount);

            // 新建一个List保存每个分块上传后的ETag和PartNumber
            var partETags = new List <PartETag>();

            for (var i = 0; i < partCount; i++)
            {
                // 跳到每个分块的开头
                long skipBytes = partSize * i;

                // 计算每个分块的大小
                var size = partSize < sourceObjectMeta.ContentLength - skipBytes
                    ? partSize
                    : sourceObjectMeta.ContentLength - skipBytes;

                // 创建UploadPartRequest,上传分块
                var uploadPartCopyRequest =
                    new UploadPartCopyRequest(_bucketName, targetObjectKey, _bucketName, _sourceObjectKey, initResult.UploadId)
                {
                    BeginIndex = skipBytes,
                    PartSize   = size,
                    PartNumber = (i + 1),
                    ModifiedSinceConstraint = DateTime.Now.AddDays(-1)
                };
                uploadPartCopyRequest.MatchingETagConstraints.Add(_objectETag);
                var uploadPartCopyResult = _ossClient.UploadPartCopy(uploadPartCopyRequest);

                // 将返回的PartETag保存到List中。
                partETags.Add(uploadPartCopyResult.PartETag);
            }

            var lmuRequest = new ListMultipartUploadsRequest(_bucketName);
            var lmuListing = _ossClient.ListMultipartUploads(lmuRequest);

            string mpUpload = null;

            foreach (var t in lmuListing.MultipartUploads)
            {
                if (t.UploadId == initResult.UploadId)
                {
                    mpUpload = t.UploadId;
                    break;
                }
            }

            Assert.IsNotNull(mpUpload, "The multipart uploading should be in progress");

            var completeRequest = new CompleteMultipartUploadRequest(_bucketName, targetObjectKey, initResult.UploadId);

            foreach (var partETag in partETags)
            {
                completeRequest.PartETags.Add(partETag);
            }
            _ossClient.CompleteMultipartUpload(completeRequest);

            Assert.IsTrue(OssTestUtils.ObjectExists(_ossClient, _bucketName, targetObjectKey));

            //delete the object
            _ossClient.DeleteObject(_bucketName, targetObjectKey);
        }
Example #7
0
        ///<summary>    Reads the kilometers. </summary>
        ///<remarks>    Amartinez, 19/05/2017. </remarks>
        ///<param name="pstrPath">  Full pathname of the pstr file. </param>

        public static List <KilometersTraveled> ReadKilometers(string pstrPath)
        {
            string lStrline;
            List <KilometersTraveled> lListKilometersTraveled = new List <KilometersTraveled>();

            using (var lObjfile = File.OpenRead(pstrPath))
                using (var lObjreader = new StreamReader(lObjfile))
                {
                    lStrline = lObjreader.ReadLine();
                    try
                    {
                        Console.Write("Verificando archivo KMrecorridos: " + Path.GetFileName(pstrPath));
                        while (!lObjreader.EndOfStream)
                        {
                            lStrline = lObjreader.ReadLine();
                            KilometersTraveled lobjKilometesTraveled = new KilometersTraveled();
                            var lArrValues = lStrline.Split(',');

                            if (string.IsNullOrEmpty(lArrValues[1].Trim())) //Verifica salto de linea
                            {
                                //lArrValues[0] = lArrValues[0].Replace("\"", "");
                                //lArrValues[0] = lArrValues[0].Replace("\\", "");
                                //lobjKilometesTraveled.Name = lArrValues[0];
                                lStrline = lObjreader.ReadLine();// Salto de linea de archivo
                                //lStrline = lStrline.Replace("\"", "");
                                //lStrline = lStrline.Replace("\\", "");
                                lStrline   = lStrline.Replace("<br>", "");
                                lArrValues = lStrline.Split(new[] { "\",\"" }, StringSplitOptions.None);
                            }
                            var lArrValuesNew = lStrline.Split(new[] { "," }, StringSplitOptions.None);

                            string        lStrDir1    = string.Empty;
                            List <string> lListString = new List <string>();
                            int           lIntInicio  = 0;
                            for (int i = 0; i < lArrValuesNew.Length; i++)
                            {
                                if (lIntInicio == 0)
                                {
                                    if (lArrValuesNew[i].Contains("\""))
                                    {
                                        lStrDir1 += lArrValuesNew[i];
                                        lIntInicio++;
                                    }
                                    else
                                    {
                                        lListString.Add(lArrValuesNew[i].Replace("\"", ""));
                                    }
                                }
                                else
                                {
                                    if (lIntInicio == 1)
                                    {
                                        if (lArrValuesNew[i].Contains("\""))
                                        {
                                            lStrDir1  += lArrValuesNew[i];
                                            lIntInicio = 0;
                                            lListString.Add(lStrDir1.Replace("\"", ""));
                                            lStrDir1 = string.Empty;
                                        }
                                        else
                                        {
                                            lStrDir1 += ", " + lArrValuesNew[i];
                                        }
                                    }
                                }
                            }
                            if (!string.IsNullOrEmpty(lStrDir1))
                            {
                                lListString.Add(lStrDir1.Replace("\"", ""));
                            }

                            var lArrDir = lStrline.Split(new[] { "\"" }, StringSplitOptions.RemoveEmptyEntries);
                            lArrValues[0] = lArrValues[0].Replace("\"", "");
                            lobjKilometesTraveled.Name = lListString[0];
                            var fecha = DateTime.Parse(lListString[1]);
                            lobjKilometesTraveled.FromDate      = DateTime.Parse(lListString[1]);
                            lobjKilometesTraveled.FromAddress   = lListString[2];
                            lobjKilometesTraveled.ToDate        = DateTime.Parse(lListString[3]);
                            lobjKilometesTraveled.ToAddress     = lListString[4];
                            lobjKilometesTraveled.Distance      = float.Parse(lListString[5]);
                            lobjKilometesTraveled.Duration      = lListString[6];
                            lobjKilometesTraveled.MaxVelocity   = lListString[7];
                            lobjKilometesTraveled.OdometerStart = float.Parse(lListString[8]);
                            lobjKilometesTraveled.OdometerEnd   = float.Parse(lListString[9]);
                            if (lListString[10] == "-")
                            {
                                lobjKilometesTraveled.MotorHours = 0;//Convert.ToInt32(lArrValues[10]);
                            }
                            else
                            {
                                lobjKilometesTraveled.MotorHours = Convert.ToInt32(lListString[10]);
                            }
                            lListKilometersTraveled.Add(lobjKilometesTraveled);
                        }
                        Console.WriteLine("OK");
                    }
                    catch (Exception e)
                    {
                        LogUtility.Write(e.Message + " En archivo: " + Path.GetFileName(pstrPath));
                        Console.WriteLine(e.Message);
                    }
                    return(lListKilometersTraveled);
                }
        }
Example #8
0
 public static void WriteError(string pStrMessage)
 {
     LogUtility.Write(string.Format("[ERROR] {0}", pStrMessage));
 }
    protected void InitializeColumnData(ref DataTable dt)
    {
        try
        {
            string displayName = string.Empty, groupName = string.Empty;
            bool   blnVisible = false, blnSortable = false, blnOrderable = false;

            foreach (DataColumn gridColumn in dt.Columns)
            {
                displayName  = gridColumn.ColumnName;
                blnVisible   = false;
                blnSortable  = false;
                blnOrderable = false;
                groupName    = string.Empty;

                switch (gridColumn.ColumnName)
                {
                case "X":
                    blnVisible = true;
                    break;

                case "ProductVersionID":
                    blnVisible = false;
                    break;

                case "ProductVersion":
                    displayName = "Product Version";
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "Description":
                    displayName = "Description";
                    blnVisible  = true;
                    break;

                case "CONTRACTID":
                    blnVisible = false;
                    break;

                case "CONTRACT":
                    displayName = "Contract";
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "NarrativeDescription":
                    displayName = "CR Report Narrative";
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "WorkloadAllocationType":
                    displayName = "Workload Allocation Type";
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "ImageID":
                    displayName = "Image";
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "Archive":
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "Y":
                    blnVisible = true;
                    break;
                }

                columnData.Columns.Add(gridColumn.ColumnName, displayName, blnVisible, blnSortable);
                columnData.Columns.Item(columnData.Columns.Count - 1).CanReorder = blnOrderable;
            }

            //Initialize the columnData
            columnData.Initialize(ref dt, ";", "~", "|");

            //Get sortable columns and default column order
            SortableColumns    = columnData.SortableColumnsToString();
            DefaultColumnOrder = columnData.DefaultColumnOrderToString();
            //Sort and Reorder Columns
            columnData.ReorderDataTable(ref dt, ColumnOrder);
            columnData.SortDataTable(ref dt, SortOrder);
            SelectedColumnOrder = columnData.CurrentColumnOrderToString();
        }
        catch (Exception ex)
        {
            LogUtility.LogException(ex);
        }
    }
    GridViewRow createChildRow(string itemId = "")
    {
        GridViewRow row       = new GridViewRow(0, 0, DataControlRowType.DataRow, DataControlRowState.Selected);
        TableCell   tableCell = null;

        try
        {
            row.CssClass         = "gridBody";
            row.Style["display"] = "none";
            row.ID = string.Format("gridChild_{0}", itemId);
            if (_currentLevel == 0)
            {
                row.Attributes.Add("ProductVersionID", itemId);
            }
            else if (_currentLevel == 1)
            {
                row.Attributes.Add("CONTRACTID", itemId);
            }
            else if (_currentLevel == 2)
            {
                row.Attributes.Add("NarrativeID", itemId);
            }

            row.Attributes.Add("Name", string.Format("gridChild_{0}", itemId));

            //add the table cells
            for (int i = 0; i < DCC.Count; i++)
            {
                tableCell      = new TableCell();
                tableCell.Text = "&nbsp;";

                if (_currentLevel == 0)
                {
                    if (i == DCC["X"].Ordinal)
                    {
                        //set width to match parent
                        tableCell.Style["width"]        = "32px";
                        tableCell.Style["border-right"] = "1px solid transparent";
                    }
                    else if (i == DCC["ProductVersion"].Ordinal)
                    {
                        tableCell.Style["padding-top"]    = "10px";
                        tableCell.Style["padding-right"]  = "10px";
                        tableCell.Style["padding-bottom"] = "0px";
                        tableCell.Style["padding-left"]   = "0px";
                        tableCell.Style["vertical-align"] = "top";
                        tableCell.ColumnSpan = DCC.Count - 1;
                        //add the frame here
                        tableCell.Controls.Add(createChildFrame(itemId: itemId));
                    }
                    else
                    {
                        tableCell.Style["display"] = "none";
                    }
                }
                else
                {
                    if (i == DCC["X"].Ordinal)
                    {
                        //set width to match parent
                        tableCell.Style["width"]        = "32px";
                        tableCell.Style["border-right"] = "1px solid transparent";
                    }
                    else if (i == DCC["CONTRACT"].Ordinal)
                    {
                        tableCell.Style["padding-top"]    = "10px";
                        tableCell.Style["padding-right"]  = "10px";
                        tableCell.Style["padding-bottom"] = "0px";
                        tableCell.Style["padding-left"]   = "0px";
                        tableCell.Style["vertical-align"] = "top";
                        tableCell.ColumnSpan = DCC.Count - 1;
                        //add the frame here
                        tableCell.Controls.Add(createChildFrame(itemId: itemId));
                    }
                    else
                    {
                        tableCell.Style["display"] = "none";
                    }
                }

                row.Cells.Add(tableCell);
            }
        }
        catch (Exception ex)
        {
            LogUtility.LogException(ex);
            row = null;
        }

        return(row);
    }
    public static string DeleteItem(int itemId, int contractID, int productVersionID)
    {
        Dictionary <string, string> result = new Dictionary <string, string>()
        {
            { "id", itemId.ToString() }
            , { "exists", "" }
            , { "deleted", "" }
            , { "archived", "" }
            , { "error", "" }
        };
        bool   exists = false, deleted = false, archived = false;
        string errorMsg = string.Empty;

        try
        {
            //delete
            if (itemId == 0)
            {
                errorMsg = "You must specify an item to delete.";
            }
            else if (itemId == -1)
            {
                DataTable dt = MasterData.NarrativeList_Get(productVersionID: productVersionID, contractID: contractID);

                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        int.TryParse(dr["NarrativeID"].ToString(), out itemId);
                        deleted = MasterData.Narrative_Delete(itemId, out exists, out archived, out errorMsg);
                    }
                }
            }
            else
            {
                if (productVersionID > 0)
                {
                    deleted = MasterData.Narrative_Delete(itemId, out exists, out archived, out errorMsg);
                }
                else
                {
                    DataTable dt = MasterData.NarrativeList_Get(productVersionID: itemId);

                    if (dt != null && dt.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            int.TryParse(dr["NarrativeID"].ToString(), out itemId);
                            deleted = MasterData.Narrative_Delete(itemId, out exists, out archived, out errorMsg);
                        }
                    }
                }

                //deleted = MasterData.Narrative_Delete(0, "", itemId, out exists, out archived, out errorMsg);
            }
        }
        catch (Exception ex)
        {
            LogUtility.LogException(ex);
            deleted  = false;
            errorMsg = ex.Message;
        }

        result["exists"]   = exists.ToString();
        result["deleted"]  = deleted.ToString();
        result["archived"] = archived.ToString();
        result["error"]    = errorMsg;

        return(JsonConvert.SerializeObject(result, Formatting.None));
    }
    public static string Copy(int oldReleaseID, string newReleaseID, int contractID)
    {
        Dictionary <string, string> result = new Dictionary <string, string>()
        {
            { "saved", "" }, { "ids", "" }, { "error", "" }
        };
        bool   exists = false, saved = false;
        int    newID    = 0;
        string errorMsg = string.Empty;

        int    newRelease_ID;
        string missionNarrative = string.Empty, programMGMTNarrative = string.Empty, deploymentNarrative = string.Empty, productionNarrative = string.Empty;
        int    missionImageID = 0, programMGMTImageID = 0, deploymentImageID = 0, productionImageID = 0;

        int.TryParse(newReleaseID.ToString(), out newRelease_ID);

        try
        {
            DataTable dt = MasterData.NarrativeList_Get(productVersionID: oldReleaseID, contractID: contractID);

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    switch (dr["WorkloadAllocationType"].ToString())
                    {
                    case "Mission":
                        missionNarrative = dr["NarrativeDescription"].ToString();
                        int.TryParse(dr["ImageID"].ToString(), out missionImageID);
                        break;

                    case "Program MGMT":
                        programMGMTNarrative = dr["NarrativeDescription"].ToString();
                        int.TryParse(dr["ImageID"].ToString(), out programMGMTImageID);
                        break;

                    case "Deployment":
                        deploymentNarrative = dr["NarrativeDescription"].ToString();
                        int.TryParse(dr["ImageID"].ToString(), out deploymentImageID);
                        break;

                    case "Production":
                        productionNarrative = dr["NarrativeDescription"].ToString();
                        int.TryParse(dr["ImageID"].ToString(), out productionImageID);
                        break;
                    }
                }
                saved = MasterData.Narrative_Add(
                    newRelease_ID, contractID,
                    0, missionNarrative, missionImageID,
                    0, programMGMTNarrative, programMGMTImageID,
                    0, deploymentNarrative, deploymentImageID,
                    0, productionNarrative, productionImageID,
                    false, out exists, out newID, out errorMsg);
            }
        }
        catch (Exception ex)
        {
            LogUtility.LogException(ex);
            result["error"] = ex.Message;
        }

        result["exists"] = exists.ToString();
        result["saved"]  = saved.ToString();
        result["error"]  = errorMsg;

        return(JsonConvert.SerializeObject(result, Formatting.None));
    }
        public void TestDisableCrc()
        {
            Common.ClientConfiguration config = new Common.ClientConfiguration();
            config.EnableCrcCheck = false;
            IOss ossClient  = OssClientFactory.CreateOssClient(config);
            var  targetFile = OssTestUtils.GetTargetFileName(_className);

            targetFile = Path.Combine(Config.DownloadFolder, targetFile);
            var objectKeyName = "test-object-disable-crc";

            try
            {
                // put & get
                PutObjectResult putObjectResult = ossClient.PutObject(_bucketName, objectKeyName, Config.UploadTestFile);
                var             actualCrc       = putObjectResult.ResponseMetadata[HttpHeaders.HashCrc64Ecma];

                OssObject ossObject   = ossClient.GetObject(_bucketName, objectKeyName);
                var       expectedCrc = OssUtils.ComputeContentCrc64(ossObject.Content, ossObject.ContentLength);

                Assert.AreEqual(expectedCrc, actualCrc);
                ossClient.DeleteObject(_bucketName, objectKeyName);

                // put & get by uri
                var testStr    = FileUtils.GenerateOneKb();
                var content    = Encoding.ASCII.GetBytes(testStr);
                var now        = DateTime.Now;
                var expireDate = now.AddSeconds(120);
                var uri        = _ossClient.GeneratePresignedUri(_bucketName, objectKeyName, expireDate, SignHttpMethod.Put);
                var putResult  = ossClient.PutObject(uri, new MemoryStream(content));

                expectedCrc = putResult.ResponseMetadata[HttpHeaders.HashCrc64Ecma];
                actualCrc   = OssUtils.ComputeContentCrc64(new MemoryStream(content), content.Length);
                Assert.AreEqual(expectedCrc, actualCrc);

                uri         = _ossClient.GeneratePresignedUri(_bucketName, objectKeyName, expireDate, SignHttpMethod.Get);
                ossObject   = ossClient.GetObject(uri);
                expectedCrc = OssUtils.ComputeContentCrc64(ossObject.Content, ossObject.ContentLength);

                Assert.AreEqual(expectedCrc, actualCrc);
                ossClient.DeleteObject(_bucketName, objectKeyName);

                // upload & download
                var uploadObjectResult = ossClient.ResumableUploadObject(_bucketName, objectKeyName, Config.MultiUploadTestFile, null,
                                                                         Config.DownloadFolder);
                actualCrc = uploadObjectResult.ResponseMetadata[HttpHeaders.HashCrc64Ecma];

                DownloadObjectRequest downloadObjectRequest = new DownloadObjectRequest(_bucketName, objectKeyName, targetFile);
                var metadata = ossClient.ResumableDownloadObject(downloadObjectRequest);

                Assert.AreEqual(metadata.Crc64, actualCrc);
                ossClient.DeleteObject(_bucketName, objectKeyName);

                // append
                using (var fs = File.Open(Config.UploadTestFile, FileMode.Open))
                {
                    var fileLength          = fs.Length;
                    var appendObjectRequest = new AppendObjectRequest(_bucketName, objectKeyName)
                    {
                        Content = fs,
                    };
                    var appendObjectResult = _ossClient.AppendObject(appendObjectRequest);
                    fs.Seek(0, SeekOrigin.Begin);
                    actualCrc = OssUtils.ComputeContentCrc64(fs, fs.Length);
                    Assert.AreEqual(appendObjectResult.HashCrc64Ecma.ToString(), actualCrc);
                    ossClient.DeleteObject(_bucketName, objectKeyName);
                }
            }
            finally
            {
                try
                {
                    FileUtils.DeleteFile(targetFile);
                }
                catch (Exception e)
                {
                    LogUtility.LogWarning("Delete file {0} failed with Exception {1}", targetFile, e.Message);
                }
            }
        }
    public static string SaveChanges(int parentID, string rows)
    {
        Dictionary <string, string> result = new Dictionary <string, string>()
        {
            { "saved", "" }, { "ids", "" }, { "error", "" }
        };
        bool   exists = false, saved = false;
        string ids = string.Empty, errorMsg = string.Empty, tempMsg = string.Empty;

        try
        {
            DataTable dtjson = (DataTable)JsonConvert.DeserializeObject(rows, (typeof(DataTable)));
            if (dtjson.Rows.Count == 0)
            {
                errorMsg = "Unable to save. An invalid list of changes was provided.";
                saved    = false;
            }

            int    id = 0, categoryId = 0, sortOrder = 0, archive = 0;
            int    assignedToID = 0, smeID = 0, busResourceID = 0, techResourceID = 0;
            string allocation = string.Empty, description = string.Empty;

            HttpServerUtility server = HttpContext.Current.Server;
            //save
            foreach (DataRow dr in dtjson.Rows)
            {
                id           = categoryId = sortOrder = archive = 0;
                assignedToID = smeID = busResourceID = techResourceID = 0;
                allocation   = description = string.Empty;

                tempMsg = string.Empty;
                int.TryParse(dr["ALLOCATIONID"].ToString(), out id);
                allocation  = server.UrlDecode(dr["ALLOCATION"].ToString());
                description = server.UrlDecode(dr["DESCRIPTION"].ToString());
                int.TryParse(dr["SORT_ORDER"].ToString(), out sortOrder);
                int.TryParse(dr["ARCHIVE"].ToString(), out archive);
                int.TryParse(dr["DefaultAssignedTo"].ToString(), out assignedToID);
                int.TryParse(dr["DefaultSME"].ToString(), out smeID);
                int.TryParse(dr["DefaultBusinessResource"].ToString(), out busResourceID);
                int.TryParse(dr["DefaultTechnicalResource"].ToString(), out techResourceID);

                if (string.IsNullOrWhiteSpace(allocation))
                {
                    tempMsg = "You must specify a value for Allocation.";
                    saved   = false;
                }
                else
                {
                    if (id == 0)
                    {
                        exists = false;
                        saved  = MasterData.AllocationGroup_Assignment_Add(allocationID: allocation, description: description, sortOrder: sortOrder, archive: archive == 1,
                                                                           defaultSMEID: smeID, defaultBusinessResourceID: busResourceID, defaultTechnicalResourceID: techResourceID, defaultAssignedToID: assignedToID,
                                                                           AllocationGroupID: parentID, exists: out exists, newID: out id, errorMsg: out tempMsg);
                        if (exists)
                        {
                            saved   = false;
                            tempMsg = string.Format("{0}{1}{2}", tempMsg, tempMsg.Length > 0 ? Environment.NewLine : "", "Cannot add duplicate Allocation record [" + allocation + "].");
                        }
                    }
                    else
                    {
                        saved = MasterData.AllocationGroup_Assignment_Update(id, allocation: allocation, description: description, sortOrder: sortOrder, archive: archive == 1, defaultSMEID: smeID, defaultAssignedToID: assignedToID, defaultBusinessResourceID: busResourceID, defaultTechnicalResourceID: techResourceID, errorMsg: out tempMsg);
                    }
                }

                if (saved)
                {
                    ids += string.Format("{0}{1}", ids.Length > 0 ? "," : "", id.ToString());
                }

                if (tempMsg.Length > 0)
                {
                    errorMsg = string.Format("{0}{1}{2}", errorMsg, errorMsg.Length > 0 ? Environment.NewLine : "", tempMsg);
                }
            }
        }
        catch (Exception ex)
        {
            saved    = false;
            errorMsg = ex.Message;
            LogUtility.LogException(ex);
        }

        result["ids"]   = ids;
        result["saved"] = saved.ToString();
        result["error"] = errorMsg;

        return(JsonConvert.SerializeObject(result, Formatting.None));
    }
        public static bool InserPrintersModels()
        {
            try
            {
                var printerList = new List <PrinterModel>
                {
                    new PrinterModel {
                        Manufacturer = "Bematech", Name = "MP-4200 TH", Model = "7"
                    },
                    new PrinterModel {
                        Manufacturer = "Bematech", Name = "MP-4000 TH", Model = "5"
                    },
                    new PrinterModel {
                        Manufacturer = "Bematech", Name = "MP-2500 TH", Model = "8"
                    },
                    new PrinterModel {
                        Manufacturer = "Bematech", Name = "MP-2100 TH", Model = "0"
                    },
                    new PrinterModel {
                        Manufacturer = "Bematech", Name = "MP-2000 TH", Model = "0"
                    },
                    new PrinterModel {
                        Manufacturer = "Bematech", Name = "MP-2000 CI", Model = "0"
                    },
                    new PrinterModel {
                        Manufacturer = "Bematech", Name = "MP-20 TH", Model = "0"
                    },
                    new PrinterModel {
                        Manufacturer = "Bematech", Name = "MP-20 MI", Model = "1"
                    },
                    new PrinterModel {
                        Manufacturer = "Bematech", Name = "MP-20 CI", Model = "1"
                    },
                    new PrinterModel {
                        Manufacturer = "Epson", Name = "TM-T81+", Model = "TM-T81+"
                    },
                    new PrinterModel {
                        Manufacturer = "Epson", Name = "TM-T88 IV", Model = "TM-T88 IV"
                    },
                    new PrinterModel {
                        Manufacturer = "Epson", Name = "TM-T88 V", Model = "TM-T88 V"
                    },
                    new PrinterModel {
                        Manufacturer = "Epson", Name = "TM-T20", Model = "TM-T20"
                    },
                    new PrinterModel {
                        Manufacturer = "Epson", Name = "TM-T20 II", Model = "TM-T20 II"
                    },
                    new PrinterModel {
                        Manufacturer = "Epson", Name = "TM-T70", Model = "TM-T70"
                    },
                    new PrinterModel {
                        Manufacturer = "Epson", Name = "TM-T70II", Model = "TM-T70II"
                    },
                    new PrinterModel {
                        Manufacturer = "Epson", Name = "TM-P60II", Model = "TM-P60II"
                    },
                    new PrinterModel {
                        Manufacturer = "Epson", Name = "TM-P80", Model = "TM-P80"
                    },
                    new PrinterModel {
                        Manufacturer = "Epson", Name = "TM-P20", Model = "TM-P20"
                    },
                    new PrinterModel {
                        Manufacturer = "Epson", Name = "TM-H6000 III", Model = "TM-H6000 III"
                    },
                    new PrinterModel {
                        Manufacturer = "Epson", Name = "TM-H6000 IV", Model = "TM-H6000 IV"
                    }
                };

                printerList.ForEach(item => PrinterModelController.Instance.Insert(item));

                return(true);
            }
            catch (Exception ex)
            {
                LogUtility.Log(LogUtility.LogType.SystemError, MethodBase.GetCurrentMethod().Name, ex.Message);
                throw;
            }
        }
Example #16
0
 public static void WriteInfo(string pStrMessage)
 {
     LogUtility.Write(string.Format("[INFO] {0}", pStrMessage));
 }
Example #17
0
    public static string SaveChanges(int parentID, string rows)
    {
        Dictionary <string, string> result = new Dictionary <string, string>()
        {
            { "saved", "" }, { "ids", "" }, { "error", "" }
        };
        bool   exists = false, saved = false;
        string ids = string.Empty, errorMsg = string.Empty, tempMsg = string.Empty;

        try
        {
            DataTable dtjson = (DataTable)JsonConvert.DeserializeObject(rows, (typeof(DataTable)));
            if (dtjson.Rows.Count == 0)
            {
                errorMsg = "Unable to save. An invalid list of changes was provided.";
                saved    = false;
            }

            int    id = 0, sortOrder = 0, archive = 0;
            string scope = string.Empty, description = string.Empty;

            HttpServerUtility server = HttpContext.Current.Server;
            //save
            foreach (DataRow dr in dtjson.Rows)
            {
                id          = 0;
                sortOrder   = 0;
                scope       = string.Empty;
                description = string.Empty;
                archive     = 0;

                tempMsg = string.Empty;
                int.TryParse(dr["ALLOCATIONID"].ToString(), out id);
                //scope = server.UrlDecode(dr["Scope"].ToString());
                //description = server.UrlDecode(dr["DESCRIPTION"].ToString());
                //int.TryParse(dr["SORT_ORDER"].ToString(), out sortOrder);
                //int.TryParse(dr["X"].ToString(), out archive);

                saved = MasterData.Allocation_Set_GroupID(id, parentID, out tempMsg);


                if (saved)
                {
                    ids += string.Format("{0}{1}", ids.Length > 0 ? "," : "", id.ToString());
                }

                if (tempMsg.Length > 0)
                {
                    errorMsg = string.Format("{0}{1}{2}", errorMsg, errorMsg.Length > 0 ? Environment.NewLine : "", tempMsg);
                }
            }
        }
        catch (Exception ex)
        {
            LogUtility.LogException(ex);
            saved    = false;
            errorMsg = ex.Message;
        }

        result["saved"] = saved.ToString();
        result["error"] = errorMsg;

        return(JsonConvert.SerializeObject(result, Formatting.None));
    }
Example #18
0
 public static void WriteError(int pIntCode)
 {
     LogUtility.Write(string.Format("[ERROR] Code: {0}\t Message: {1}", pIntCode, DIApplication.Company.GetLastErrorDescription()));
 }
Example #19
0
    protected void InitializeColumnData(ref DataTable dt)
    {
        try
        {
            string displayName = string.Empty, groupName = string.Empty;
            bool   blnVisible = false, blnSortable = false, blnOrderable = false;

            foreach (DataColumn gridColumn in dt.Columns)
            {
                displayName  = gridColumn.ColumnName;
                blnVisible   = false;
                blnSortable  = false;
                blnOrderable = false;
                groupName    = string.Empty;

                switch (gridColumn.ColumnName)
                {
                //case "X":
                //    displayName = "&nbsp;";
                //    blnVisible = true;
                //    break;
                //case "Y":
                //    displayName = "&nbsp;";
                //    blnVisible = true;
                //    break;
                case "NewsID":
                    displayName = "NewsID";
                    blnVisible  = false;
                    blnSortable = false;
                    break;

                case "Start_Date":
                    displayName = "Start Date";
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "End_Date":
                    displayName = "End Date";
                    blnVisible  = true;
                    blnSortable = true;
                    break;
                    //case "Summary":
                    //    displayName = "Summary";
                    //    blnVisible = true;
                    //    blnSortable = true;
                    //    break;
                    //case "NewsType":
                    //    displayName = "Type";
                    //    blnVisible = true;
                    //    blnSortable = true;
                    //    break;
                    //case "Bln_Active":
                    //    displayName = "Active";
                    //    blnVisible = true;
                    //    blnSortable = true;
                    //    break;
                }

                columnData.Columns.Add(gridColumn.ColumnName, displayName, blnVisible, blnSortable);
                columnData.Columns.Item(columnData.Columns.Count - 1).CanReorder = blnOrderable;
            }

            //Initialize the columnData
            columnData.Initialize(ref dt, ";", "~", "|");

            ////Get sortable columns and default column order
            //SortableColumns = columnData.SortableColumnsToString();
            //DefaultColumnOrder = columnData.DefaultColumnOrderToString();
            ////Sort and Reorder Columns
            //columnData.ReorderDataTable(ref dt, ColumnOrder);
            //columnData.SortDataTable(ref dt, SortOrder);
            //SelectedColumnOrder = columnData.CurrentColumnOrderToString();
        }
        catch (Exception ex)
        {
            LogUtility.LogException(ex);
        }
    }
Example #20
0
    public static string SaveChanges(string workItemType_ID, string rows)
    {
        Dictionary <string, string> result = new Dictionary <string, string>()
        {
            { "saved", "0" }
            , { "failed", "0" }
            , { "savedIds", "" }
            , { "failedIds", "" }
            , { "error", "" }
        };
        bool   exists = false, saved = false;
        int    savedQty = 0, failedQty = 0;
        string ids = string.Empty, failedIds = string.Empty, errorMsg = string.Empty, tempMsg = string.Empty;

        try
        {
            DataTable dtjson = (DataTable)JsonConvert.DeserializeObject(rows, (typeof(DataTable)));
            if (dtjson.Rows.Count == 0)
            {
                errorMsg = "Unable to save. An invalid list of changes was provided.";
                saved    = false;
            }
            else
            {
                int    id = 0, workItemTypeID = 0, statusID = 0, archive = 0;   //, ALLOCATIONGROUPID = 0;
                bool   duplicate   = false;
                string description = string.Empty;

                HttpServerUtility server = HttpContext.Current.Server;
                //save
                foreach (DataRow dr in dtjson.Rows)
                {
                    id          = workItemTypeID = statusID = 0;
                    archive     = 0;
                    description = string.Empty;
                    archive     = 0;
                    duplicate   = false;

                    tempMsg = string.Empty;
                    int.TryParse(dr["WORKITEMTYPE_StatusID"].ToString(), out id);
                    int.TryParse(workItemType_ID, out workItemTypeID);
                    int.TryParse(dr["STATUS"].ToString(), out statusID);
                    description = server.UrlDecode(dr["DESCRIPTION"].ToString());
                    int.TryParse(dr["ARCHIVE"].ToString(), out archive);

                    if (statusID == 0)
                    {
                        tempMsg = "You must specify a Status.";
                        saved   = false;
                    }
                    else
                    {
                        if (id == 0)
                        {
                            exists = false;
                            saved  = MasterData.WORKITEMTYPE_Status_Add(WORKITEMTYPEID: workItemTypeID
                                                                        , STATUSID: statusID
                                                                        , exists: out exists
                                                                        , newID: out id
                                                                        , errorMsg: out tempMsg);
                            if (exists)
                            {
                                saved   = false;
                                tempMsg = string.Format("{0}{1}{2}", tempMsg, tempMsg.Length > 0 ? Environment.NewLine : "", "Cannot add duplicate Work Activity - Status record.");
                            }
                        }
                        else
                        {
                            saved = MasterData.WORKITEMTYPE_Status_Update(WORKITEMTYPE_StatusID: id
                                                                          , WORKITEMTYPEID: workItemTypeID
                                                                          , STATUSID: statusID
                                                                          , archive: (archive == 1)
                                                                          , duplicate: out duplicate
                                                                          , errorMsg: out tempMsg);
                        }
                    }

                    if (saved)
                    {
                        ids      += string.Format("{0}{1}", ids.Length > 0 ? "," : "", id.ToString());
                        savedQty += 1;
                    }
                    else
                    {
                        failedQty += 1;
                    }

                    if (tempMsg.Length > 0)
                    {
                        errorMsg = string.Format("{0}{1}{2}", errorMsg, errorMsg.Length > 0 ? Environment.NewLine : "", tempMsg);
                    }
                }
            }
        }
        catch (Exception ex)
        {
            saved    = false;
            errorMsg = ex.Message;
            LogUtility.LogException(ex);
        }

        result["savedIds"]  = ids;
        result["failedIds"] = failedIds;
        result["saved"]     = savedQty.ToString();
        result["failed"]    = failedQty.ToString();
        result["error"]     = errorMsg;

        return(JsonConvert.SerializeObject(result, Formatting.None));
    }
Example #21
0
        public async Task <ActionResult> ReqAction()
        {
            string jsonString = "", postData = "", endPoint = "";
            int    companyId;

            if (Request.QueryString["mAction"] != null)
            {
                try
                {
                    RestfulAPIHelper apiHelper = new RestfulAPIHelper();
                    switch (Request.QueryString["mAction"].ToString().ToLower())
                    {
                    case "iothubreceiver":
                    {
                        companyId = int.Parse(Request.QueryString["companyId"].ToString());
                        string subAction   = Request.QueryString["sAction"].ToString();
                        string IoTHubAlias = Request.Form["iotHubAlias"].ToString();

                        endPoint = Global._operationTaskEndPoint;

                        if (subAction.ToLower() == "launch iothub receiver")
                        {
                            OpsInfraMessage opsInfraMessage = new OpsInfraMessage("provisioning iothub alias", "IoTHubAlias", IoTHubAlias, "create iothub alias", 0, Session["firstName"].ToString() + " " + Session["lastName"].ToString(), Session["email"].ToString());
                            OpsTaskModel    opsTask         = new OpsTaskModel(subAction, companyId, "IoTHubAlias", IoTHubAlias, opsInfraMessage.GetJsonContent());
                            postData   = opsTask.GetPostData();
                            jsonString = await apiHelper.callAPIService("POST", endPoint, postData);

                            dynamic jsonResult = JObject.Parse(jsonString);
                            if (jsonResult.id != null)
                            {
                                opsInfraMessage.taskId = jsonResult.id;
                                opsInfraMessage.Send();
                            }
                        }
                        else if (subAction.ToLower() == "restart iothub receiver")
                        {
                            IoTHubEventProcessTopic iotHubTopic = new IoTHubEventProcessTopic("Restart", IoTHubAlias, 0, Session["firstName"].ToString() + " " + Session["lastName"].ToString(), Session["email"].ToString());
                            OpsTaskModel            opsTask     = new OpsTaskModel(subAction, companyId, "IoTHubAlias", IoTHubAlias, iotHubTopic.GetJsonContent());
                            postData   = opsTask.GetPostData();
                            jsonString = await apiHelper.callAPIService("POST", endPoint, postData);

                            dynamic jsonResult = JObject.Parse(jsonString);
                            if (jsonResult.id != null)
                            {
                                iotHubTopic.taskId = jsonResult.id;
                                iotHubTopic.Send();
                            }
                        }
                        break;
                    }

                    case "getrunningtask":
                    {
                        endPoint = Global._operationTaskSearchEndPoint;
                        string q = "?";
                        if (Request.QueryString["taskstatus"] != null)
                        {
                            endPoint = endPoint + q + "taskstatus=" + Request.QueryString["taskstatus"];
                            q        = "&";
                        }
                        if (Request.QueryString["hours"] != null)
                        {
                            endPoint = endPoint + q + "hours=" + Request.QueryString["hours"];
                        }
                        jsonString = await apiHelper.callAPIService("GET", endPoint, postData);

                        break;
                    }

                    case "getusagelogsumbyday":
                    {
                        endPoint = Global._usageLogSumByDayEndPoint;
                        string q = "?";
                        if (Request.QueryString["day"] != null)
                        {
                            endPoint = endPoint + q + "days=" + Request.QueryString["day"];
                            q        = "&";
                        }

                        endPoint   = endPoint + q + "order=desc";
                        jsonString = await apiHelper.callAPIService("GET", endPoint, postData);

                        break;
                    }

                    default:
                        break;
                    }
                }
                catch (Exception ex)
                {
                    if (ex.Message.ToLower() == "invalid session")
                    {
                        Response.StatusCode = 401;
                    }
                    else
                    {
                        StringBuilder logMessage = LogUtility.BuildExceptionMessage(ex);
                        logMessage.AppendLine("EndPoint:" + endPoint);
                        logMessage.AppendLine("Action:" + Request.QueryString["action"].ToString());
                        logMessage.AppendLine("PostData:" + Request.Form.ToString());
                        Global._sfAppLogger.Error(logMessage);
                        Response.StatusCode = 500;
                        jsonString          = ex.Message;
                    }
                }
            }
            return(Content(JsonConvert.SerializeObject(jsonString), "application/json"));
        }
        public void MultipartUploadComplexStepTest()
        {
            var sourceFile = Config.MultiUploadTestFile;
            //get target object name
            var targetObjectKey = OssTestUtils.GetObjectKey(_className);

            var initRequest = new InitiateMultipartUploadRequest(_bucketName, targetObjectKey);
            var initResult  = _ossClient.InitiateMultipartUpload(initRequest);

            // 设置每块为 1M
            const int partSize = 1024 * 1024 * 1;

            var partFile = new FileInfo(sourceFile);
            // 计算分块数目
            var partCount = OssTestUtils.CalculatePartCount(partFile.Length, partSize);

            LogUtility.LogMessage("File {0} is splitted to {1} parts for multipart upload",
                                  sourceFile, partCount);

            // 新建一个List保存每个分块上传后的ETag和PartNumber
            var partETags = new List <PartETag>();

            //upload the file
            using (var fs = new FileStream(partFile.FullName, FileMode.Open))
            {
                for (var i = 0; i < partCount; i++)
                {
                    // 跳到每个分块的开头
                    long skipBytes = partSize * i;
                    fs.Position = skipBytes;

                    // 计算每个分块的大小
                    var size = partSize < partFile.Length - skipBytes
                        ? partSize
                        : partFile.Length - skipBytes;

                    // 创建UploadPartRequest,上传分块
                    var uploadPartRequest = new UploadPartRequest(_bucketName, targetObjectKey, initResult.UploadId)
                    {
                        InputStream = fs,
                        PartSize    = size,
                        PartNumber  = (i + 1)
                    };
                    var uploadPartResult = _ossClient.UploadPart(uploadPartRequest);

                    // 将返回的PartETag保存到List中。
                    partETags.Add(uploadPartResult.PartETag);
                }
            }

            var    lmuRequest = new ListMultipartUploadsRequest(_bucketName);
            var    lmuListing = _ossClient.ListMultipartUploads(lmuRequest);
            string mpUpload   = null;

            foreach (var t in lmuListing.MultipartUploads)
            {
                if (t.UploadId == initResult.UploadId)
                {
                    mpUpload = t.UploadId;
                }
            }

            Assert.IsNotNull(mpUpload, "The multipart uploading should be in progress");

            var completeRequest = new CompleteMultipartUploadRequest(_bucketName, targetObjectKey, initResult.UploadId);

            foreach (var partETag in partETags)
            {
                completeRequest.PartETags.Add(partETag);
            }
            _ossClient.CompleteMultipartUpload(completeRequest);

            Assert.IsTrue(OssTestUtils.ObjectExists(_ossClient, _bucketName, targetObjectKey));

            //delete the object
            _ossClient.DeleteObject(_bucketName, targetObjectKey);
        }
Example #23
0
 private void SetupLogging()
 {
     LogUtility.Initialise();
     log = LogManager.GetLogger(this.GetType());
 }
 public void Fatal(Exception x)
 {
     Fatal(LogUtility.BuildExceptionMessage(x));
 }
Example #25
0
 public SQLHelper()
 {
     log = new LogUtility();
 }
Example #26
0
    public static string SaveChanges(string rows)
    {
        Dictionary <string, string> result = new Dictionary <string, string>()
        {
            { "saved", "" }, { "ids", "" }, { "error", "" }
        };
        bool   exists = false, saved = false;
        string ids = string.Empty, errorMsg = string.Empty, tempMsg = string.Empty;

        try
        {
            DataTable dtjson = (DataTable)JsonConvert.DeserializeObject(rows, (typeof(DataTable)));
            if (dtjson.Rows.Count == 0)
            {
                errorMsg = "Unable to save. An invalid list of changes was provided.";
                saved    = false;
            }

            int    id = 0, typeId = 0, sortOrder = 0, archive = 0;
            string Priority = string.Empty, description = string.Empty;

            HttpServerUtility server = HttpContext.Current.Server;
            //save
            foreach (DataRow dr in dtjson.Rows)
            {
                id          = 0;
                typeId      = 0;
                sortOrder   = 0;
                Priority    = string.Empty;
                description = string.Empty;
                archive     = 0;

                tempMsg = string.Empty;
                int.TryParse(dr["PriorityID"].ToString(), out id);
                int.TryParse(dr["PriorityType"].ToString(), out typeId);
                Priority    = server.UrlDecode(dr["Priority"].ToString());
                description = server.UrlDecode(dr["DESCRIPTION"].ToString());
                int.TryParse(dr["SORT_ORDER"].ToString(), out sortOrder);
                int.TryParse(dr["ARCHIVE"].ToString(), out archive);

                if (string.IsNullOrWhiteSpace(Priority))
                {
                    tempMsg = "You must specify a value for Priority.";
                    saved   = false;
                }
                else
                {
                    if (id == 0)
                    {
                        exists = false;
                        saved  = MasterData.Priority_Add(typeId, Priority, description, sortOrder, archive == 1, out exists, out id, out tempMsg);
                        if (exists)
                        {
                            saved   = false;
                            tempMsg = string.Format("{0}{1}{2}", tempMsg, tempMsg.Length > 0 ? Environment.NewLine : "", "Cannot add duplicate Priority record [" + Priority + "].");
                        }
                    }
                    else
                    {
                        saved = MasterData.Priority_Update(id, typeId, Priority, description, sortOrder, archive == 1, out tempMsg);
                    }
                }

                if (saved)
                {
                    ids += string.Format("{0}{1}", ids.Length > 0 ? "," : "", id.ToString());
                }

                if (tempMsg.Length > 0)
                {
                    errorMsg = string.Format("{0}{1}{2}", errorMsg, errorMsg.Length > 0 ? Environment.NewLine : "", tempMsg);
                }
            }
        }
        catch (Exception ex)
        {
            LogUtility.LogException(ex);
            saved    = false;
            errorMsg = ex.Message;
        }

        result["saved"] = saved.ToString();
        result["error"] = errorMsg;

        return(JsonConvert.SerializeObject(result, Formatting.None));
    }
Example #27
0
    protected void InitializeColumnData(ref DataTable dt)
    {
        try
        {
            string displayName = string.Empty, groupName = string.Empty;
            bool blnVisible = false, blnSortable = false, blnOrderable = false;

            foreach (DataColumn gridColumn in dt.Columns)
            {
                displayName = gridColumn.ColumnName;
                blnVisible = false;
                blnSortable = false;
                blnOrderable = false;
                groupName = string.Empty;

                switch (gridColumn.ColumnName)
                {
                    case "X":
                        blnVisible = true;
                        break;
                    case "AOR #":
                        blnVisible = true;
                        blnSortable = true;
                        break;
                    case "AOR Name":
                        blnVisible = true;
                        blnSortable = true;
                        break;
                    case "Description":
                        displayName = "Description";
                        blnVisible = true;
                        blnSortable = true;
                        break;
                    case "Risk":
                        blnVisible = true;
                        blnSortable = true;
                        break;
                    case "Weight":
                        displayName = "Weight (%)";
                        blnVisible = true;
                        blnSortable = true;
                        break;
                    case "Avg. Resources":
                        blnVisible = true;
                        blnSortable = true;
                        break;
                    case "Z":
                        blnVisible = true;
                        break;
                }

                columnData.Columns.Add(gridColumn.ColumnName, displayName, blnVisible, blnSortable);
                columnData.Columns.Item(columnData.Columns.Count - 1).CanReorder = blnOrderable;
            }

            //Initialize the columnData
            columnData.Initialize(ref dt, ";", "~", "|");

            //Get sortable columns and default column order
            SortableColumns = columnData.SortableColumnsToString();
            DefaultColumnOrder = columnData.DefaultColumnOrderToString();
            //Sort and Reorder Columns
            columnData.ReorderDataTable(ref dt, ColumnOrder);
            columnData.SortDataTable(ref dt, SortOrder);
            SelectedColumnOrder = columnData.CurrentColumnOrderToString();

        }
        catch (Exception ex)
        {
            LogUtility.LogException(ex);
        }
    }
Example #28
0
        /// <summary>
        /// Capture a Payment Include the payment ID in the POST request to capture the payment amount.
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="capturePaymentRequest"></param>
        /// <param name="id">The payment ID returned from a previous payment request. This ID links the capture to the payment. </param>
        /// <returns>Task of ApiResponse (PtsV2PaymentsCapturesPost201Response)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <PtsV2PaymentsCapturesPost201Response> > CapturePaymentAsyncWithHttpInfo(CapturePaymentRequest capturePaymentRequest, string id)
        {
            LogUtility logUtility = new LogUtility();

            // verify the required parameter 'capturePaymentRequest' is set
            if (capturePaymentRequest == null)
            {
                logger.Error("ApiException : Missing required parameter 'capturePaymentRequest' when calling CaptureApi->CapturePayment");
                throw new ApiException(400, "Missing required parameter 'capturePaymentRequest' when calling CaptureApi->CapturePayment");
            }
            // verify the required parameter 'id' is set
            if (id == null)
            {
                logger.Error("ApiException : Missing required parameter 'id' when calling CaptureApi->CapturePayment");
                throw new ApiException(400, "Missing required parameter 'id' when calling CaptureApi->CapturePayment");
            }

            var    localVarPath         = $"/pts/v2/payments/{id}/captures";
            var    localVarPathParams   = new Dictionary <string, string>();
            var    localVarQueryParams  = new Dictionary <string, string>();
            var    localVarHeaderParams = new Dictionary <string, string>(Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <string, string>();
            var    localVarFileParams   = new Dictionary <string, FileParameter>();
            object localVarPostBody     = null;

            // to determine the Content-Type header
            string[] localVarHttpContentTypes = new string[] {
                "application/json;charset=utf-8"
            };
            string localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            string[] localVarHttpHeaderAccepts = new string[] {
                "application/hal+json;charset=utf-8"
            };
            string localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (id != null)
            {
                localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter
            }
            logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}");
            if (capturePaymentRequest != null && capturePaymentRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(capturePaymentRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = capturePaymentRequest; // byte array
            }

            if (logUtility.IsMaskingEnabled(logger))
            {
                logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}");
            }
            else
            {
                logger.Debug($"HTTP Request Body :\n{localVarPostBody}");
            }


            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                       Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                       localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("CapturePayment", localVarResponse);
                if (exception != null)
                {
                    logger.Error($"Exception : {exception.Message}");
                    throw exception;
                }
            }

            return(new ApiResponse <PtsV2PaymentsCapturesPost201Response>(localVarStatusCode,
                                                                          localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                                          (PtsV2PaymentsCapturesPost201Response)Configuration.ApiClient.Deserialize(localVarResponse, typeof(PtsV2PaymentsCapturesPost201Response)))); // Return statement
        }
Example #29
0
    public static string SaveChanges(string rows)
    {
        Dictionary<string, string> result = new Dictionary<string, string>() { { "saved", "0" }
            , { "failed", "0" }
            , { "savedIds", "" }
            , { "failedIds", "" }
            , { "error", "" } };
        bool exists = false, saved = false;
        int savedQty = 0, failedQty = 0;
        string ids = string.Empty, failedIds = string.Empty, errorMsg = string.Empty, tempMsg = string.Empty;

        try
        {
            DataTable dtjson = (DataTable)JsonConvert.DeserializeObject(rows, (typeof(DataTable)));
            if (dtjson.Rows.Count == 0)
            {
                errorMsg = "Unable to save. An invalid list of changes was provided.";
                saved = false;
            }
            else
            {
                int AORReleaseDeliverableID = 0, Weight = -999;

                //save
                foreach (DataRow dr in dtjson.Rows)
                {
                    tempMsg = string.Empty;
                    int.TryParse(dr["AORReleaseDeliverable_ID"].ToString(), out AORReleaseDeliverableID);
                    if (dr["Weight"].ToString() != "") int.TryParse(dr["Weight"].ToString(), out Weight);

                    result = AOR.AORReleaseDeliverable_Save(AORReleaseDeliverableID, Weight);

                    if (result["saved"].ToString() == "True")
                    {
                        //ids += string.Format("{0}{1}", ids.Length > 0 ? "," : "", id.ToString());
                        savedQty += 1;
                    }
                    else
                    {
                        failedQty += 1;
                    }

                    if (tempMsg.Length > 0)
                    {
                        errorMsg = string.Format("{0}{1}{2}", errorMsg, errorMsg.Length > 0 ? Environment.NewLine : "", tempMsg);
                    }

                }
            }
        }
        catch (Exception ex)
        {
            saved = false;
            errorMsg = ex.Message;
            LogUtility.LogException(ex);
        }

        result["savedIds"] = ids;
        result["failedIds"] = failedIds;
        result["saved"] = savedQty.ToString();
        result["failed"] = failedQty.ToString();
        result["error"] = errorMsg;

        return JsonConvert.SerializeObject(result, Formatting.None);
    }
Example #30
0
        /// <summary>
        /// Makes the asynchronous HTTP request.
        /// </summary>
        /// <param name="path">URL path.</param>
        /// <param name="method">HTTP method.</param>
        /// <param name="queryParams">Query parameters.</param>
        /// <param name="postBody">HTTP body (POST request).</param>
        /// <param name="headerParams">Header parameters.</param>
        /// <param name="formParams">Form parameters.</param>
        /// <param name="fileParams">File parameters.</param>
        /// <param name="pathParams">Path parameters.</param>
        /// <param name="contentType">Content type.</param>
        /// <returns>The Task instance.</returns>
        public async System.Threading.Tasks.Task <object> CallApiAsync(
            string path, Method method, Dictionary <string, string> queryParams, object postBody,
            Dictionary <string, string> headerParams, Dictionary <string, string> formParams,
            Dictionary <string, FileParameter> fileParams, Dictionary <string, string> pathParams,
            string contentType)
        {
            LogUtility logUtility = new LogUtility();

            var request = PrepareRequest(
                path, method, queryParams, postBody, headerParams, formParams, fileParams,
                pathParams, contentType);

            // Logging Request Headers
            var headerPrintOutput = new StringBuilder();

            foreach (var param in request.Parameters)
            {
                if (param.Type.ToString().Equals("HttpHeader"))
                {
                    headerPrintOutput.Append($"{param.Name} : {param.Value}\n");
                }
            }

            if (logUtility.IsMaskingEnabled(logger))
            {
                logger.Debug($"HTTP Request Headers :\n{logUtility.MaskSensitiveData(headerPrintOutput.ToString())}");
            }
            else
            {
                logger.Debug($"HTTP Request Headers :\n{headerPrintOutput.ToString()}");
            }

            InterceptRequest(request);
            var response = await RestClient.ExecuteTaskAsync(request);

            InterceptResponse(request, response);

            // Logging Response Headers
            var httpResponseStatusCode = (int)response.StatusCode;
            var httpResponseHeaders    = response.Headers;
            var httpResponseData       = response.Content;

            logger.Debug($"HTTP Response Status Code: {httpResponseStatusCode}");

            var responseHeadersBuilder = new StringBuilder();

            foreach (var header in httpResponseHeaders)
            {
                responseHeadersBuilder.Append($"{header}\n");
            }

            if (logUtility.IsMaskingEnabled(logger))
            {
                logger.Debug($"HTTP Response Headers :\n{logUtility.MaskSensitiveData(responseHeadersBuilder.ToString())}");
            }
            else
            {
                logger.Debug($"HTTP Response Headers :\n{responseHeadersBuilder.ToString()}");
            }

            if (!string.IsNullOrEmpty(httpResponseData))
            {
                if (logUtility.IsMaskingEnabled(logger))
                {
                    logger.Debug($"HTTP Response Body :\n{logUtility.MaskSensitiveData(httpResponseData)}");
                }
                else
                {
                    logger.Debug($"HTTP Response Body :\n{httpResponseData}");
                }
            }

            return(response);
        }
    protected void InitializeColumnData(ref DataTable dt)
    {
        try
        {
            string displayName = string.Empty, groupName = string.Empty;
            bool   blnVisible = false, blnSortable = false, blnOrderable = false;

            foreach (DataColumn gridColumn in dt.Columns)
            {
                displayName  = gridColumn.ColumnName;
                blnVisible   = false;
                blnSortable  = false;
                blnOrderable = false;
                groupName    = string.Empty;

                switch (gridColumn.ColumnName)
                {
                case "A":
                    displayName = "";
                    blnVisible  = true;
                    break;

                case "ALLOCATIONID":
                    blnVisible  = false;
                    blnSortable = false;
                    break;

                case "AllocationCategoryID":
                    blnVisible  = false;
                    blnSortable = false;
                    break;

                case "ALLOCATION":
                    displayName = "Allocation";
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "DESCRIPTION":
                    displayName = "Description";
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "SORT_ORDER":
                    displayName = "Sort Order";
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "DefaultSME":
                    displayName = "SME";
                    groupName   = "Default Resources";
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "DefaultBusinessResource":
                    displayName = "Business Resource";
                    groupName   = "Default Resources";
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "DefaultTechnicalResource":
                    displayName = "Technical Resource";
                    groupName   = "Default Resources";
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "DefaultAssignedTo":
                    displayName = "Assigned To";
                    groupName   = "Default Resources";
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "ARCHIVE":
                    displayName = "Archive";
                    blnVisible  = true;
                    blnSortable = true;
                    break;

                case "ALLOCATIONGROUPID":
                    blnVisible  = false;
                    blnSortable = false;
                    break;
                }

                columnData.Columns.Add(gridColumn.ColumnName, displayName, blnVisible, blnSortable);
                columnData.Columns.Item(columnData.Columns.Count - 1).CanReorder = blnOrderable;
                columnData.Columns.Item(columnData.Columns.Count - 1).GroupName  = groupName;
            }

            //Initialize the columnData
            columnData.Initialize(ref dt, ";", "~", "|");

            //Get sortable columns and default column order
            SortableColumns    = columnData.SortableColumnsToString();
            DefaultColumnOrder = columnData.DefaultColumnOrderToString();
            //Sort and Reorder Columns
            columnData.ReorderDataTable(ref dt, ColumnOrder);
            columnData.SortDataTable(ref dt, SortOrder);
            SelectedColumnOrder = columnData.CurrentColumnOrderToString();
        }
        catch (Exception ex)
        {
            LogUtility.LogException(ex);
        }
    }