Ejemplo n.º 1
0
 /// <summary>
 /// Bind Search panel Data and return  partialview
 /// </summary>
 /// <returns></returns>
 public ActionResult PartialLayout()
 {
     try
     {
         hw_sites objhwsite = new hw_sites();
         DataSet  ds        = new DataSet();
         using (SqlConnection con = new SqlConnection(cmis_portal))
         {
             using (SqlCommand cmd = new SqlCommand("select * from hw_sites", con))
             {
                 con.Open();
                 SqlDataAdapter da = new SqlDataAdapter(cmd);
                 da.Fill(ds);
                 List <hw_sites> sitelist = new List <hw_sites>();
                 for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                 {
                     hw_sites hwsite_obj = new hw_sites();
                     hwsite_obj.site_code = ds.Tables[0].Rows[i]["site_code"].ToString();
                     hwsite_obj.site_desc = ds.Tables[0].Rows[i]["site_desc"].ToString();
                     sitelist.Add(hwsite_obj);
                 }
                 objhwsite.siteinfo = sitelist;
             }
             con.Close();
         }
         return(PartialView(objhwsite));
     }
     catch (Exception ex)
     {
         logger.Error(ex.ToString());
         return(View());
     }
 }
Ejemplo n.º 2
0
        log4net.ILog logger                = log4net.LogManager.GetLogger(typeof(HomeController)); //Declaring Log4Net
        #endregion

        /// <summary>
        /// Bind Site Dropdown data and Show Home page
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            try
            {
                if (Request.QueryString["HOOK_URL"] == null && Session["HOOK_URL"] == null)
                {
                    return(View("NoUser"));
                }
                else
                {
                    if (Session["HOOK_URL"] == null)
                    {
                        Session["HOOK_URL"] = Request.QueryString["HOOK_URL"];
                    }
                    hw_sites objhwsite = new hw_sites();
                    DataSet  ds        = new DataSet();
                    using (SqlConnection con = new SqlConnection(cmis_portal))
                    {
                        using (SqlCommand cmd = new SqlCommand("select * from hw_sites", con))
                        {
                            con.Open();
                            SqlDataAdapter da = new SqlDataAdapter(cmd);
                            da.Fill(ds);
                            List <hw_sites> sitelist = new List <hw_sites>();
                            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                            {
                                hw_sites hwsite_obj = new hw_sites();
                                hwsite_obj.site_code = ds.Tables[0].Rows[i]["site_code"].ToString();
                                hwsite_obj.site_desc = ds.Tables[0].Rows[i]["site_desc"].ToString();
                                sitelist.Add(hwsite_obj);
                            }
                            objhwsite.siteinfo = sitelist;
                        }
                        con.Close();
                    }

                    return(View("Index", objhwsite));
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToString());
                return(View());
            }
        }
Ejemplo n.º 3
0
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            if (HttpContext.Current.Session["Sitedesc"] == null)
            {
                HttpContext.Current.Session["Sitedesc"] = "Please select a site";
            }
            hw_sites objhwsite = new hw_sites();
            DataSet  ds        = new DataSet();

            using (SqlConnection con = new SqlConnection(cmis_portal))
            {
                using (SqlCommand cmd = new SqlCommand("select * from hw_sites", con))
                {
                    con.Open();
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    da.Fill(ds);
                    List <hw_sites> sitelist = new List <hw_sites>();
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        hw_sites hwsite_obj = new hw_sites();
                        hwsite_obj.site_code = ds.Tables[0].Rows[i]["site_code"].ToString();
                        hwsite_obj.site_desc = ds.Tables[0].Rows[i]["site_desc"].ToString();

                        sitelist.Add(hwsite_obj);
                    }
                    objhwsite.siteinfo  = sitelist;
                    objhwsite.site_code = Convert.ToString(HttpContext.Current.Session["Site_Code"]);
                    objhwsite.site_desc = Convert.ToString(HttpContext.Current.Session["Sitedesc"]);
                }
                con.Close();
                int       numRows = 0;
                DataTable dt      = new DataTable();
                dt = objBALProductList.GetQuantity(Convert.ToString(HttpContext.Current.Session["CartId"]));
                if (dt.Rows.Count > 0)
                {
                    numRows = Convert.ToInt32(dt.Rows[0][0]);
                }
                HttpContext.Current.Session["numrows"] = numRows.ToString();
                filterContext.Controller.ViewData["layoutPageData"] = objhwsite;
            }
        }