public ActionResult Edit(string id)
        {
            DirectEmployerClientCampusProgramClient programclient = new DirectEmployerClientCampusProgramClient();
            DirectEmployerClientCampusProgram       program       = programclient.GetByRowKey(id);

            program.PostedDateTime = DateTime.UtcNow;

            DirectEmployerClientCampusClient campusclient = new DirectEmployerClientCampusClient();
            DirectEmployerClientCampus       campus       = campusclient.GetByRowKey(program.CampusRowKey);

            ViewBag.Campus = campus;

            DirectEmployerClientClient dscc = new DirectEmployerClientClient();

            ViewBag.Client = dscc.GetByRowKey(program.ClientRowKey);

            ViewBag.GeoAddStates      = BlobStringManager.Instance.GetString("skillcowemployerprogramgeoindex", "AddStates", id);
            ViewBag.GeoAddZips        = BlobStringManager.Instance.GetString("skillcowemployerprogramgeoindex", "AddZips", id);
            ViewBag.GeoSubtractStates = BlobStringManager.Instance.GetString("skillcowemployerprogramgeoindex", "SubtractStates", id);
            ViewBag.GeoSubtractZips   = BlobStringManager.Instance.GetString("skillcowemployerprogramgeoindex", "SubtractZips", id);

            ViewBag.Html = BlobStringManager.Instance.GetString("skillcowjobs", "HTML", id);

            return(View(program));
        }
Exemplo n.º 2
0
        public ActionResult ChangePassword(FormCollection collection)
        {
            if (!IsValidUser(tokens => tokens[1] == Request["username"].ToString()))
            {
                return(RedirectToAction("Logon"));
            }

            DirectEmployerClientClient cc     = new DirectEmployerClientClient();
            DirectEmployerClient       client = cc.GetByRowKey(AuthTokens[3]);

            if (client == null)
            {
                return(RedirectToAction("Logon"));
            }

            if (collection["newpassword"].Trim() == collection["confirmpassword"].Trim())
            {
                client.Password = collection["newpassword"].Trim();
                cc.Update(client);
                return(RedirectToAction("Index"));
            }
            else
            {
                return(RedirectToAction("Index", new { PasswordError = "Password does not match confirmation" }));
            }
        }
        //
        // GET: /DirectSchoolClients/

        public ActionResult Index(string sort)
        {
            DirectEmployerClientClient         dscc    = new DirectEmployerClientClient();
            IEnumerable <DirectEmployerClient> results = dscc.GetAll();

            if (sort != null)
            {
                switch (sort)
                {
                case "Name":
                    results = results.OrderBy(x => x.Name);
                    break;

                case "Status":
                    results = results.OrderBy(x => x.Status);
                    break;

                case "Category":
                    results = results.OrderBy(x => x.Category);
                    break;

                default:
                    break;
                }
            }

            return(View(results));
        }
        public ActionResult Create(string clientid)
        {
            DirectEmployerClientClient dscc = new DirectEmployerClientClient();

            ViewBag.Client = dscc.GetByRowKey(clientid);

            return(View());
        }
        public ActionResult Edit(string id, DirectEmployerClient item)
        {
            try
            {
                DirectEmployerClientClient dscc = new DirectEmployerClientClient();
                if (item.Description == null)
                {
                    item.Description = "";
                }

                dscc.Update(item);

                //Save LeadCap
                LeadCapClient leadcapclient = new LeadCapClient();
                LeadCap       leadcap       = leadcapclient.GetByRowKey(item.RowKey);
                bool          createnewcap  = false;
                if (leadcap == null)
                {
                    leadcap        = new LeadCap();
                    leadcap.RowKey = item.RowKey;
                    createnewcap   = true;
                }
                leadcap.Total    = item.TotalCap;
                leadcap.Annually = item.AnnualCap;
                leadcap.Monthly  = item.MonthlyCap;
                leadcap.Weekly   = item.WeeklyCap;
                leadcap.Daily    = item.DailyCap;
                if (createnewcap)
                {
                    leadcapclient.AddNewItem(leadcap);
                }
                else
                {
                    leadcapclient.Update(leadcap);
                }

                //Create LeadCounter if doesn't exist
                LeadCounterClient leadcounterclient = new LeadCounterClient();
                LeadCounter       leadcounter       = leadcounterclient.GetByRowKey(item.RowKey);
                if (leadcounter == null)
                {
                    leadcounter          = new LeadCounter();
                    leadcounter.RowKey   = item.RowKey;
                    leadcounter.Total    = 0;
                    leadcounter.Annually = 0;
                    leadcounter.Monthly  = 0;
                    leadcounter.Weekly   = 0;
                    leadcounter.Daily    = 0;
                    leadcounterclient.AddNewItem(leadcounter);
                }

                return(RedirectToAction("Edit", new { id = item.RowKey }));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create(DirectEmployerClient newitem)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (newitem.Name == null || newitem.Name == "")
                    {
                        throw new Exception("Client name missing");
                    }
                    if (newitem.ClientId == null)
                    {
                        throw new Exception("ClientId missing");
                    }

                    string clientid = newitem.ClientId.ToUpper().Replace(" ", "");
                    if (clientid == "")
                    {
                        throw new Exception("ClientId cannot be empty");
                    }

                    newitem.ClientId = clientid;

                    DirectEmployerClientClient dscc = new DirectEmployerClientClient();

                    if (dscc.GetByName(newitem.Name) != null)
                    {
                        throw new Exception("A client with this name already exists");
                    }

                    if (dscc.GetByClientId(newitem.ClientId) != null)
                    {
                        throw new Exception("A client with this ClientId already exists");
                    }

                    try
                    {
                        dscc.AddNewItem(newitem);
                        return(RedirectToAction("Index"));
                    }
                    catch
                    {
                        ModelState.AddModelError("error", "Error creating new client");
                    }
                }

                return(View(newitem));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("error", ex.Message);
                return(View(newitem));
            }
        }
        public ActionResult Edit(string id)
        {
            DirectEmployerClientCampusClient campusclient = new DirectEmployerClientCampusClient();
            DirectEmployerClientCampus       campus       = campusclient.GetByRowKey(id);

            DirectEmployerClientClient dscc = new DirectEmployerClientClient();

            ViewBag.Client = dscc.GetByRowKey(campus.ClientRowKey);

            return(View(campus));
        }
        public ActionResult Create(DirectEmployerClientCampusProgram item)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    DirectEmployerClientCampusProgramClient programclient = new DirectEmployerClientCampusProgramClient();

                    item.PostedDateTime = DateTime.UtcNow;

                    AttributeMaskCalculator amc = new AttributeMaskCalculator();
                    item.AttributeMask = amc.GetMask(item);

                    ImportantThingsMaskCalculator itmc = new ImportantThingsMaskCalculator();
                    item.ImportantThingsMask = itmc.GetMask(item);

                    try
                    {
                        programclient.AddNewItem(item);
                        return(RedirectToAction("Edit", "DirectEmployerClientCampuses", new { id = item.CampusId }));
                    }
                    catch
                    {
                        ModelState.AddModelError("error", "Error creating new program");
                    }
                }

                DirectEmployerClientCampusClient campusclient = new DirectEmployerClientCampusClient();
                DirectEmployerClientCampus       campus       = campusclient.GetByRowKey(item.CampusId);
                ViewBag.Campus = campus;

                DirectEmployerClientClient dscc = new DirectEmployerClientClient();
                ViewBag.Client = dscc.GetByRowKey(item.ClientRowKey);

                return(View(item));
            }
            catch
            {
                DirectEmployerClientCampusClient campusclient = new DirectEmployerClientCampusClient();
                DirectEmployerClientCampus       campus       = campusclient.GetByRowKey(item.CampusId);
                ViewBag.Campus = campus;

                DirectEmployerClientClient dscc = new DirectEmployerClientClient();
                ViewBag.Client = dscc.GetByRowKey(item.ClientRowKey);

                return(View());
            }
        }
        public ActionResult Create(string campusid)
        {
            DirectEmployerClientCampusClient campusclient = new DirectEmployerClientCampusClient();
            DirectEmployerClientCampus       campus       = campusclient.GetByRowKey(campusid);

            ViewBag.Campus = campus;

            DirectEmployerClientClient dscc = new DirectEmployerClientClient();

            ViewBag.Client = dscc.GetByRowKey(campus.ClientRowKey);

            DirectEmployerClientCampusProgram newitem = new DirectEmployerClientCampusProgram();

            newitem.PostedDateTime = DateTime.UtcNow;
            return(View(newitem));
        }
        //
        // GET: /DirectSchoolClients/Edit/5

        public ActionResult Edit(string id)
        {
            //Clean up all indexes

            /*
             * GeoIndexNationalClient c1 = new GeoIndexNationalClient();
             * c1.DeleteTable();
             * GeoIndexAddStateClient c2 = new GeoIndexAddStateClient();
             * c2.DeleteTable();
             * GeoIndexAddZipClient c3 = new GeoIndexAddZipClient();
             * c3.DeleteTable();
             * GeoIndexSubtractStateClient c4 = new GeoIndexSubtractStateClient();
             * c4.DeleteTable();
             * GeoIndexSubtractZipClient c5 = new GeoIndexSubtractZipClient();
             * c5.DeleteTable();
             */

            DirectEmployerClientClient dscc = new DirectEmployerClientClient();

            return(View(dscc.GetByRowKey(id)));
        }
Exemplo n.º 11
0
        public ActionResult Logon(FormCollection collection)
        {
            DirectEmployerClientClient cc = new DirectEmployerClientClient();

            DirectEmployerClient client = cc.Logon(collection["username"], collection["password"]);

            if (client == null)
            {
                ViewBag.ErrorMessage = "Invalid Username or Password";
                return(View());
            }

            string sessionkey = ClientSession.GetClientSessionKey("employer", collection["username"], client.ClientId, client.RowKey);

            Response.Cookies["sessionkey"].Value = sessionkey;
            //Response.Cookies["sessionkey"].Expires = DateTime.UtcNow.AddMinutes(20);

            Response.Cookies["username"].Value = collection["username"];
            //Response.Cookies["username"].Expires = DateTime.UtcNow.AddMinutes(20);


            return(RedirectToAction("Index"));
        }
        public ActionResult Edit(string id, DirectEmployerClientCampusProgram updateditem)
        {
            DirectEmployerClientCampusProgramClient programclient = new DirectEmployerClientCampusProgramClient();
            DirectEmployerClientCampusProgram       currentitem   = programclient.GetByRowKey(updateditem.RowKey);

            if (updateditem.GeoAddNational == null)
            {
                updateditem.GeoAddNational = "";
            }
            if (updateditem.GeoAddStates == null)
            {
                updateditem.GeoAddStates = "";
            }
            if (updateditem.GeoAddZips == null)
            {
                updateditem.GeoAddZips = "";
            }
            if (updateditem.GeoSubtractStates == null)
            {
                updateditem.GeoSubtractStates = "";
            }
            if (updateditem.GeoSubtractZips == null)
            {
                updateditem.GeoSubtractZips = "";
            }



            try
            {
                AttributeMaskCalculator amc = new AttributeMaskCalculator();
                updateditem.AttributeMask = amc.GetMask(updateditem);

                ImportantThingsMaskCalculator itmc = new ImportantThingsMaskCalculator();
                updateditem.ImportantThingsMask = itmc.GetMask(updateditem);


                if (PublishGeoIndex2(currentitem, updateditem))
                {
                    BlobStringManager.Instance.SaveString(NullString(updateditem.Html), updateditem.RowKey, "skillcowjobs", "HTML");

                    object htmljson = new { html = updateditem.Html.ToJSONSafeString().Replace("'", "\'") };
                    BlobJsonResourceManager.Instance.SaveJsonResource("customhtml", "skillcowjobs", "JSON", updateditem.RowKey, htmljson.ToJSON());

                    updateditem.GeoAddStates      = "";
                    updateditem.GeoAddZips        = "";
                    updateditem.GeoSubtractStates = "";
                    updateditem.GeoSubtractZips   = "";
                    updateditem.Html = "";


                    programclient.Update(updateditem);

                    //Save LeadCap
                    LeadCapClient leadcapclient = new LeadCapClient();
                    LeadCap       leadcap       = leadcapclient.GetByRowKey(updateditem.RowKey);
                    bool          createnewcap  = false;
                    if (leadcap == null)
                    {
                        leadcap        = new LeadCap();
                        leadcap.RowKey = updateditem.RowKey;
                        createnewcap   = true;
                    }
                    leadcap.Total    = updateditem.TotalCap;
                    leadcap.Annually = updateditem.AnnualCap;
                    leadcap.Monthly  = updateditem.MonthlyCap;
                    leadcap.Weekly   = updateditem.WeeklyCap;
                    leadcap.Daily    = updateditem.DailyCap;
                    if (createnewcap)
                    {
                        leadcapclient.AddNewItem(leadcap);
                    }
                    else
                    {
                        leadcapclient.Update(leadcap);
                    }


                    //Create LeadCounter if doesn't exist
                    LeadCounterClient leadcounterclient = new LeadCounterClient();
                    LeadCounter       leadcounter       = leadcounterclient.GetByRowKey(updateditem.RowKey);
                    if (leadcounter == null)
                    {
                        leadcounter          = new LeadCounter();
                        leadcounter.RowKey   = updateditem.RowKey;
                        leadcounter.Total    = 0;
                        leadcounter.Annually = 0;
                        leadcounter.Monthly  = 0;
                        leadcounter.Weekly   = 0;
                        leadcounter.Daily    = 0;
                        leadcounterclient.AddNewItem(leadcounter);
                    }
                }
                else
                {
                    throw new Exception("Failed to publish GEO index");
                }

                return(RedirectToAction("Edit", "DirectEmployerClientCampusPrograms", new { id = updateditem.RowKey }));
            }
            catch
            {
                DirectEmployerClientCampusClient campusclient = new DirectEmployerClientCampusClient();
                DirectEmployerClientCampus       campus       = campusclient.GetByRowKey(updateditem.CampusRowKey);
                ViewBag.Campus = campus;

                DirectEmployerClientClient dscc = new DirectEmployerClientClient();
                ViewBag.Client = dscc.GetByRowKey(updateditem.ClientRowKey);

                ViewBag.GeoAddStates      = BlobStringManager.Instance.GetString("skillcowemployerprogramgeoindex", "AddStates", id);
                ViewBag.GeoAddZips        = BlobStringManager.Instance.GetString("skillcowemployerprogramgeoindex", "AddZips", id);
                ViewBag.GeoSubtractStates = BlobStringManager.Instance.GetString("skillcowemployerprogramgeoindex", "SubtractStates", id);
                ViewBag.GeoSubtractZips   = BlobStringManager.Instance.GetString("skillcowemployerprogramgeoindex", "SubtractZips", id);
                ViewBag.Html = BlobStringManager.Instance.GetString("skillcowjobs", "HTML", id);

                ModelState.AddModelError("error", "Failed to save");

                return(View(updateditem));
            }
        }
        public ActionResult Dashboard()
        {
            DirectEmployerClientClient dscc = new DirectEmployerClientClient();

            return(View(dscc.GetAll()));
        }