protected WebLocationSearch()
 {
     objLocPresenter = new locSearchPresenter(this);
     objNearByPre = new nearbyPointPresenter(this);
     objSvcInfo = ServiceInfo.ServiceConfig;
     objDataPointInfo = DataPointInfo.getDataPointObject;
     objLocInfo = LocationInfo.getLocationInfoObj;
 }
        /*Method to populate the objects. If session is availabel then objects will be populated using seesion objects
        else objects will be populated using values passed from the webservice  * */
        protected void populateObject()
        {
            if (HttpContext.Current != null)
            {
                objLocInfo = LocationInfo.getLocationInfoObj;
                objDataPoint = objLocInfo.DataPointInfo;
            }
            else
            {
                objDataPoint = new DataPointInfo();
                objLocInfo = new LocationInfo();

                objDataPoint.stationLatitude = dStnLatitude;
                objDataPoint.stationLongitude = dStnLongitude;
                objDataPoint.altitude = iAltitude;
                objDataPoint.NearbyPointSettings.MaxAllowedDistance = iMaxAllowedDist;
                objDataPoint.altitude = iMaxAltitudeDiff;
            }
        }
Example #3
0
        public string SerializeCookieString()
        {
            HttpSessionState Session = HttpContext.Current.Session;
            if (HttpContext.Current != null) Session = HttpContext.Current.Session;
            objDataPointInfo = DataPointInfo.getDataPointObject;
            objLocInfo = LocationInfo.getLocationInfoObj;
            if (Session == null || Session["serviceInfo"] == null)
            {

                objSvcInfo = new ServiceInfo();
            }
            else
            {
                objSvcInfo = (ServiceInfo)Session["serviceInfo"];
            }

            return objLocInfo.searchLocation + "#"
                + objLocInfo.placeID + "#"
                + HttpUtility.UrlEncode(objLocInfo.placeName) + "#"
                + objLocInfo.longitude.ToString(NumberFormatInfo.InvariantInfo) + "#"
                + objLocInfo.latitude.ToString(NumberFormatInfo.InvariantInfo) + "#"
                + objLocInfo.CountryCode + "#"
                + objLocInfo.Provider + "#"
                +  objLocInfo.AdminName  + "#"
                + HttpUtility.UrlEncode(objDataPointInfo.stationName) + "#"
                + objDataPointInfo.stationLatitude + "#"
                + objDataPointInfo.stationLongitude + "#"
                + objSvcInfo.Country + "#"
                + objSvcInfo.Culture + "#"
                + objSvcInfo.Module + "#"
                //+ objSvcInfo.ServiceName + "#"
                + objSvcInfo.Unit + "#";
        }
Example #4
0
        public LocationInfo DeserializeCookieString(string cookiestr)
        {
            string[] values = cookiestr.Split('#');
            //int i = 0;
            HttpSessionState Session = HttpContext.Current.Session;
            if (HttpContext.Current != null) Session = HttpContext.Current.Session;
            objDataPointInfo = DataPointInfo.getDataPointObject;
            objLocInfo = LocationInfo.getLocationInfoObj;
            if (Session == null || Session["serviceInfo"] == null)
            {

                objSvcInfo = new ServiceInfo();
            }
            else
            {
                objSvcInfo = (ServiceInfo)Session["serviceInfo"];
            }
            try
            {
                int pid=0;
                double coord=0d;
                searchLocation = (values[0]);
                placeID = Int32.TryParse(values[1],out pid)?pid:0;
                placeName =  HttpUtility.UrlDecode(values[2]);
                longitude = double.TryParse(values[3], out coord) ? coord : 0d;
                latitude = double.TryParse(values[4],out coord)?coord:0d;
                CountryCode = (values[5]);
                if (Enum.IsDefined(typeof(LocationSearchSource), values[6]))
                    Provider = (LocationSearchSource)Enum.Parse(typeof(LocationSearchSource), values[6], true);
                else
                    Provider = LocationSearchSource.defaultService;
                AdminName =  values[7] ;
                objDataPointInfo.stationName = HttpUtility.UrlDecode(values[8]);
                objDataPointInfo.stationLatitude = double.TryParse(values[9],out coord)?coord:0d;
                objDataPointInfo.stationLongitude = double.TryParse(values[10], out coord) ? coord : 0d;
                objSvcInfo.Country = (values[11]);
                objSvcInfo.Culture = (values[12]);
                objSvcInfo.Module = (values[13]);
                //objSvcInfo.ServiceName = (values[14]);
                objSvcInfo.Unit = (values[14]);
                //objDataPointInfo.CheckStationValidity();

            }
            catch
            {
                return null;
            }
            return this;
        }
Example #5
0
        void populateObject()
        {
            /*Changes by jerrey - web service issue - added new condition*/
            //&& objLocInfo != null && objDatapoint != null)
            if (HttpContext.Current != null)
            {
                objLocInfo = (LocationInfo)HttpContext.Current.Session["objLocationInfo"];

                //Web Service Issue
                if (objLocInfo.DataPointInfo != null && objLocInfo.ServiceInfo != null)
                {
                    objDatapoint = objLocInfo.DataPointInfo;
                    objSvcInfo = objLocInfo.ServiceInfo;
                }

                else
                {
                    objDatapoint = new DataPointInfo();
                    objLocInfo = new LocationInfo();
                    objSvcInfo = new ServiceInfo();

                    objDatapoint.SunRise = dTSunrise;
                    objDatapoint.SunSet = dTSunset;

                    objDatapoint.stationLatitude = dLatitude;
                    objDatapoint.stationLongitude = dLongitude;
                    objDatapoint.altitude = altitude;
                    objDatapoint.NearbyPointSettings.MaxAllowedDistance = maxDist;
                    objDatapoint.NearbyPointSettings.MaxAllowedAltitude = maxAlt;
                    objSvcInfo.Culture = strCultureCode;
                    objSvcHandler.setSvcHandlerWebSvcValues(strServiceName, strModuleName);

                    //Web service issue fix
                    objLocInfo.DataPointInfo = objDatapoint;
                    HttpContext.Current.Session["objDataPointInfo"] = objDatapoint;

                    objLocInfo.ServiceInfo = objSvcInfo;

                    HttpContext.Current.Session["objLocationInfo"] = objLocInfo;
                }
            }
        }
Example #6
0
 public DataTable getNearbyData(double Lat, double Long)
 {
     objDatapointInfo = DataPointInfo.getDataPointObject;
     return NearByStationSearchConsumer.GetNearByData(Lat, Long, objDatapointInfo.NearbyPointSettings.MaxAllowedDistance, objDatapointInfo.altitude, objDatapointInfo.NearbyPointSettings.ResultCount, objDatapointInfo.NearbyPointSettings.DataSource, "Agricast V2");
 }
Example #7
0
        void checkFields()
        {
            if (HttpContext.Current != null)
            {

                objDataPointInfo = DataPointInfo.getDataPointObject;
            }
            else
            {
                objDataPointInfo = new DataPointInfo();
            }
            // To check numerals in required fields
            //to be changed to be done from client side
            if (ValidateFields())
            {
                try
                {
                    /*3.1 UC – BodenWasser Modell - display webpage as IFrame - Jerrey - Start*/
                    if (objSvcInfo.Moss == "true" && objSvcInfo.Module.ToLower() == "watermodel" && Session["IAgriInfo"] != null)
                    {
                        objAgriInfo = (Dictionary<string, string>)Session["IAgriInfo"];
                    }
                    /*3.1 UC – BodenWasser Modell - display webpage as IFrame - Jerrey - End*/
                    else
                    {
                        /*3.1 UC – BodenWasser Modell - display webpage as IFrame - Jerrey - End*/
                        objAgriInfo.Clear();
                        //objAgriInfo.Add("startDate", txtstartDate.Value.ToString());
                        string date = ShortMonthDayPattern(oldinfo, newinfo, txtstartDate.Value);
                        DateTime x;
                        //Modify for IM01848073:New Agricast - Agriinfo - error in HU - start
                        //objAgriInfo.Add("startDate", (valid ? DateTime.ParseExact(date, NewCulture.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture).ToShortDateString() : date).ToString());
                        objAgriInfo.Add("startDate", (valid ? DateTime.ParseExact(date, NewCulture.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture).ToShortDateString() : DateTime.TryParse(date, out x) ? date : date.Substring(0, date.Length - 1)).ToString());
                        //Modify for IM01848073:New Agricast - Agriinfo - error in HU - end
                        string EndDate = getEndDate();
                        //Modify for Date Issue - 20140606 - Start
                        //objAgriInfo.Add("endDate", EndDate);
                        if (EndDate.EndsWith("/"))
                        {
                            EndDate = EndDate.Remove(EndDate.LastIndexOf("/"), 1);
                        }
                        if (!DateTime.TryParse(EndDate, out x) && oldinfo.LongDatePattern.ToString() == "yyyy. MMMM d.")
                        {
                            EndDate = EndDate.Replace(".", "/");
                        }
                        objAgriInfo.Add("endDate", (DateTime.TryParse(EndDate, out x) ? x.ToShortDateString() : DateTime.ParseExact(EndDate, NewCulture.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture).ToShortDateString()).ToString());
                        //Modify for Date Issue - 20140606 - End
                        objAgriInfo.Add("aggregation", ddlAggregate.SelectedValue.ToString());
                        if (txtPlantingDate.Value != string.Empty)
                        {
                            string plntDate = ShortMonthDayPattern(oldinfo, newinfo, txtPlantingDate.Value);
                            objAgriInfo.Add("plantingDate", (valid ? DateTime.ParseExact(plntDate, NewCulture.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture).ToShortDateString() : plntDate).ToString());
                        }
                        else
                        {
                            objAgriInfo.Add("plantingDate", "");
                        }
                        string altitude = "";
                        //if altitude is in feet, convert it to metres and add to object
                        if (objSvcInfo.Unit.ToLower().Equals("imperial", StringComparison.CurrentCultureIgnoreCase))
                        {
                            /*IM01288866 - New Agricast - altitude adjustement taking feet and not meters-Begin*/
                            //if (txtAltitude.Value != string.Empty && lblMasl.InnerText == Constants.FEET_ASL)
                            if (txtAltitude.Value != string.Empty && lblMasl.InnerText == objComUtil.getTransText(Constants.FEET_ASL))
                                altitude = objComUtil.ConvertValueMetrics(txtAltitude.Value, "ft-m");
                            /*IM01288866 - New Agricast - altitude adjustement taking feet and not meters-end*/

                        }
                        else
                        {
                            altitude = txtAltitude.Value.ToString();
                        }

                        objAgriInfo.Add("altitude", altitude);

                        if (EndDate != "")//Add for  IM01838379:Cookie Issue
                        {
                            //Modify for Date Issue - 20140606 - Start
                            string EndDate2 = EndDate;
                            string date2 = date;
                            bool valid2 = valid;
                            if (date2.EndsWith("."))
                            {
                                date2 = date2.Remove(date2.LastIndexOf("."), 1);
                            }
                            //newinfo.LongDatePattern="dd MMMM yyyy" and newinfo.LongDatePattern="dddd, MMMM dd, yyyy" can't be changed to Datetime
                            if (!DateTime.TryParse(EndDate2, out x))
                            {
                                EndDate2 = EndDate2.Replace(".", "/").Replace("-", "/");
                                if (!DateTime.TryParse(EndDate2, out x))
                                {
                                    string[] a = EndDate.Split('/');
                                    EndDate2 = a[1] + "/" + a[0] + "/" + a[2];
                                }
                            }
                            if (!DateTime.TryParse(date2, out x))
                            {
                                date2 = date.Replace(".", "/").Replace("-", "/");
                                if (date2.EndsWith("/"))
                                {
                                    date2=date2.Remove(date2.LastIndexOf("/"), 1);
                                }
                                if (!DateTime.TryParse(date2, out x))
                                {
                                    string[] b = date2.Split('/');
                                    date2 = b[1] + "/" + b[0] + "/" + b[2];
                                }
                            }
                            if (valid2 == true)
                            {
                                if (!DateTime.TryParse(DateTime.ParseExact(date, NewCulture.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture).ToShortDateString(), out x))
                                {
                                    valid2 = false;
                                }
                            }

                            //Commented by Rahul
                            //TimeSpan diffDate = DateTime.Parse(EndDate).Subtract(DateTime.Parse(txtstartDate.Value.ToString()));
                            //TimeSpan diffDate = DateTime.Parse(EndDate).Subtract(valid ?
                            //                        DateTime.Parse(DateTime.ParseExact(date, NewCulture.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture).ToShortDateString())
                            //                      : DateTime.Parse(date));
                            TimeSpan diffDate = DateTime.Parse(EndDate2).Subtract(valid2 ?
                                                    DateTime.Parse(DateTime.ParseExact(date, NewCulture.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture).ToShortDateString())
                                                  : DateTime.Parse(date2));
                            //Modify for Date Issue - 20140606 - End
                            //Added by Rahul
                            //TimeSpan diffDate = DateTime.Parse(EndDate).Subtract(DateTime.Parse(GetDateInCorrectFormat(txtstartDate.Value.ToString(), true)));
                            int duration = diffDate.Days + 1;

                            string agg = ddlAggregate.SelectedValue.ToString().ToLower();
                            if ((duration < 7 && agg == "weekly") || (duration < 10 && agg == "decade") || (duration < 30 && agg == "monthly"))
                            {
                                HttpContext.Current.Session["ErrorMessage"] = TranslatedText(Constants.ERROR_AGGREGATION_RANGE);
                                return;
                            }

                            else
                            {
                                AggregationValid = true;
                            }
                        }
                        //if (duration < 7 && ddlAggregate.SelectedValue.ToString().ToLower() != "dy")
                        //{
                        //    HttpContext.Current.Session["ErrorMessage"] = TranslatedText("Aggregation should be smaller than duration.");
                        //    return;
                        //}
                        //else if (duration > 10 && duration < 30 && (ddlAggregate.SelectedValue.ToString().ToLower() != "dc" || ddlAggregate.SelectedItem.ToString().ToLower() != "wy" || ddlAggregate.SelectedItem.ToString().ToLower() != "dy"))
                        //{
                        //    HttpContext.Current.Session["ErrorMessage"] = TranslatedText("Aggregation should be smaller than duration.");
                        //    return;
                        //}
                        /*3.1 UC – BodenWasser Modell - display webpage as IFrame - Jerrey - Start*/
                        double topSoilWHC = 0.0, subSoilWHC = 0.0;
                        switch (ddlTopSoilType.SelectedValue)
                        {
                            case "Sd": topSoilWHC = 0.07; break;
                            case "Lm": topSoilWHC = 0.15; break;
                            case "Sl": topSoilWHC = 0.14; break;
                            case "Ls": topSoilWHC = 0.11; break;
                            case "Cy": topSoilWHC = 0.18; break;
                            case "So": topSoilWHC = 0.155; break;
                            default: topSoilWHC = 0.0; break;
                        }

                        switch (ddlSubSoilType.SelectedValue)
                        {
                            case "Sd": subSoilWHC = 0.07; break;
                            case "Lm": subSoilWHC = 0.15; break;
                            case "Sl": subSoilWHC = 0.14; break;
                            case "Ls": subSoilWHC = 0.11; break;
                            case "Cy": subSoilWHC = 0.18; break;
                            case "So": subSoilWHC = 0.155; break;
                            default: subSoilWHC = 0.0; break;
                        }
                        objAgriInfo.Add("TopSoilWHC", topSoilWHC.ToString());
                        objAgriInfo.Add("SubSoilWHC", subSoilWHC.ToString());

                        if (string.IsNullOrWhiteSpace(txtTopSoilDepth.Value))
                            objAgriInfo.Add("TopSoilDepth", "0");
                        else
                            objAgriInfo.Add("TopSoilDepth", txtTopSoilDepth.Value);

                        if (string.IsNullOrWhiteSpace(txtSubSoilDepth.Value))
                            objAgriInfo.Add("SubSoilDepth", "0");
                        else
                            objAgriInfo.Add("SubSoilDepth", txtSubSoilDepth.Value);
                        /*3.1 UC – BodenWasser Modell - display webpage as IFrame - Jerrey - End*/
                        Session["IAgriInfo"] = objAgriInfo;
                    }
                }
                catch (Exception ex)
                {
                    HttpContext.Current.Session["ErrorMessage"] = TranslatedText(Constants.GENERIC_ERRORONPAGE) + ":" + ex.Message.ToString();
                    throw ex;
                }
            }
            else
            {
                HttpContext.Current.Session["ErrorMessage"] = ((HttpContext.Current.Session["ErrorMessage"]).ToString() == string.Empty) ? "Please enter correct values." : (HttpContext.Current.Session["ErrorMessage"]).ToString();
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session == null || Session["serviceInfo"] == null)
            objSvcInfo = new ServiceInfo();
        else
            objSvcInfo = (ServiceInfo)Session["serviceInfo"];

        objDataPointInfo = DataPointInfo.getDataPointObject;
        objLocInfo = new LocationInfo();

        HttpCookie locCookie = Request.Cookies["ais_LocationInfo"];
        if (locCookie != null)
        {
            LocationInfo newInfo = objLocInfo.DeserializeCookieString(locCookie.Value);
            if (newInfo != null)
            {
                Session["objLocationInfo"] = newInfo;
                objLocInfo = newInfo;
            }
            if (Session["AuditData"] != null)
            {
                IDictionary dict = (IDictionary)Session["AuditData"];
                dict["locSearchType"] = "By Cookie";
                Session["AuditData"] = dict;
            }
        }

        objSvcPre = new ServicePresenter(this);

        //set the Cutlure code from ObjLocation object to Service info
        //this is used in Login page for tranlsation
        if (objLocInfo != null && objLocInfo.ServiceInfo != null)
            objSvcInfo.Culture = objLocInfo.ServiceInfo.Culture;

        objSvcPre.getNodeList1("servicePage");
        // get weather icon info
        var iconNode = alNodeList.FirstOrDefault(q => q[0].ToString() == "icon");
        if (iconNode != null)
        {
            common.LoadCtrl<Icon>(this.Page, weatherIcons, "Icon", iconNode[1].ToString(), "");
        }
        /* Agricast CR - R6 - Add wind icons and legend for Humidity - Begin */

        /*Wind icons a seperate entity - BEGIN*/
        var windIconNode = alNodeList.FirstOrDefault(q => q[0].ToString() == "windIcon");
        if (windIconNode != null)
        {
            //common.LoadCtrl(this.Page, windIcons, "WebChartIcons");
            common.LoadCtrl<WebChartIcons>(this.Page, windIcons, "WebChartIcons", windIconNode[1].ToString(), "");
        }
        /*Wind icons a seperate entity - END*/
        /* Agricast CR - R6 - Add wind icons and legend for Humidity - End */

        var imgPath = HttpUtility.UrlDecode(Request.QueryString["img"]).Replace("'","").Replace('>',' ').Replace('<', ' ').Replace('"',' ').Replace(':',' ').Replace(';',' ');
        if (!string.IsNullOrEmpty(imgPath))
        {
            imgPath = Server.HtmlDecode(imgPath);
            if (!IsPostBack)
            {
                imgBigger.ImageUrl = imgPath;
            }
        }
    }
Example #9
0
        /*Method to populate the objects. If session is availabel then objects will be populated using seesion objects
        else objects will be populated using values passed from the webservice  * */
        protected void populateObject()
        {
            /*Changes by jerrey - web service issue - added new condition*/
            if (HttpContext.Current != null)
            //
            {

                objLocInfo = LocationInfo.getLocationInfoObj;

                //Web service issue
                if (objLocInfo.DataPointInfo != null)
                {
                    objDataPoint = objLocInfo.DataPointInfo;
                }

                else
                {
                    objDataPoint = new DataPointInfo();
                    objLocInfo = new LocationInfo();

                    objDataPoint.stationLatitude = dStnLatitude;
                    objDataPoint.stationLongitude = dStnLongitude;
                    objDataPoint.altitude = iAltitude;
                    objDataPoint.NearbyPointSettings.MaxAllowedDistance = iMaxAllowedDist;
                    objDataPoint.altitude = iMaxAltitudeDiff;

                }
            }
        }
Example #10
0
        public bool AddToFavorites(string strFavName)
        {
            //Update the Dt Favorites Datatable in session
            ObjUserInfo = (UserInfo)HttpContext.Current.Session["objUserInfo"];

            //Location Info object - moved code here  - trans message change
            objLocationinfo = (LocationInfo)HttpContext.Current.Session["objLocationInfo"];

            if (ObjUserInfo != null)
            {
                //Check if the Newly Added Key allreeady Exists in datatable
                //check whether the the Dictionary key exists in Datatable
                var res = from p in ObjUserInfo.DtFavorites.AsEnumerable()
                          where p[Constants.FAV_FAVORITENAME].Equals(strFavName)
                          select p[Constants.FAV_FAVORITENAME];

                //when no matach found
                if (res.ToList().Count == 1)
                {
                    isFavoriteAdded = false;
                    HttpContext.Current.Session["ErrorMessage"] = getTranslatedText(Constants.FAVORITE_UPDATE_DUPLICATE, objLocationinfo.ServiceInfo.Culture) + strFavName + getTranslatedText(Constants.GENERIC_ALREADYEXISTS, objLocationinfo.ServiceInfo.Culture);

                }
                else
                {
                    //Fetch all the Values from Session
                    isFavoriteAdded = true;

                    //Check if the Object is null
                    if (ObjUserInfo != null)
                    {
                        dtTemp = ObjUserInfo.DtFavorites;

                        dr = dtTemp.NewRow();

                        //Take the User Entered Favorite name
                        dr[Constants.FAV_Key] = strFavName.Trim();
                        dr[Constants.FAV_FAVORITENAME] = strFavName.Trim();

                        //Fetch Id from LocationInfo Object
                        if (objLocationinfo != null)
                        {
                            //Fetch the Datapoint Info from Location Info itself
                            objDataPointInfo = objLocationinfo.DataPointInfo;

                            //Fetch the Service Info from Location Info itself
                            objServiceInfo = objLocationinfo.ServiceInfo;

                            dr[Constants.FAV_ALTITUDE] = objDataPointInfo.altitude;//Altitude
                            dr[Constants.FAV_LATITUDE] = objLocationinfo.latitude;//Place - Latitude
                            dr[Constants.FAV_LONGITUDE] = objLocationinfo.longitude;//Place - Longitiude
                            dr[Constants.FAV_PLACENAME] = objLocationinfo.placeName;//PlaceName

                            dr[Constants.FAV_PLACEID] = objLocationinfo.placeID;//Place ID

                            dr[Constants.FAV_SERVICENAME] = objServiceInfo.ServiceName;//ServieName

                            dr[Constants.FAV_MODULENAME] = objServiceInfo.Module;//ModuleName
                        }

                        //add the New Row to DtFavorites
                        dtTemp.Rows.Add(dr);

                        ObjUserInfo.DtFavorites = dtTemp;

                        //Add the Userinfo Back to Sessions
                        HttpContext.Current.Session["ObjUserInfo"] = ObjUserInfo;
                    }
                }
            }
            return isFavoriteAdded;
        }
Example #11
0
        public void ReadQueryStringValues()
        {
            if (HttpContext.Current.Session == null || HttpContext.Current.Session["serviceInfo"] == null)
            {

                objServiceInfo = new ServiceInfo();
            }
            else
            {
                objServiceInfo = (ServiceInfo)HttpContext.Current.Session["serviceInfo"];
            }

            objLocInfo = LocationInfo.getLocationInfoObj;

            objDataPointInfo = DataPointInfo.getDataPointObject;
            if (HttpContext.Current.Request.QueryString["module"] != null)
            {
                //if (objSvcInfo.Module != HttpContext.Current.Request.QueryString["module"])
                //{
                //    if (HttpContext.Current.Session["Rating"] != null)
                //    {
                //        SaveRatings();

                //    }
                //}
                objServiceInfo.Module = HttpContext.Current.Request.QueryString["module"];
            }

            if (HttpContext.Current.Request.QueryString["Culture"] != null)
            {
                objServiceInfo.Culture = HttpContext.Current.Request.QueryString["Culture"];
            }
            if (HttpContext.Current.Request.QueryString["Country"] != null)
            {
                objServiceInfo.Country = HttpContext.Current.Request.QueryString["Country"];
                objLocInfo.CountryCode = HttpContext.Current.Request.QueryString["Country"];
            }
            if (HttpContext.Current.Request.QueryString["Unit"] != null)
            {
                objServiceInfo.ServiceName = HttpContext.Current.Request.QueryString["Unit"];
            }
            if (HttpContext.Current.Request.QueryString["Placename"] != null)
            {
                objLocInfo.searchLocation = HttpContext.Current.Request.QueryString["Placename"];
                //Clearing off datapoint object in case search crtieria is given in query string
                objDataPointInfo = null;
                objLocInfo.DataPointInfo = null;
                //HttpContext.Current.Session["objDataPointInfo"] = null;

            }

            if (HttpContext.Current.Request.QueryString["Latitude"] != null && HttpContext.Current.Request.QueryString["Longitude"] != null)
            {
                objLocInfo.latitude = Convert.ToDouble(HttpContext.Current.Request.QueryString["Latitude"]);
                objLocInfo.longitude = Convert.ToDouble(HttpContext.Current.Request.QueryString["Longitude"]);

                if (HttpContext.Current.Request.QueryString["Placename"] == null)
                    objLocInfo.placeName = "Lat: " + objLocInfo.latitude + " Long: " + objLocInfo.longitude;

                //Clearing off datapoint object in case search crtieria is given in query string
                objDataPointInfo = null;
                objLocInfo.DataPointInfo = null;
                // HttpContext.Current.Session["objDataPointInfo"] = null;
            }
        }
Example #12
0
 /// <summary>
 /// Constructor
 /// </summary>
 public ChartService()
 {
     loc = LocationInfo.getLocationInfoObj;
     dpi = (DataPointInfo)loc.DataPointInfo;
 }
Example #13
0
        public void getPubSettings(string chartName, DataTable agriInfoData)
        {
            if (HttpContext.Current != null)
            {
                if (HttpContext.Current.Session == null || HttpContext.Current.Session["serviceInfo"] == null)
                {

                    objServiceInfo = new ServiceInfo();
                }
                else
                {
                    objServiceInfo = (ServiceInfo)HttpContext.Current.Session["serviceInfo"];
                }
            }

            else
            {
                objServiceInfo = new ServiceInfo();
                dpi = new DataPointInfo();

                dpi.stationLatitude = dStnLatitude;
                dpi.stationLongitude = dStnLongitude;
                dpi.altitude = iAltitude;
                dpi.NearbyPointSettings.MaxAllowedDistance = iMaxAllowedDist;
                dpi.NearbyPointSettings.MaxAllowedAltitude = iMaxAltitudeDiff;

                sh.setSvcHandlerWebSvcValues(strServiceName, strModulename);
            }

            //Web service Issue
            if (dpi == null)
            {
                dpi = new DataPointInfo();
                dpi.stationLatitude = dStnLatitude;
                dpi.stationLongitude = dStnLongitude;
                dpi.altitude = iAltitude;
                dpi.NearbyPointSettings.MaxAllowedDistance = iMaxAllowedDist;
                dpi.NearbyPointSettings.MaxAllowedAltitude = iMaxAltitudeDiff;

                sh.setSvcHandlerWebSvcValues(strServiceName, strModulename);
            }
            //end of web service change

            /* Agricast CR - R3 - Web service changes (background Image for each cell and color) and chart zooming feature - Begin */
            /* 3.3.1	Charting component should have zooming enabled. */
            dsData.Tables.Clear();
            /* Agricast CR - R3 - Web service changes (background Image for each cell and color) and chart zooming feature - End */

            dsData.Tables.Add(sh.getChartSettings(chartName));
            dtSource = dsData.Tables[CHART].Rows[0]["dataSource"].ToString();
            if (dsData.Tables[CHART].Columns.Contains("temporalAggregation"))
                temporalAgg = dsData.Tables[CHART].Rows[0]["temporalAggregation"].ToString();
            if (dsData.Tables[CHART].Columns.Contains("startdate"))
                _start = Int32.Parse(dsData.Tables[CHART].Rows[0]["startdate"].ToString());
            if (dsData.Tables[CHART].Columns.Contains("enddate"))
                _end = Int32.Parse(dsData.Tables[CHART].Rows[0]["enddate"].ToString());
            noofdays = Math.Abs(_end) - Math.Abs(_start);
            if (dsData.Tables[CHART].Columns.Contains("labelstep"))
                switch (dsData.Tables[CHART].Rows[0]["labelstep"].ToString())
                {
                    case "1":
                        dfactor = 1;
                        break;
                    case "24":
                        dfactor = 24;
                        break;
                    case "10":
                        dfactor = 10;
                        break;
                    case "8":
                        dfactor = 8;
                        break;
                    case "12":
                        dfactor = 12;
                        break;
                    case "7":
                        dfactor = 7;
                        break;
                    case "monthly":
                        dfactor = 30;
                        break;
                    default:
                        break;
                }
            /*3.1 UC – BodenWasser Modell - display webpage as IFrame - Jerrey - Start*/
            //if (objServiceInfo.Module.ToLower().Contains("history"))
            if (objServiceInfo.Module.ToLower().Contains("history") || objServiceInfo.Module.ToLower().Contains("watermodel"))
            /*3.1 UC – BodenWasser Modell - display webpage as IFrame - Jerrey - End*/
            {
                dsData.Tables.Add(agriInfoData);
            }
            else
            {
                dsData.Tables.Add(sh.GetChartSeries(chartName));
            }
            dsData.Tables.Add(sh.GetAxes(chartName, "P"));
            dsData.Tables.Add(sh.GetAxes(chartName, "S"));
        }