Example #1
0
        public void changeLabelText(string strCultureCode)
        {
            try
            {
                /*IM01289946-New Agricast - Add a * on mandatory fields-BEGIN*/
                string strSpanMandatory = "<span class=\"mandatory\"> * </span>";
                /*IM01289946-New Agricast - Add a * on mandatory fields-END*/
                objPreTool = new ToolBarPresenter(this);

                /* UAT Tracker 519	Email - translation of the default values of Email fields - Begin*/
                Tomail.Attributes.Add("placeholder", objPreTool.getTranslatedText("Enter the email addresses ; seperated", strCultureCode));
                Subject.Attributes.Add("placeholder", objPreTool.getTranslatedText("Enter the email subject.", strCultureCode));
                txtBody.Attributes.Add("placeholder", objPreTool.getTranslatedText("Enter the email subject.", strCultureCode));
                /* UAT Tracker 519	Email - translation of the default values of Email fields - End*/

                //Set the ToolTip Text of Toolbar Images
                imgPrint.ToolTip = objPreTool.getTranslatedText(Constants.PRINT_PAGE, strCultureCode);
                imgEmail.Attributes["title"] = objPreTool.getTranslatedText(Constants.EMAIL, strCultureCode);
                btnExcel.ToolTip = objPreTool.getTranslatedText(Constants.EXCEL, strCultureCode);
                imgFav.Attributes["title"] = objPreTool.getTranslatedText(Constants.FAVORITES, strCultureCode);
                imgFB.Attributes["title"] = objPreTool.getTranslatedText(Constants.FEEDBACK, strCultureCode);

                //Set the Label within Custom Div
                lblWind.InnerText = objPreTool.getTranslatedText(Constants.WIND, strCultureCode);
                btnOK.Text = objPreTool.getTranslatedText(Constants.OK, strCultureCode);
                btnCancel.Text = objPreTool.getTranslatedText(Constants.CANCEL, strCultureCode);
                /*IM01289946-New Agricast - Add a * on mandatory fields-BEGIN*/
                //Fee_EmailAddress.InnerText = objPreTool.getTranslatedText(Constants.FEE_TO_EMAIL_ADDRESS, strCultureCode);
                Fee_EmailAddress.InnerHtml = objPreTool.getTranslatedText(Constants.FEE_TO_EMAIL_ADDRESS, strCultureCode) + strSpanMandatory;
                /*IM01289946-New Agricast - Add a * on mandatory fields-END*/
                tb_subject.InnerText = objPreTool.getTranslatedText(Constants.SUBJECT, strCultureCode);
                mailbody.InnerText = objPreTool.getTranslatedText(Constants.MAILBODY, strCultureCode);
                EMailPage.Text = objPreTool.getTranslatedText(Constants.EMAIL_PAGE, strCultureCode);
                Fav_AddToFavorites.Text = objPreTool.getTranslatedText(Constants.FAV_ADD_TO_FAVOURITES, strCultureCode);
                if (gvFavorites.Rows.Count != 0)
                {

                    (gvFavorites.HeaderRow.Cells[0]).Text = objPreTool.getTranslatedText(Constants.NAME, strCultureCode);
                    (gvFavorites.HeaderRow.Cells[1]).Text = objPreTool.getTranslatedText(Constants.SERVICE, strCultureCode);
                    (gvFavorites.HeaderRow.Cells[2]).Text = objPreTool.getTranslatedText(Constants.LOCATION_NAME, strCultureCode);
                    for (int i = 0; i < gvFavorites.Rows.Count; i++)
                    {
                        /* IM01365225 - New Agricast - favorite - Service Name - Jerrey - Begin */
                        // Commented by Jerrey - IM01365225
                        //gvFavorites.Rows[i].Cells[1].Text = objPreTool.getTranslatedText(gvFavorites.Rows[i].Cells[1].Text, strCultureCode);
                        gvFavorites.Rows[i].Cells[1].Text = objPreTool.getTranslatedText((gvFavorites.Rows[i].Cells[1].Controls[1] as Label).Text, strCultureCode);
                        /* IM01365225 - New Agricast - favorite - Service Name - Jerrey - End */
                    }

                }
                Welcome.InnerText = objPreTool.getTranslatedText(Constants.WELCOME, strCultureCode);
                /*IM01289946-New Agricast - Add a * on mandatory fields-BEGIN*/

                lblFavName.InnerHtml = objPreTool.getTranslatedText(Constants.NAME, strCultureCode) + strSpanMandatory;

                //lblName.InnerText = objPreTool.getTranslatedText(Constants.NAME, strCultureCode);

                /*IM01294326 -New Agricast - Feedback section - Begin*/
                //Create a new Transtag for Feedback name
                lblName.InnerHtml = objPreTool.getTranslatedText(Constants.FEEDBACK_SUBJECT, strCultureCode) + strSpanMandatory;
                /*IM01294326 -New Agricast - Feedback section - End*/

                //lblEmail.InnerText = objPreTool.getTranslatedText(Constants.EMAIL, strCultureCode);
                lblEmail.InnerHtml = objPreTool.getTranslatedText(Constants.EMAIL, strCultureCode) + strSpanMandatory;

                //lblMessage.InnerText = objPreTool.getTranslatedText(Constants.YOUR_COMMENTS, strCultureCode);
                lblMessage.InnerHtml = objPreTool.getTranslatedText(Constants.YOUR_COMMENTS, strCultureCode) + strSpanMandatory;

                lblRating.InnerText = objPreTool.getTranslatedText(Constants.RATE_THIS_SITE, strCultureCode);

                //lblCaptcha.InnerText = objPreTool.getTranslatedText(Constants.CAPTCHA_EXPLANATION, strCultureCode);
                lblCaptcha.InnerHtml = objPreTool.getTranslatedText(Constants.CAPTCHA_EXPLANATION, strCultureCode) + strSpanMandatory;
                /*IM01289946-New Agricast - Add a * on mandatory fields-END*/

                btnSendMsg.Text = objPreTool.getTranslatedText(Constants.SEND, strCultureCode);
                /*IM01246263 - New Agricast - Add a new translation tag  - BEGIN*/
                lblFeedBackHeader.InnerText = objPreTool.getTranslatedText(Constants.FEEDBACK_HEADER, strCultureCode);
                /*IM01246263 - New Agricast - Add a new translation tag  - END*/

                /* July 23, Spritzwetter - Added by Jerrey - Begin */

                BindRangeDropDownListItems(strCulCode);

                var hintsMsg = string.Format(@"<div style=""font-size:10px; padding-left:20px;""><br />{0}<br /><br /></div>",
                        objPreTool.getTranslatedText(Constants.HINTS_MESSAGE, strCulCode));
                txtHintsMessageOfFeedback.Text = hintsMsg;
                txtHintsMessageOfEmail.Text = hintsMsg;
                /* July 23, Spritzwetter - Added by Jerrey - End */
            }
            catch (Exception ex)
            {
                AgriCastException currEx = new AgriCastException(objServicePre.GetServiceDetails(), ex);
                AgriCastLogger.Publish(currEx, AgriCastLogger.LogType.Error);
                HttpContext.Current.Session["ErrorMessage"] = objPreTool.getTranslatedText(Constants.TRANSLATION_FAILURE, strCulCode) + ex.Message.ToString();
            }
        }
Example #2
0
 public bool ValidateCaptcha(string text)
 {
     objPreTool = new ToolBarPresenter(this);
     objPreTool.getCultureCode();
     try
     {
         HttpSessionState session = HttpContext.Current.Session;
         if (text.ToLower() == ((string)session["captcha"]).ToLower())
             return true;
         else
             return false;
     }
     catch (Exception ex)
     {
         AgriCastException currEx = new AgriCastException(objServicePre.GetServiceDetails(), ex);
         AgriCastLogger.Publish(currEx, AgriCastLogger.LogType.Error);
         HttpContext.Current.Session["ErrorMessage"] = objPreTool.getTranslatedText(Constants.FEEDBACK_CAPTCHA_VALIDATION, strCulCode) + ex.Message.ToString();
         return false;
     }
 }
Example #3
0
        public void btnSendMsg_Click(object sender, EventArgs e)
        {
            try
            {
                string text = txtCaptcha.Text;
                //LStatus.Text = ErrorMessage;
                // LStatus.Text = SuccessMessage;
                isFeedback = true;
                objPreTool = new ToolBarPresenter(this);
                objPreTool.getCultureCode();
                if ((feedbackName != null && feedbackEmail != null && feedbackMessage != null) && (feedbackName != "" && feedbackEmail != "" && feedbackMessage != ""))
                {

                    string MatchEmailPattern = @"^(([\w-]+\.)+[\w-]+|([a-zA-Z]{1}|[\w-]{2,}))@"
                                                 + @"((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\."
                                                 + @"([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|"
                                                 + @"([a-zA-Z]+[\w-]+\.)+[a-zA-Z]{2,4})$";

                    bool validateEmail = Regex.IsMatch(feedbackEmail, MatchEmailPattern);
                    if (validateEmail)
                    {

                        lblEmailError.Text = "";
                        if (text == "")
                        {
                            //LStatus.Text = objPreTool.getTranslatedText(EMPTY_CAPTCHA, strCulCode);
                            HttpContext.Current.Session["ErrorMessage"] = objPreTool.getTranslatedText(Constants.FEEDBACK_EMPTY_CAPTCHA, strCulCode);
                        }
                        else
                        {
                            if (ValidateCaptcha(text))
                            {
                                string Rating = hdnFeedbackRating.Value;
                                /*IM01294335	New Agricast - rating not sent - Begin*/
                                //string mailBody = objPreTool.getTranslatedText(Constants.USER_RATING, strCulCode) + " : " + Rating + " <br /> " + feedbackMessage;
                                string mailBody = objPreTool.getTranslatedText(Constants.USER_RATING, strCulCode) + " : " + Rating + " <br /> " +
                                    objPreTool.getTranslatedText(Constants.USER_COMMENT, strCulCode) + " : " + feedbackMessage;
                                /*IM01294335	New Agricast - rating not sent - End*/
                                objPreTool.SendMail(feedbackName, alEmailSettings[1].ToString(), feedbackEmail, mailBody);
                                //LStatus.Text = SUCCESS_MESSAGE;
                                //HttpContext.Current.Session["ErrorMessage"] = objPreTool.getTranslatedText(Constants.FEEDBACK_SUCCESS, strCulCode);
                                HttpContext.Current.Session["SuccessMessage"] = objPreTool.getTranslatedText(Constants.FEEDBACK_SUCCESS, strCulCode);
                                isFeedback = true;//show feedback grid after sending msg
                                //clear Captcha and Comments
                                txtCaptcha.Text = string.Empty;
                                txtName.Value = string.Empty;
                                TextareaMessage.InnerText = string.Empty;
                                txtEmail.Value = string.Empty;
                                LoadAnother();
                            }
                            else
                            {
                                //LStatus.Text = objPreTool.getTranslatedText(ErrorMessage, strCulCode);
                                HttpContext.Current.Session["ErrorMessage"] = objPreTool.getTranslatedText(Constants.FEEDBACK_INCORRECT_CAPTCHA, strCulCode);
                                LoadAnother();
                                txtCaptcha.Text = "";
                            }
                        }
                    }
                    else
                    {
                        //lblEmailError.Text = objPreTool.getTranslatedText(EMAIL_ERROR, strCulCode);
                        HttpContext.Current.Session["ErrorMessage"] = objPreTool.getTranslatedText(Constants.FEEDBACK_EMAIL_VALIDATION, strCulCode);
                        //LStatus.Text = "";
                        LoadAnother();
                        txtCaptcha.Text = "";
                    }

                }
                else
                {
                    //LStatus.Text = objPreTool.getTranslatedText(FILL_FORM, strCulCode);
                    HttpContext.Current.Session["ErrorMessage"] = objPreTool.getTranslatedText(Constants.FEEDBACK_FILLFORM, strCulCode);
                    LoadAnother();
                    txtCaptcha.Text = "";
                }

            }
            catch (Exception ex)
            {
                AgriCastException currEx = new AgriCastException(objServicePre.GetServiceDetails(), ex);
                AgriCastLogger.Publish(currEx, AgriCastLogger.LogType.Error);
                HttpContext.Current.Session["ErrorMessage"] = objPreTool.getTranslatedText(Constants.FEEDBACK_GENERROR, strCulCode) + ex.Message.ToString();
            }
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                objPreTool = new ToolBarPresenter(this);
                objSvcInfo = (ServiceInfo)Session["serviceInfo"];
                objLocInfo = (LocationInfo)Session["objLocationInfo"];
                objSvcPre = new ServicePresenter();
                if (!IsPostBack)
                {

                    //Set the UserName
                    objUserInfo = (UserInfo)Session["objuserinfo"];
                    if (objUserInfo != null)
                    {
                        /*IM01246266 - New Agricast - can't save a favourite - Begin */
                        //userName.InnerText = objUserInfo.UserName;
                        if (!string.IsNullOrEmpty(objUserInfo.UserName))
                        {
                            if (objUserInfo.UserName.IndexOf('^') > -1)
                            {
                                userName.InnerText = objUserInfo.UserName.Substring(objUserInfo.UserName.IndexOf('^') + 1);
                            }
                        }
                        /*IM01246266 - New Agricast - can't save a favourite - End */
                    }

                    objSvcPre = new ServicePresenter(this);

                    string strLink = ConfigurationManager.AppSettings["link"];
                    userName.HRef = strLink;
                    //objSvcPre.createServiceSession("Demo");

                    objPreTool.loadPageSettings();

                    if (!showFavorites)
                    {
                        imgFav.Visible = false;
                    }
                    else
                    {
                        //getFavorites();
                        /*IM01246233 :- New Agricast - missing translation tags - Begin */
                        //add the clientclick event for validation only when Email is enabled

                        Fav_AddToFavorites.Attributes.Add("OnClick", "Javascript:return ValidateFavName(" + "'" + objCommonUtil.getTransText(Constants.FAV_NAME_EMPTY_CHECK) + "'" + ");");
                        /*IM01246233 :- New Agricast - missing translation tags - End */
                    }

                    if (!showPrint)
                        imgPrint.Visible = false;

                    if (!showEmail)
                        imgEmail.Visible = false;
                    /*IM01246233 :- New Agricast - missing translation tags - Begin */
                    else
                    {
                        //add the clientclick event for validation only when Email is enabled
                        EMailPage.Attributes.Add("OnClick", "Javascript:return ValidateEMail(" + "'" + objCommonUtil.getTransText(Constants.EMAIL_ID_EMPTY_CHECK) + "'" + ");");
                    }
                    /*IM01246233 :- New Agricast - missing translation tags - End */

                    if (!showExportExcel)
                        btnExcel.Visible = false;

                    if (!showFeedback)
                        imgFB.Visible = false;

                    LoadCulture();

                    objPreTool.getCultureCode();
                    changeLabelText(strCulCode);

                }

                //Load units if not postback or in case culture has changed.
                if ((!IsPostBack) || ddlCulture.SelectedValue != objSvcInfo.Culture)
                    LoadUnits();

                LoadCustomSettings();

                getFavorites();
                if (!IsPostBack)
                {
                    LoadCaptcha();
                    //set the first value in Dropdown as default unit and add it o session
                    DefaultUnitSettings = dtUnits.Rows[0][0].ToString();
                    if (objSvcInfo.Unit.Trim() != "")
                    {int count=0;
                       for(int i=0; i< dtUnits.Rows.Count; i++)
                       {
                           if(objSvcInfo.Unit.Trim().ToLower().ToString() == dtUnits.Rows[i][0].ToString().ToLower().Trim())
                           {
                               ddlUnits.SelectedIndex = ddlUnits.Items.IndexOf(ddlUnits.Items.FindByValue(objSvcInfo.Unit.Trim()));
                               count++;
                               break;
                           }
                       }
                        if (count==0)
                            objSvcInfo.Unit = DefaultUnitSettings;
                    }
                    else
                        objSvcInfo.Unit = DefaultUnitSettings;

                }
                setEmailValues();

            }
            catch (Exception ex)
            {
                AgriCastException currEx = new AgriCastException(objServicePre.GetServiceDetails(), ex);
                AgriCastLogger.Publish(currEx, AgriCastLogger.LogType.Error);
                HttpContext.Current.Session["ErrorMessage"] = objPreTool.getTranslatedText(Constants.TOOLBAR_LOADFAILURE, strCulCode) + ex.Message.ToString();
                return;
            }
        }
Example #5
0
        protected void gvFavorites_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                TextBox favoriteName = gvFavorites.Rows[e.RowIndex].Cells[0].Controls[0] as TextBox;
                TextBox favoriteId = gvFavorites.Rows[e.RowIndex].Cells[4].Controls[0] as TextBox;
                objPreTool = new ToolBarPresenter(this);
                objPreTool.getCultureCode();
                //objPreTool.updateFavorite(favoriteName.Text, Convert.ToInt32(favoriteId.Text));
                objPreTool.UpdateFavorite(favoriteName.Text, favoriteId.Text);
                gvFavorites.EditIndex = -1;

                if (IsFavUpdated)
                {
                    //Trigger the Event to Update the Favorite Dictionary and save in database
                    onSaveFavorite(e);

                    getFavorites();
                    //HttpContext.Current.Session["ErrorMessage"] = objPreTool.getTranslatedText(Constants.FAVORITE_UPDATE_SUCCESS, strCulCode); ;
                    HttpContext.Current.Session["SuccessMessage"] = objPreTool.getTranslatedText(Constants.FAVORITE_UPDATE_SUCCESS, strCulCode);
                    favorites.Attributes.Add("class", "hide");
                }
                else
                {
                    HttpContext.Current.Session["ErrorMessage"] = objPreTool.getTranslatedText(Constants.FAVORITE_UPDATE_DUPLICATE, strCulCode) + favoriteName.Text + objPreTool.getTranslatedText(Constants.GENERIC_ALREADYEXISTS, strCulCode);
                }
            }
            catch (Exception ex)
            {
                AgriCastException currEx = new AgriCastException(objServicePre.GetServiceDetails(), ex);
                AgriCastLogger.Publish(currEx, AgriCastLogger.LogType.Error);
                HttpContext.Current.Session["ErrorMessage"] = objPreTool.getTranslatedText(Constants.FAVORITE_UPDATE_FAILURE, strCulCode);
            }
        }
Example #6
0
        protected void gvFavorites_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                double d = 0.0;
                string pGetFavPlaceDetails = string.Empty;
                GridView _gridView = (GridView)sender;
                bool serviceExists = false;
                objPreTool = new ToolBarPresenter(this);
                objPreTool.getCultureCode();

                if (e.CommandName.Equals("Select", StringComparison.CurrentCultureIgnoreCase))
                {
                    int _selectedIndex = int.Parse(e.CommandArgument.ToString());
                    string _commandName = e.CommandName;

                    _gridView.SelectedIndex = _selectedIndex;

                    //Code to check existance of the service in the current pub
                    //Has to be fetched only if exists
                    /* IM01365225 - New Agricast - favorite - Service Name - Jerrey - Begin */
                    // commented by Jerrey - IM01365225
                    //string strService = gvFavorites.SelectedRow.Cells[1].Text;
                    string strService = (gvFavorites.SelectedRow.Cells[1].Controls[0] as Label).Text;
                    /* IM01365225 - New Agricast - favorite - Service Name - Jerrey - End */
                    objPreTool.getNodeList("service");
                    foreach (string[] service in alNodeList)
                    {
                        if (service[1].ToString().ToLower() == strService.ToLower())
                        {
                            serviceExists = true;
                            break;
                        }
                    }

                    if (serviceExists)
                    {
                        /*objLocInfo.placeName */
                        strPlaceName = HttpUtility.HtmlDecode(gvFavorites.SelectedRow.Cells[2].Text);
                        /*objLocInfo.CountryCode */

                        //split the String and take the first part - Place Name
                        if (strPlaceName.IndexOf(',') != -1)
                        {
                            strPlaceName = strPlaceName.Split(',')[0];
                        }

                        //get the Value of Place Id from selected row
                        //string str1=_gridView.Rows[0].Cells[6].Text;
                        strPlaceID = gvFavorites.SelectedRow.Cells[6].Text;

                        //check if the Place Id is Null or empty or Zero
                        //In such cases, Pass the Place Name instead of PlaceID
                        if (string.IsNullOrEmpty(strPlaceID) || strPlaceID.Equals("0"))
                        {
                            pGetFavPlaceDetails = strPlaceName;// set the PlaceName as parameter
                        }
                        else
                        {
                            pGetFavPlaceDetails = strPlaceID;// set the PlaceID as parameter
                        }

                        // //Call the Presenter method to get Location Details
                        objPreTool.GetFavPlaceDetails(pGetFavPlaceDetails);

                        /*remove the concept of place id and place name.
                         *always retrive the favorite based on the latitude and longitude of the location*/

                        //string strFavLatitude = gvFavorites.SelectedRow.Cells[8].Text ;
                        //string strFavLongitude = gvFavorites.SelectedRow.Cells[9].Text;

                        //if (!(string.IsNullOrEmpty(strFavLatitude) || string.IsNullOrEmpty(strFavLongitude)))
                        //{
                        //    //Call the Presenter method to get Location Details
                        //    objPreTool.GetFavPlaceDetails(strFavLatitude, strFavLongitude);

                        //}

                        if (dtPlaceDetails.Rows.Count > 0)
                        {
                            objLocInfo.placeName = strPlaceName;//PlaceName
                            objLocInfo.latitude = double.TryParse(dtPlaceDetails.Rows[0][Constants.FAV_LATITUDE].ToString(), out d) ? d : 0.0;//Latitude
                            objLocInfo.longitude = double.TryParse(dtPlaceDetails.Rows[0][Constants.FAV_LONGITUDE].ToString(), out d) ? d : 0.0;//Longitude
                            objLocInfo.CountryCode = dtPlaceDetails.Rows[0][Constants.COUNTRY_CODE].ToString();//CountryCode
                        }
                        else
                        {
                            HttpContext.Current.Session["ErrorMessage"] = objPreTool.getTranslatedText(Constants.GENERIC_DETAILSNOTFOUND, strCulCode);
                        }
                        /* IM01365225 - New Agricast - favorite - Service Name - Jerrey - Begin */
                        // commented by Jerrey - IM01365225
                        //objLocInfo.ServiceInfo.Module = gvFavorites.SelectedRow.Cells[1].Text;
                        objLocInfo.ServiceInfo.Module = (gvFavorites.SelectedRow.Cells[1].Controls[0] as Label).Text;
                        /* IM01365225 - New Agricast - favorite - Service Name - Jerrey - End */

                        //Remove the Old Module Name from the URL
                        string url = HttpContext.Current.Request.Url.ToString();
                        url = url.Split('?')[0];

                        System.Collections.Specialized.NameValueCollection t = HttpUtility.ParseQueryString(Request.Url.Query);
                        t.Set("module", objSvcInfo.Module);

                        /* IM01680394 - meinSyngenta; Spraweather; Bug in favorites function - Feb 28th, 2014 - Begin */
                        //if (!string.IsNullOrWhiteSpace(t.Get("securitykey")))
                        //    t.Remove("securitykey"); // because security key will expired after 5 mins
                        if (!string.IsNullOrWhiteSpace(t.Get("location")))
                            t.Set("location", objLocInfo.placeName);
                        if (!string.IsNullOrWhiteSpace(t.Get("lat")))
                            t.Set("lat", objLocInfo.latitude.ToString());
                        if (!string.IsNullOrWhiteSpace(t.Get("long")))
                            t.Set("long", objLocInfo.longitude.ToString());
                        /* IM01680394 - meinSyngenta; Spraweather; Bug in favorites function - Feb 28th, 2014 - End */

                        if (t.Count == 1)
                        {
                            url = url + "?" + t.Keys[0] + "=" + t[0];
                        }
                        else
                        {
                            for (int i = 0; i < t.Count; i++)
                            {
                                if (i == 0)
                                {
                                    url = url + "?" + t.Keys[i] + "=" + t[i];
                                }
                                else
                                {
                                    url = url + "&" + t.Keys[i] + "=" + t[i];
                                }

                            }
                        }

                        Response.Redirect(url, false);
                        HttpContext.Current.ApplicationInstance.CompleteRequest();

                    }
                    else
                    {
                        HttpContext.Current.Session["ErrorMessage"] = objPreTool.getTranslatedText(Constants.GENERIC_NOSERVICE, strCulCode);
                        isFavorite = false;
                    }

                }

                //if (e.CommandName.Equals("delete", StringComparison.CurrentCultureIgnoreCase))
                //{
                //    int i = int.Parse(e.CommandArgument.ToString());
                //    ImageButton btn = gvFavorites.Rows[i].Cells[3].Controls[0] as ImageButton;

                //    //theDeleteButton.Attributes.Add("onClick", "return confirm('Are you sure you want to delete?');");

                //    btn.OnClientClick = "return confirm('Are you sure you want to delete?')";

                //}

            }

            catch (Exception ex)
            {
                AgriCastException currEx = new AgriCastException(objSvcPre.GetServiceDetails(), ex);
                AgriCastLogger.Publish(currEx, AgriCastLogger.LogType.Error);
                HttpContext.Current.Session["ErrorMessage"] = objPreTool.getTranslatedText(Constants.GENERIC_ERRORONPAGE, strCulCode) + ex.Message.ToString();
            }
        }
Example #7
0
        //Method to fetch the favourites from DB for a particualr user
        protected void getFavorites()
        {
            string strUserName = string.Empty;
            try
            {

                objPreTool = new ToolBarPresenter(this);
                objPreTool.getCultureCode();
                objUserInfo = (UserInfo)Session["objUserInfo"];

                if (objUserInfo != null)
                {
                    objPreTool.getFavorites();

                }
            }
            catch (Exception ex)
            {
                AgriCastException currEx = new AgriCastException(objServicePre.GetServiceDetails(), ex);
                AgriCastLogger.Publish(currEx, AgriCastLogger.LogType.Error);
                HttpContext.Current.Session["ErrorMessage"] = objPreTool.getTranslatedText(Constants.FAVORITE_GENERIC_FAILURE, strCulCode) + ex.Message.ToString();
            }
        }