Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="skuDetail"></param>
        /// <returns></returns>
        public LicenseInfo CreateLicenseInfo(SKUDetailInfo skuDetail)
        {
            LicenseInfo obj = new LicenseInfo();

            obj.SKUID        = skuDetail.SKUID;
            obj.SKUType      = skuDetail.SKUType;
            obj.Qty          = skuDetail.Qty;
            obj.QtySpecified = skuDetail.QtySpecified;

            if (skuDetail.SKUType == Constants.SKUType.OPTION.ToString())
            {
                obj.VersionSeqNo         = -1;
                obj.LicenseKey           = skuDetail.OptionLicenseKey;
                obj.ReleaseDateSpecified = false;
            }
            else
            {
                VersionInfoWithLicense[] versions      = skuDetail.VersionList;
                VersionInfoWithLicense   latestVersion = versions.OrderByDescending(o => o.VersionSeqNo).FirstOrDefault <VersionInfoWithLicense>();
                // CALL GET LICENSE FOR GIVEN SKU AND GET LICENSE KEY
                if (latestVersion != null)
                {
                    obj.ImageUrl         = latestVersion.ImageUrl;
                    obj.IsShippedVersion = latestVersion.IsShippedVersion;
                    obj.Version          = latestVersion.Version;
                    obj.VersionSeqNo     = latestVersion.VersionSeqNo;
                    obj.VersionType      = latestVersion.VersionType;
                    obj.LicenseKey       = latestVersion.LicenseKey;
                }
            }

            return(obj);
        }
Exemple #2
0
        /// <summary>
        /// Build SKU Details Info Object for all SKU ID and Gets latest Version License if missing
        /// </summary>
        /// <param name="sKUID"></param>
        /// /*new CR user logging 08/2013*/
        public SKUDetailInfo[] GetSKUDetailInfoWithLatestVersionLicense(string[] sKUID, string licensableSNum, string requestingSystem)
        {
            List <SKUDetailInfo> skuDetailInfoList = new List <SKUDetailInfo>();
            DataSet       skuDataSet = new DataSet();
            SKUDetailInfo skuDetailInfo;
            List <VersionInfoWithLicense> skuVersionInfoList;

            try
            {
                //get all data
                skuDataSet = GetSKUDetailInfoData(sKUID, licensableSNum);

                if (skuDataSet != null && skuDataSet.Tables != null && skuDataSet.Tables.Count > 0)
                {
                    if (skuDataSet.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < skuDataSet.Tables[0].Rows.Count; i++)
                        {
                            DataRow sdr           = null;
                            string  currentSKUID  = string.Empty;
                            string  previousSKUID = string.Empty;
                            sdr = skuDataSet.Tables[0].Rows[i];

                            if (sdr["SKUID"] != DBNull.Value && sdr["SKUType"] != DBNull.Value)
                            {
                                currentSKUID  = Convert.ToString(sdr["SKUID"]);
                                previousSKUID = Convert.ToString(sdr["SKUID"]);

                                skuDetailInfo = new SKUDetailInfo();

                                //BUILD OBJECT FROM DB
                                skuDetailInfo.SKUID        = Convert.ToString(sdr["SKUID"]);
                                skuDetailInfo.SKUName      = (sdr["SKUName"] != DBNull.Value) ? Convert.ToString(sdr["SKUName"]) : "";
                                skuDetailInfo.TAAPartNo    = (sdr["TAAPartNo"] != DBNull.Value) ? Convert.ToString(sdr["TAAPartNo"]) : "";
                                skuDetailInfo.TAAPartName  = (sdr["TAAPartName"] != DBNull.Value) ? Convert.ToString(sdr["TAAPartName"]) : "";
                                skuDetailInfo.SKUType      = (sdr["SKUType"] != DBNull.Value) ? Convert.ToString(sdr["SKUType"]) : "";
                                skuDetailInfo.Qty          = (sdr["Qty"] != DBNull.Value) ? Convert.ToInt32(sdr["Qty"]) : -1;
                                skuDetailInfo.QtySpecified = false;
                                if (skuDetailInfo.Qty != -1)
                                {
                                    skuDetailInfo.QtySpecified = true;
                                }

                                skuDetailInfo.OptionLicenseKey = (sdr["OptionLicenseKey"] != DBNull.Value) ? Convert.ToString(sdr["OptionLicenseKey"]) : "";

                                if (skuDetailInfo.SKUType == Constants.SKUType.SW.ToString())
                                {
                                    skuVersionInfoList = new List <VersionInfoWithLicense>();
                                    while (previousSKUID == currentSKUID)
                                    {
                                        VersionInfoWithLicense versionObject = new VersionInfoWithLicense();
                                        versionObject.VersionPartNo   = (sdr["VersionPartNo"] != DBNull.Value) ? Convert.ToString(sdr["VersionPartNo"]) : "";
                                        versionObject.VersionPartName = (sdr["VersionPartName"] != DBNull.Value) ? Convert.ToString(sdr["VersionPartName"]) : "";
                                        versionObject.VersionSeqNo    = (sdr["VersionSeqNo"] != DBNull.Value) ? Convert.ToInt32(sdr["VersionSeqNo"]) : -1;
                                        versionObject.Version         = (sdr["Version"] != DBNull.Value) ? Convert.ToString(sdr["Version"]) : "";
                                        versionObject.VersionType     = (sdr["VersionType"] != DBNull.Value) ? Convert.ToString(sdr["VersionType"]) : "";
                                        versionObject.VersionReleaseClassification = (sdr["VersionReleaseClassification"] != DBNull.Value) ? Convert.ToString(sdr["VersionReleaseClassification"]) : "";
                                        versionObject.IsShippedVersion             = (sdr["IsShippedVersion"] != DBNull.Value) ? Convert.ToBoolean(sdr["IsShippedVersion"]) : false;
                                        versionObject.LicenseKey           = (sdr["LicenseKey"] != DBNull.Value) ? Convert.ToString(sdr["LicenseKey"]) : "";
                                        versionObject.ReleaseDateSpecified = false;
                                        versionObject.ReleaseDate          = (sdr["ReleaseDate"] != DBNull.Value) ? Convert.ToDateTime(sdr["ReleaseDate"]) : DateTime.MinValue;
                                        if (versionObject.ReleaseDate != DateTime.MinValue)
                                        {
                                            versionObject.ReleaseDateSpecified = true;
                                        }

                                        versionObject.VersionUpgradedOnSpecified = true;
                                        versionObject.VersionUpgradedOn          = (sdr["VersionUpgradedDate"] != DBNull.Value) ? Convert.ToDateTime(sdr["VersionUpgradedDate"]) : DateTime.MinValue;
                                        if (versionObject.VersionUpgradedOn != DateTime.MinValue)
                                        {
                                            versionObject.VersionUpgradedOnSpecified = true;
                                        }


                                        versionObject.ImageUrl = (sdr["ImageUrl"] != DBNull.Value) ? Convert.ToString(sdr["ImageUrl"]) : "";

                                        skuVersionInfoList.Add(versionObject);


                                        i++;
                                        if (i < skuDataSet.Tables[0].Rows.Count)
                                        {
                                            sdr          = skuDataSet.Tables[0].Rows[i];
                                            currentSKUID = Convert.ToString(sdr["SKUID"]);
                                        }
                                        else
                                        {
                                            currentSKUID = "";
                                            i--;
                                        }
                                    }
                                    VersionInfoWithLicense latestVersion = skuVersionInfoList.OrderByDescending(obj => obj.VersionSeqNo).FirstOrDefault <VersionInfoWithLicense>();
                                    if (latestVersion != null)
                                    {
                                        skuVersionInfoList = new List <VersionInfoWithLicense>();

                                        if (string.IsNullOrEmpty(latestVersion.LicenseKey))
                                        {
                                            //call get license
                                            //GetLicenseKey(string SNum, string SKUID, string SKUType, int Qty, string Version, DateTime ExpiryDate);
                                            /*new CR user logging 08/2013*/
                                            latestVersion.LicenseKey = GetLicenseKey(licensableSNum, latestVersion.VersionPartName, skuDetailInfo.SKUType, skuDetailInfo.Qty, 1, latestVersion.Version, DateTime.MinValue, requestingSystem);
                                        }
                                        skuVersionInfoList.Add(latestVersion);
                                    }
                                    skuDetailInfo.VersionList = skuVersionInfoList.ToArray();
                                }

                                skuDetailInfoList.Add(skuDetailInfo);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Building SKU Details Failed. " + ex.Message + Environment.NewLine + ex.StackTrace);
            }

            return(skuDetailInfoList.ToArray());
        }
Exemple #3
0
        /// <summary>
        /// Build SKU Details Info Object for all SKU ID
        /// </summary>
        /// <param name="sKUID"></param>
        public SKUDetailInfo[] GetSKUDetailInfo(string[] sKUID, string licensableSNum)
        {
            List <SKUDetailInfo> skuDetailInfoList = new List <SKUDetailInfo>();
            DataSet       skuDataSet = new DataSet();
            SKUDetailInfo skuDetailInfo;
            List <VersionInfoWithLicense> skuVersionInfoList;

            try
            {
                //get all data
                skuDataSet = GetSKUDetailInfoData(sKUID, licensableSNum);

                if (skuDataSet != null && skuDataSet.Tables != null && skuDataSet.Tables.Count > 0)
                {
                    if (skuDataSet.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < skuDataSet.Tables[0].Rows.Count; i++)
                        {
                            DataRow sdr           = null;
                            string  currentSKUID  = string.Empty;
                            string  previousSKUID = string.Empty;
                            sdr = skuDataSet.Tables[0].Rows[i];

                            if (sdr["SKUID"] != DBNull.Value && sdr["SKUType"] != DBNull.Value)
                            {
                                currentSKUID  = Convert.ToString(sdr["SKUID"]);
                                previousSKUID = Convert.ToString(sdr["SKUID"]);

                                skuDetailInfo = new SKUDetailInfo();

                                //BUILD OBJECT FROM DB
                                skuDetailInfo.SKUID        = Convert.ToString(sdr["SKUID"]);
                                skuDetailInfo.SKUName      = (sdr["SKUName"] != DBNull.Value) ? Convert.ToString(sdr["SKUName"]) : "";
                                skuDetailInfo.TAAPartNo    = (sdr["TAAPartNo"] != DBNull.Value) ? Convert.ToString(sdr["TAAPartNo"]) : "";
                                skuDetailInfo.TAAPartName  = (sdr["TAAPartName"] != DBNull.Value) ? Convert.ToString(sdr["TAAPartName"]) : "";
                                skuDetailInfo.SKUType      = (sdr["SKUType"] != DBNull.Value) ? Convert.ToString(sdr["SKUType"]) : "";
                                skuDetailInfo.Qty          = (sdr["Qty"] != DBNull.Value) ? Convert.ToInt32(sdr["Qty"]) : -1;
                                skuDetailInfo.QtySpecified = false;
                                if (skuDetailInfo.Qty != -1)
                                {
                                    skuDetailInfo.QtySpecified = true;
                                }

                                skuDetailInfo.UpdatedTimestampSpecified = true;
                                if (skuDetailInfo.SKUType == Constants.SKUType.OPTION.ToString())
                                {
                                    if (skuDetailInfo.UpdatedTimestamp == DateTime.MinValue)
                                    {
                                        skuDetailInfo.UpdatedTimestamp          = (sdr["UpdatedOn"] != DBNull.Value) ? Convert.ToDateTime(sdr["UpdatedOn"]) : DateTime.MinValue;
                                        skuDetailInfo.UpdatedTimestampSpecified = true;
                                    }
                                    else
                                    {
                                        skuDetailInfo.UpdatedTimestamp          = Convert.ToDateTime((sdr["UpdatedOn"]));
                                        skuDetailInfo.UpdatedTimestampSpecified = true;
                                    }
                                }

                                skuDetailInfo.OptionLicenseKey = (sdr["OptionLicenseKey"] != DBNull.Value) ? Convert.ToString(sdr["OptionLicenseKey"]) : "";

                                if (skuDetailInfo.SKUType == Constants.SKUType.SW.ToString())
                                {
                                    skuVersionInfoList = new List <VersionInfoWithLicense>();
                                    while (previousSKUID == currentSKUID)
                                    {
                                        VersionInfoWithLicense versionObject = new VersionInfoWithLicense();
                                        versionObject.VersionPartNo   = (sdr["VersionPartNo"] != DBNull.Value) ? Convert.ToString(sdr["VersionPartNo"]) : "";
                                        versionObject.VersionPartName = (sdr["VersionPartName"] != DBNull.Value) ? Convert.ToString(sdr["VersionPartName"]) : "";
                                        versionObject.VersionSeqNo    = (sdr["VersionSeqNo"] != DBNull.Value) ? Convert.ToInt32(sdr["VersionSeqNo"]) : -1;
                                        versionObject.Version         = (sdr["Version"] != DBNull.Value) ? Convert.ToString(sdr["Version"]) : "";
                                        versionObject.VersionType     = (sdr["VersionType"] != DBNull.Value) ? Convert.ToString(sdr["VersionType"]) : "";
                                        versionObject.VersionReleaseClassification = (sdr["VersionReleaseClassification"] != DBNull.Value) ? Convert.ToString(sdr["VersionReleaseClassification"]) : "";
                                        versionObject.IsShippedVersion             = (sdr["IsShippedVersion"] != DBNull.Value) ? Convert.ToBoolean(sdr["IsShippedVersion"]) : false;
                                        versionObject.LicenseKey           = (sdr["LicenseKey"] != DBNull.Value) ? Convert.ToString(sdr["LicenseKey"]) : "";
                                        versionObject.ReleaseDateSpecified = false;
                                        versionObject.ReleaseDate          = (sdr["ReleaseDate"] != DBNull.Value) ? Convert.ToDateTime(sdr["ReleaseDate"]) : DateTime.MinValue;
                                        if (versionObject.ReleaseDate != DateTime.MinValue)
                                        {
                                            versionObject.ReleaseDateSpecified = true;
                                        }

                                        versionObject.VersionUpgradedOnSpecified = true;
                                        versionObject.VersionUpgradedOn          = (sdr["VersionUpgradedDate"] != DBNull.Value) ? Convert.ToDateTime(sdr["VersionUpgradedDate"]) : DateTime.MinValue;
                                        if (versionObject.VersionUpgradedOn != DateTime.MinValue)
                                        {
                                            versionObject.VersionUpgradedOnSpecified = true;
                                        }


                                        versionObject.ImageUrl = (sdr["ImageUrl"] != DBNull.Value) ? Convert.ToString(sdr["ImageUrl"]) : "";

                                        skuDetailInfo.UpdatedTimestampSpecified = true;
                                        bool del = (sdr["Deleted"] != DBNull.Value) ? Convert.ToBoolean(sdr["Deleted"]) : true;
                                        if (del == false)
                                        {
                                            if (skuDetailInfo.UpdatedTimestamp == DateTime.MinValue)
                                            {
                                                skuDetailInfo.UpdatedTimestamp          = (sdr["UpdatedOn"] != DBNull.Value) ? Convert.ToDateTime(sdr["UpdatedOn"]) : DateTime.MinValue;
                                                skuDetailInfo.UpdatedTimestampSpecified = true;
                                            }
                                            else
                                            {
                                                skuDetailInfo.UpdatedTimestamp          = Convert.ToDateTime((sdr["UpdatedOn"]));
                                                skuDetailInfo.UpdatedTimestampSpecified = true;
                                            }
                                        }

                                        skuVersionInfoList.Add(versionObject);

                                        i++;
                                        if (i < skuDataSet.Tables[0].Rows.Count)
                                        {
                                            sdr          = skuDataSet.Tables[0].Rows[i];
                                            currentSKUID = Convert.ToString(sdr["SKUID"]);
                                        }
                                        else
                                        {
                                            currentSKUID = string.Empty;
                                        }
                                    }
                                    // if come out reset to original place
                                    i--;
                                    skuDetailInfo.VersionList = skuVersionInfoList.ToArray();
                                }
                                skuDetailInfoList.Add(skuDetailInfo);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Building SKU Details Failed. " + ex.Message + Environment.NewLine + ex.StackTrace);
            }

            return(skuDetailInfoList.ToArray());
        }
Exemple #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="objRMASwapRequest"></param>
        /// <param name="objRMASwapResponse"></param>
        /// <returns></returns>
        public bool ProcessRequest(RMASwapRequest objRMASwapRequest, RMASwapResponse objRMASwapResponse)
        {
            // START PROCESSING

            bool flag = false;

            string[]  SKUList     = null;
            SKUInfo[] SKUInfoList = null;

            string ParentSNum = string.Empty;
            string message    = string.Empty;

            SKUDetailInfo[] skuDetailList;
            DataTable       SNumAssocation;

            try
            {
                if (objRMASwapRequest.SourceLicenseSNum.IsValidString() && objRMASwapRequest.DestLicenseSNum.IsValidString())
                {
                    //GET SKULIST FOR GIVEN SERIAL NO
                    SKUInfoList = objCommonBL.GetSKUListForGivenSNum(objRMASwapRequest.SourceLicenseSNum, string.Empty);

                    if (SKUInfoList == null || SKUInfoList.Length < 1)
                    {
                        objRMASwapResponse.ResponseStatus  = (int)Constants.ResponseStatus.NoLicSNUMFound;
                        objRMASwapResponse.ResponseMessage = Constants.ResponseMessage[7].ToString();
                        return(flag);
                    }

                    //FIND ALL PARENT SERIAL NUM AND SKULIST USING PARENTCHILD METHOD
                    #region FIND PARENTCHILD RECORDS FOR BOTH SERIAL NO
                    SNumAssocation = GetUpdatedSNumAssocation(objRMASwapRequest);
                    #endregion

                    #region CHECK ASSOCIATION RESPONSE
                    if (SNumAssocation == null || SNumAssocation.Rows.Count == 0)
                    {
                        objRMASwapResponse.ResponseStatus  = (int)Constants.ResponseStatus.NoParentChildFound;
                        objRMASwapResponse.ResponseMessage = Constants.ResponseMessage[8].ToString();
                        return(flag);
                    }
                    #endregion

                    #region CHECK DESTINATION LICENSABLE SNUM IS AVAILABLE IN TST OR NOT
                    if (!CheckTSTRecord(objRMASwapRequest.DestLicenseSNum))
                    {
                        objRMASwapResponse.ResponseStatus  = (int)Constants.ResponseStatus.InvalidParameter;
                        objRMASwapResponse.ResponseMessage = "Destination Licensable SNum is Not available in System.";
                        return(flag);
                    }
                    #endregion

                    #region Old Code
                    //// REPLACE LICENSABLE SOURCE SNUM WITH DESTINATION SNUM IN TST TABLE
                    //if (ReplaceSourceLicenseSNumWithDestLicenseSNum(SNumAssocation))
                    //{
                    //    if (SKUInfoList != null)
                    //        SKUList = SKUInfoList.Select(o => o.SKUID).ToArray<string>();

                    //    if (SKUList != null && SKUList.Length > 0)
                    //    {
                    //        // FIND ALL SKU DETAILS (SOFTWARE & OPTION) FOR GIVEN ID.
                    //        skuDetailList = objCommonBL.GetSKUDetailInfo(SKUList, objRMASwapRequest.SourceLicenseSNum);

                    //        //CHECK RETURN OBJECT AND GENERATED LICENSE AS PER VERSION FILTER IF REQUIRED
                    //        if (skuDetailList != null && skuDetailList.Length > 0)
                    //        {
                    //            List<LicenseInfo> LicenseInfoList = new List<LicenseInfo>();
                    //            for (int j = 0; j < skuDetailList.Length; j++)
                    //            {

                    //                string releaseKey = string.Empty;
                    //                //FOR SOFTWARE
                    //                if (skuDetailList[j].SKUType != Constants.SKUType.OPTION.ToString())
                    //                {
                    //                    VersionInfoWithLicense[] versions = skuDetailList[j].VersionList;
                    //                    //remove all old keys.
                    //                    for (int k = 0; k < versions.Length; k++)
                    //                    {
                    //                        versions[k].IsShippedVersion = false;
                    //                        versions[k].LicenseKey = "";
                    //                    }
                    //                    if (versions != null && versions.Length > 0)
                    //                    {
                    //                        VersionInfoWithLicense latestVersion = versions.OrderByDescending(o => o.VersionSeqNo).FirstOrDefault<VersionInfoWithLicense>();

                    //                        // CALL GET LICENSE FOR GIVEN SKU AND GET LICENSE KEY
                    //                        if (latestVersion != null && string.IsNullOrEmpty(latestVersion.LicenseKey))
                    //                        {
                    //                            releaseKey = string.Empty;
                    //                            releaseKey = objCommonBL.GetLicenseKey(objRMASwapRequest.DestLicenseSNum, skuDetailList[j].SKUID, skuDetailList[j].SKUType, skuDetailList[j].Qty, 1, latestVersion.Version, DateTime.MinValue, 1);
                    //                            latestVersion.LicenseKey = releaseKey;
                    //                            latestVersion.IsShippedVersion = true;
                    //                        }
                    //                    }

                    //                    //add it to response licenseinfo object
                    //                    LicenseInfo obj = CreateLicenseInfo(skuDetailList[j]);
                    //                    LicenseInfoList.Add(obj);
                    //                }
                    //                else if (skuDetailList[j].SKUType == Constants.SKUType.OPTION.ToString()) //FOR OPTION
                    //                {
                    //                    skuDetailList[j].OptionLicenseKey = "";
                    //                    releaseKey = objCommonBL.GetLicenseKey(objRMASwapRequest.DestLicenseSNum, skuDetailList[j].SKUID, skuDetailList[j].SKUType, skuDetailList[j].Qty, 1, "", DateTime.MinValue, 1);
                    //                    skuDetailList[j].OptionLicenseKey = releaseKey;

                    //                    //add it to response licenseinfo object
                    //                    LicenseInfo obj = CreateLicenseInfo(skuDetailList[j]);
                    //                    LicenseInfoList.Add(obj);
                    //                }
                    //            }

                    //            objRMASwapResponse.Licenses = LicenseInfoList.ToArray();
                    //        }
                    //        else
                    //        {

                    //            objRMASwapResponse.ResponseStatus = (int)Constants.ResponseStatus.UnKnownSKU;
                    //            objRMASwapResponse.ResponseMessage = Constants.ResponseMessage[2].ToString();
                    //        }
                    //    }
                    //}
                    //else
                    //{
                    //    objRMASwapResponse.ResponseStatus = (int)Constants.ResponseStatus.InvalidParameter;
                    //    objRMASwapResponse.ResponseMessage = "Invalid TST Record for SNum.Fail to Replace SNum.";
                    //}
                    #endregion

                    #region NEW CR
                    // REPLACE LICENSABLE SOURCE SNUM WITH DESTINATION SNUM IN TST TABLE
                    if (ReplaceSourceLicenseSNumWithDestLicenseSNum(SNumAssocation))
                    {
                        if (SKUInfoList != null)
                        {
                            SKUList = SKUInfoList.Select(o => o.SKUID).ToArray <string>();
                        }

                        if (SKUList != null && SKUList.Length > 0)
                        {
                            // FIND ALL SKU DETAILS (SOFTWARE & OPTION) FOR GIVEN ID.
                            skuDetailList = objCommonBL.GetSKUDetailInfo(SKUList, objRMASwapRequest.SourceLicenseSNum);

                            //CHECK RETURN OBJECT AND GENERATED LICENSE AS PER VERSION FILTER IF REQUIRED
                            if (skuDetailList.Length > 0)
                            {
                                DataTable dtChkLicenseData = null;
                                //RMA SWAP CR - Get the records with SKUS deleted=0 for options and for softwares get the latest SKU record
                                DataSet dsChkLicenseData = objCommonBL.FindLicenseHistoryForRMASWAP(objRMASwapRequest.SourceLicenseSNum);
                                if (dsChkLicenseData != null && dsChkLicenseData.Tables != null && dsChkLicenseData.Tables.Count > 0)
                                {
                                    dtChkLicenseData = dsChkLicenseData.Tables[0];
                                }
                                List <LicenseInfo> LicenseInfoList = new List <LicenseInfo>();
                                string             releaseKey      = string.Empty;
                                foreach (DataRow row in dtChkLicenseData.Rows)
                                {
                                    string strSKUID   = (row["PartName"] != DBNull.Value) ? row["PartName"].ToString() : string.Empty;
                                    string strSKUType = (row["ProductType"] != DBNull.Value) ? row["ProductType"].ToString() : string.Empty;
                                    if (strSKUType == "2")
                                    {
                                        strSKUType = "OPTION";
                                    }
                                    else
                                    {
                                        strSKUType = "SW";
                                    }
                                    int intQty   = (row["Qty"] != DBNull.Value) ? Convert.ToInt16(row["Qty"]) : 1;
                                    int intIndex = (row["Index"] != DBNull.Value) ? Convert.ToInt16(row["Index"]) : 1;
                                    //Do not pass Version as we need to fetch the latest version for the SKU
                                    //string strVersion = (row["VersionName"] != DBNull.Value) ? row["VersionName"].ToString() : string.Empty;
                                    //For Software
                                    if (strSKUType != Constants.SKUType.OPTION.ToString())
                                    {
                                        // CALL GET LICENSE FOR GIVEN SKU AND GET LICENSE KEY

                                        releaseKey = string.Empty;
                                        //pass the version as empty here
                                        /*new CR user logging 08/2013*/
                                        releaseKey = objCommonBL.CallRMASwapLicense(objRMASwapRequest.DestLicenseSNum, strSKUID, strSKUType, intQty, intIndex, string.Empty, DateTime.MinValue, 1, objRMASwapRequest.RequestingSystem);
                                        //skuDetailList[j].OptionLicenseKey = releaseKey;
                                        if (string.IsNullOrEmpty(releaseKey) || releaseKey.Equals("Fail to Generate Key"))
                                        {
                                            flag = false;
                                        }
                                        else
                                        {
                                            flag = true;
                                        }


                                        LicenseInfo obj = new LicenseInfo();
                                        obj.SKUID   = strSKUID;
                                        obj.SKUType = strSKUType;
                                        obj.Qty     = intQty;
                                        //obj.QtySpecified = skuDetail.QtySpecified;
                                        VersionInfoWithLicense[] versions      = null;
                                        VersionInfoWithLicense   latestVersion = null;
                                        for (int i = 0; i < skuDetailList.Length; i++)
                                        {
                                            if (skuDetailList[i].SKUID.Equals(strSKUID))
                                            {
                                                versions = skuDetailList[i].VersionList;
                                                break;
                                            }
                                        }
                                        if (versions != null)
                                        {
                                            latestVersion = versions.OrderByDescending(o => o.VersionSeqNo).FirstOrDefault <VersionInfoWithLicense>();
                                        }
                                        if (latestVersion != null)
                                        {
                                            obj.ImageUrl         = latestVersion.ImageUrl;
                                            obj.IsShippedVersion = latestVersion.IsShippedVersion;
                                            obj.Version          = latestVersion.Version;
                                            obj.VersionSeqNo     = latestVersion.VersionSeqNo;
                                            obj.VersionType      = latestVersion.VersionType;
                                            obj.LicenseKey       = releaseKey;
                                        }

                                        //add it to response licenseinfo object
                                        LicenseInfoList.Add(obj);
                                    }
                                    else
                                    {
                                        LicenseInfo obj = new LicenseInfo();
                                        obj.SKUID   = strSKUID;
                                        obj.SKUType = strSKUType;
                                        obj.Qty     = intQty;
                                        //obj.QtySpecified = skuDetail.QtySpecified;
                                        /*new CR user logging 08/2013*/
                                        releaseKey               = objCommonBL.CallRMASwapLicense(objRMASwapRequest.DestLicenseSNum, strSKUID, strSKUType, intQty, intIndex, "", DateTime.MinValue, 1, objRMASwapRequest.RequestingSystem);
                                        obj.VersionSeqNo         = -1;
                                        obj.LicenseKey           = releaseKey;
                                        obj.ReleaseDateSpecified = false;

                                        //add it to response licenseinfo object
                                        LicenseInfoList.Add(obj);
                                        if (string.IsNullOrEmpty(releaseKey) || releaseKey.Equals("Fail to Generate Key"))
                                        {
                                            flag = false;
                                        }
                                        else
                                        {
                                            flag = true;
                                        }
                                    }
                                }


                                objRMASwapResponse.Licenses = LicenseInfoList.ToArray();
                            }
                            else
                            {
                                objRMASwapResponse.ResponseStatus  = (int)Constants.ResponseStatus.UnKnownSKU;
                                objRMASwapResponse.ResponseMessage = Constants.ResponseMessage[2].ToString();
                            }
                        }
                    }
                    else
                    {
                        objRMASwapResponse.ResponseStatus  = (int)Constants.ResponseStatus.InvalidParameter;
                        objRMASwapResponse.ResponseMessage = "Invalid TST Record for SNum.Fail to Replace SNum.";
                    }

                    #endregion

                    //flag = true;
                }



                //NEW CR
                #region Soft Delete the Source Serial Number
                //Soft delete the Source Serial number
                if (flag)
                {
                    var objSoftDeleteLicensesResponse = new SoftDeleteLicensesResponse();
                    var objSoftDeleteLicensesRequest  = new SoftDeleteLicensesRequest();
                    objSoftDeleteLicensesRequest.RequestID        = objRMASwapRequest.RequestID;
                    objSoftDeleteLicensesRequest.RequestDateTime  = objRMASwapRequest.RequestDateTime;
                    objSoftDeleteLicensesRequest.RequestingSystem = objRMASwapRequest.RequestingSystem;
                    objSoftDeleteLicensesRequest.SNum             = objRMASwapRequest.SourceLicenseSNum;


                    objSoftDeleteLicensesResponse.RequestID        = objSoftDeleteLicensesRequest.RequestID;
                    objSoftDeleteLicensesResponse.ResponseID       = objSoftDeleteLicensesRequest.RequestID;
                    objSoftDeleteLicensesResponse.ResponseDateTime = DateTime.UtcNow;
                    objSoftDeleteLicensesResponse.ResponseStatus   = (int)Constants.ResponseStatus.Success;
                    objSoftDeleteLicensesResponse.ResponseMessage  = Constants.ResponseStatus.Success.ToString();
                    objSoftDeleteLicensesResponse.SNum             = objSoftDeleteLicensesRequest.SNum;

                    objSoftDeleteLicensesBL.ProcessRequest(objSoftDeleteLicensesRequest, objSoftDeleteLicensesResponse);
                    if (objSoftDeleteLicensesResponse.ResponseStatus != (int)Constants.ResponseStatus.Success)
                    {
                        objRMASwapResponse.ResponseMessage += objSoftDeleteLicensesResponse.ResponseMessage.ToString();
                    }
                }

                #endregion
            }
            catch (Exception ex)
            {
                throw new Exception("Error Occured While Processing RMASwap. " + ex.Message + Environment.NewLine + ex.StackTrace);
            }

            return(flag);
        }