コード例 #1
0
 // GET: Marketing
 public ActionResult Index()
 {
     if (!string.IsNullOrEmpty(Session["username"] as string))
     {
         try
         {
             DirectoryInfo di = new DirectoryInfo(Server.MapPath("~/Uploads/First"));
             foreach (FileInfo fi in di.GetFiles())
             {
                 ViewBag.extension1 = fi.Extension;
             }
             if (di.GetFiles().Count() == 0)
             {
                 ViewBag.extension1 = "none";
             }
             DirectoryInfo di2 = new DirectoryInfo(Server.MapPath("~/Uploads/Second"));
             foreach (FileInfo fi in di2.GetFiles())
             {
                 ViewBag.extension2 = fi.Extension;
             }
             if (di2.GetFiles().Count() == 0)
             {
                 ViewBag.extension2 = "none";
             }
             DirectoryInfo di3 = new DirectoryInfo(Server.MapPath("~/Uploads/Third"));
             foreach (FileInfo fi in di3.GetFiles())
             {
                 ViewBag.extension3 = fi.Extension;
             }
             if (di3.GetFiles().Count() == 0)
             {
                 ViewBag.extension3 = "none";
             }
             DirectoryInfo di4 = new DirectoryInfo(Server.MapPath("~/Uploads/Fourth"));
             foreach (FileInfo fi in di4.GetFiles())
             {
                 ViewBag.extension4 = fi.Extension;
             }
             if (di4.GetFiles().Count() == 0)
             {
                 ViewBag.extension4 = "none";
             }
             MarketingData    md  = new MarketingData();
             List <Marketing> lst = md.GetMarketingData();
             return(View(lst));
         }
         catch (Exception ex)
         {
             return(View("Error", ex));
         }
     }
     else
     {
         return(RedirectToAction("Index", "Login"));
     }
 }
コード例 #2
0
        public string Print()
        {
            DirectoryInfo di = new DirectoryInfo(Server.MapPath("~/Uploads/First"));

            foreach (FileInfo fi in di.GetFiles())
            {
                ViewBag.extension1 = fi.Extension;
            }
            if (di.GetFiles().Count() == 0)
            {
                ViewBag.extension1 = "none";
            }
            DirectoryInfo di2 = new DirectoryInfo(Server.MapPath("~/Uploads/Second"));

            foreach (FileInfo fi in di2.GetFiles())
            {
                ViewBag.extension2 = fi.Extension;
            }
            if (di2.GetFiles().Count() == 0)
            {
                ViewBag.extension2 = "none";
            }
            DirectoryInfo di3 = new DirectoryInfo(Server.MapPath("~/Uploads/Third"));

            foreach (FileInfo fi in di3.GetFiles())
            {
                ViewBag.extension3 = fi.Extension;
            }
            if (di3.GetFiles().Count() == 0)
            {
                ViewBag.extension3 = "none";
            }
            DirectoryInfo di4 = new DirectoryInfo(Server.MapPath("~/Uploads/Fourth"));

            foreach (FileInfo fi in di4.GetFiles())
            {
                ViewBag.extension4 = fi.Extension;
            }
            if (di4.GetFiles().Count() == 0)
            {
                ViewBag.extension4 = "none";
            }
            MarketingData    md  = new MarketingData();
            List <Marketing> lst = md.GetMarketingData();
            string           s   = new PageOrientations().RenderRazorViewToString(this, "Print", lst);

            return(s);
        }
コード例 #3
0
        public ActionResult MarketingEdit(FormCollection form)
        {
            try
            {
                MarketingData    md          = new MarketingData();
                List <Marketing> lstexisting = md.GetMarketingData();
                List <Marketing> lst         = new List <Marketing>();

                Marketing obj = new Marketing();
                obj.Type      = form["Type1"];
                obj.TypeValue = form["TypeValue1"];
                obj.Kpi1      = form["Kpi11"];
                obj.Kpi2      = form["kpi12"];
                obj.Kpi3      = form["Kpi13"];
                obj.Result1   = form["Result11"];
                obj.Result2   = form["Result12"];
                obj.Result3   = form["Result13"];
                lst.Add(obj);
                Marketing obj1 = new Marketing();
                obj1.Type      = form["Type2"];
                obj1.TypeValue = form["TypeValue2"];
                obj1.Kpi1      = form["Kpi21"];
                obj1.Kpi2      = form["kpi22"];
                obj1.Kpi3      = form["Kpi23"];
                obj1.Result1   = form["Result21"];
                obj1.Result2   = form["Result22"];
                obj1.Result3   = form["Result23"];
                lst.Add(obj1);
                lst.Add(lstexisting[2]);
                lst.Add(lstexisting[3]);


                md.UpdateMarketingData(lst);
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                return(View("Error", ex));
            }
        }
コード例 #4
0
        public ActionResult MarketingEdit(bool?firstUploaded = false, bool?secondUploaded = false)
        {
            if (!string.IsNullOrEmpty(Session["username"] as string))
            {
                if (Session["roleid"].ToString() == "1" || Session["roleid"].ToString() == "5")
                {
                    try
                    {
                        MarketingData    md  = new MarketingData();
                        List <Marketing> lst = md.GetMarketingData();
                        bool             a   = firstUploaded == true ? true : false;
                        bool             b   = secondUploaded == true ? true : false;

                        if (a)
                        {
                            ViewBag.message1 = "File Uploaded Successfully";
                        }
                        if (b)
                        {
                            ViewBag.message2 = "File Uploaded Successfully";
                        }

                        return(View(lst));
                    }
                    catch (Exception ex)
                    {
                        return(View("Error", ex));
                    }
                }
                else
                {
                    return(View("Accessdenied"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "Login"));
            }
        }
コード例 #5
0
 public ActionResult MarketingEditSecond(FormCollection form)
 {
     try
     {
         MarketingData    md          = new MarketingData();
         List <Marketing> lstexisting = md.GetMarketingData();
         List <Marketing> lst         = new List <Marketing>();
         lst.Add(lstexisting[0]);
         lst.Add(lstexisting[1]);
         Marketing obj = new Marketing();
         obj.Type      = form["Type3"];
         obj.TypeValue = form["TypeValue3"];
         obj.Kpi1      = form["Kpi31"];
         obj.Kpi2      = form["kpi32"];
         obj.Kpi3      = form["Kpi33"];
         obj.Result1   = form["Result31"];
         obj.Result2   = form["Result32"];
         obj.Result3   = form["Result33"];
         lst.Add(obj);
         Marketing obj1 = new Marketing();
         obj1.Type      = form["Type4"];
         obj1.TypeValue = form["TypeValue4"];
         obj1.Kpi1      = form["Kpi41"];
         obj1.Kpi2      = form["kpi42"];
         obj1.Kpi3      = form["Kpi43"];
         obj1.Result1   = form["Result41"];
         obj1.Result2   = form["Result42"];
         obj1.Result3   = form["Result43"];
         lst.Add(obj1);
         md.UpdateMarketingData(lst);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         return(View("Error", ex));
     }
 }