Ejemplo n.º 1
0
    public TRT_LocEntity getLocationDetails(string LocId)
    {
        logger.Debug("Service: getLocationDetails() called");
        logger.InfoFormat("Input parameter Location ID : {0} ", LocId);

        try
        {
            TRT_LocEntity result = new TRT_LocEntity();
            TRTInterface getCC_SI = new TRTInterface();
            result = getCC_SI.getLocationsDetails_SI(LocId);
            return result;
        }
        catch (Exception ex)
        {
            webServiceExHandling.ExceptionLog(ex);
            //string mailBody = string.Format(SCT_Constants.mail_BodyFormat, System.DateTime.Now.ToString("F"), PReqNo, ex.TargetSite.ToString(), ex.ToString());
            //webServiceExHandling.Send_Email(SCT_Constants.Email_Dic, mailBody);

            TRT_LocEntity Error = new TRT_LocEntity();
            Error.TRT_header.statusFlag = 1;
            Error.TRT_header.statusMsg = TRT_Constants.Error;

            logger.Error("ErrorCode = " + Error.TRT_header.statusFlag.ToString());
            logger.Error("ErrorMessage = " + Error.TRT_header.statusMsg);
            logger.Error("Service: getLocationsDetails() returning error");
            return Error;
        }
    }
Ejemplo n.º 2
0
        /// <summary>
        /// This function fetches the Location Details from the Sharepoint web service
        /// </summary>
        /// <param name="PST_InputEntity"></param>
        /// <returns>
        /// <paramref name="PST_OutputEntity"/>
        /// </returns>
        /// <history>
        ///     Hari haran      07/05/2012      created
        /// </history>
        /// 
        public TRT_LocEntity getLocationsDetails_DAL(string LocId_BAL)
        {
            logger.Debug("TaxiRequest_DAL: getLocationsDetails_DAL() called");

            try
            {
                logger.DebugFormat("Input parameter Location ID : {0} ", LocId_BAL);

                int plotCount = 0;
                int PurposeCount = 0;

                TaxiSPService.Credentials = new NetworkCredential("bgh29309", "Password1", "asian");
                XmlDocument xmlDoc = new XmlDocument();
                TaxiSPService.Url = "http://awstage.intra.aricent.com/sites/applications/TaxiRequest/_vti_bin/Lists.asmx";

                XmlNode ndLists = TaxiSPService.GetList("Locations");

                string listName = "{CB9EE6A3-C0EC-43ED-948F-1F8B78669937}";
                //string viewName = "{7137FFF8-48FF-4C69-8C76-0E3BBD1EA7F9}";
                string rowLimit = "150";

                /*Use the CreateElement method of the document object to create
                elements for the parameters that use XML.*/
                System.Xml.XmlElement query = xmlDoc.CreateElement("Query");
                System.Xml.XmlElement viewFields =
                    xmlDoc.CreateElement("ViewFields");
                System.Xml.XmlElement queryOptions =
                    xmlDoc.CreateElement("QueryOptions");

                /*To specify values for the parameter elements (optional), assign
                CAML fragments to the InnerXml property of each element.*/
                query.InnerXml = "<Where><Eq><FieldRef Name=\"LocationCode\"/><Value Type=\"Text\">" + LocId_BAL.ToUpper() + "</Value></Eq></Where>";
                viewFields.InnerXml = "<FieldRef Name=\"PlotCode\" />";
                queryOptions.InnerXml = "";

                XmlNode nodePlotList = TaxiSPService.GetListItems(listName, null, query, viewFields, rowLimit, null, null);

                listName = "{AD9A333C-B271-46D3-A524-5825B7D1AFDC}";
                query.InnerXml = "<Where><Eq><FieldRef Name=\"LocationCode\"/><Value Type=\"Text\">" + LocId_BAL.ToUpper() + "</Value></Eq></Where>";
                viewFields.InnerXml = "<FieldRef Name=\"PurposeCode\" />";

                XmlNode nodePurposeList = TaxiSPService.GetListItems(listName, null, query, viewFields, rowLimit, null, null);

                plotCount = Convert.ToInt32(nodePlotList.ChildNodes[1].Attributes["ItemCount"].Value);
                PurposeCount = Convert.ToInt32(nodePurposeList.ChildNodes[1].Attributes["ItemCount"].Value);

                logger.InfoFormat("No of Records returned for Plot Details : {0}", plotCount);
                logger.InfoFormat("No of Records returned for Purpose Details : {0}", PurposeCount);

                if (plotCount > 0 && PurposeCount > 0)
                {
                    TRT_LocEntity Result = new TRT_LocEntity(plotCount, PurposeCount);
                    Result.TRT_header.statusFlag = 0;
                    Result.TRT_header.statusMsg = TRT_Constants.Success;
                    int PlotObjCounter = 0;
                    int PurposeObjCounter = 0;

                    xmlDoc.LoadXml(nodePlotList.OuterXml);
                    XmlNamespaceManager nsMgr = new XmlNamespaceManager(xmlDoc.NameTable);
                    nsMgr.AddNamespace("sp", "http://schemas.microsoft.com/sharepoint/soap/");
                    nsMgr.AddNamespace("rs", "urn:schemas-microsoft-com:rowset");
                    nsMgr.AddNamespace("z", "#RowsetSchema");

                    XmlNodeList plotList = xmlDoc.SelectNodes(".//z:row", nsMgr);

                    foreach (XmlElement elemPlot in plotList)
                    {

                        TRT_LocEntity.Plot plot = new TRT_LocEntity.Plot();
                        plot.ID = elemPlot.Attributes["ows_PlotCode"].Value;
                        plot.Label = elemPlot.Attributes["ows_PlotDesc"].Value;

                        Result.TRT_child_plot[PlotObjCounter++] = plot;

                    }

                    xmlDoc.LoadXml(nodePurposeList.OuterXml);
                    XmlNodeList purposeList = xmlDoc.SelectNodes(".//z:row", nsMgr);

                    foreach (XmlElement elemPurpose in purposeList)
                    {

                        TRT_LocEntity.Purpose purpose = new TRT_LocEntity.Purpose();
                        purpose.ID = elemPurpose.Attributes["ows_PurposeCode"].Value;
                        purpose.Label = elemPurpose.Attributes["ows_PurposeDescription"].Value;

                        Result.TRT_child_purpose[PurposeObjCounter++] = purpose;

                    }

                    logger.Info("In Success case : Flag = " + Result.TRT_header.statusFlag.ToString());
                    logger.Info("In Success case : Message = " + Result.TRT_header.statusMsg);
                    logger.Debug("Method : getLocationsDetails_DAL Stop");

                    return Result;
                }
                else
                {
                    TRT_LocEntity Error = new TRT_LocEntity();
                    Error.TRT_header.statusFlag = 1;
                    Error.TRT_header.statusMsg = "Invalid Location ID";

                    logger.Error("Flag = " + Error.TRT_header.statusFlag.ToString());
                    logger.Error("Message = " + Error.TRT_header.statusMsg);
                    logger.Error("TaxiRequest_DAL: getLocationsDetails_DAL() Stop");

                    return Error;
                }

            }

            catch (Exception ex)
            {
                logger.Error("Exception  At BAL - getLocationsDetails_DAL  : " + ex.Message.ToString());
                logger.Error("TaxiRequest_DAL: getLocationsDetails_DAL() Stop");
                throw ex;
            }
        }
Ejemplo n.º 3
0
        //***************************************************************************************************
        public TRT_LocEntity getLocationsDetails_BAL(string LocId_BAL)
        {
            try
            {
                logger.Debug("TaxiRequest_BAL: getLocationsDetails_BAL() called");
                logger.DebugFormat("Input parameter Location ID : {0} ", LocId_BAL);

                if(!string.IsNullOrEmpty(LocId_BAL))
                {
                    TRT_DAL getLD_BAL = new TRT_DAL();
                    return (getLD_BAL.getLocationsDetails_DAL(LocId_BAL));
                }
                else
                {
                    TRT_LocEntity Error = new TRT_LocEntity();
                    Error.TRT_header.statusFlag = 1;
                    Error.TRT_header.statusMsg = "Location ID is Null/Empty";

                    return Error;
                }

            }

            catch (Exception ex)
            {
                logger.Error("Exception  At BAL - getLocationsDetails_BAL  : " + ex.Message.ToString());
                logger.Error("TaxiRequest_BAL: getLocationsDetails_BAL() Stop");

                throw ex;
            }
        }