public ActionResult Access(Guid id)
        {
            AccessModel access = reposetory.GetAccess((Guid)id);

            access.SelectPersons.RemoveAll(item => access.Form.Exists(p => p.FunctionID == item.FunctionID));

            return(View(access));
        }
        public ActionResult Access()
        {
            AccessModel access = reposetory.GetAccess(CurrentProfile.AssociationID);

            if (access == null)
            {
                return(HttpNotFound());
            }
            access.SelectPersons.RemoveAll(item => access.Form.Exists(p => p.FunctionID == item.FunctionID));

            return(View(access));
        }
Example #3
0
        public ActionResult Edit(Lead lead)
        {
            Lead dbLead = new Lead();

            if (lead.LeadID != Guid.Empty)
            {
                dbLead = reposetory.GetLead(lead.LeadID);
                if (dbLead == null)
                {
                    return(RedirectToAction("Index"));
                }
            }

            if (ModelState.IsValid)
            {
                LeadStatus oldStatus = dbLead.Status;



                dbLead.FirstName         = lead.FirstName;
                dbLead.FamilyName        = lead.FamilyName;
                dbLead.Status            = lead.Status;
                dbLead.AssociationID     = lead.AssociationID == Guid.Empty ? null : lead.AssociationID;
                dbLead.Address           = lead.Address;
                dbLead.City              = lead.City;
                dbLead.Zip               = lead.Zip;
                dbLead.Phone             = lead.Phone;
                dbLead.Mobile            = lead.Mobile;
                dbLead.Email             = lead.Email;
                dbLead.Age               = lead.Age;
                dbLead.Comments          = lead.Comments;
                dbLead.RequestUpdateMail = false;

                if (reposetory.Save(dbLead))
                {
                    if ((oldStatus == LeadStatus.New | oldStatus == LeadStatus.Acknowledge |
                         oldStatus == LeadStatus.Clarification | lead.LeadID == Guid.Empty)
                        & dbLead.Status == LeadStatus.Assigned & dbLead.AssociationID != null)
                    {
                        string        to = string.Empty;
                        List <string> cc = new List <string>();

                        AccessModel Access = reposetory.GetAccess((Guid)dbLead.AssociationID);

                        BoardModelView Board = reposetory.GetBoardView((Guid)dbLead.AssociationID);

                        to = string.Format("{0} <{1}>", Board.Chairmann.FullName, Board.Chairmann.Email);

                        foreach (PersonAccess M in Access.Form)
                        {
                            if (M.Secretary)
                            {
                                NRMembership p = reposetory.GetMembership(M.FunctionID);
                                //cc += string.Format("{0},", p.Person.Email);
                                cc.Add(string.Format("{0} <{1}>", p.Person.FullName, p.Person.Email));
                            }
                            else if (M.Planner)
                            {
                                NRMembership p = reposetory.GetMembership(M.FunctionID);
                                //cc += string.Format("{0},", p.Person.Email);
                                cc.Add(string.Format("{0} <{1}>", p.Person.FullName, p.Person.Email));
                            }
                        }



                        var mail = new LeadAssign
                        {
                            to   = to,
                            cc   = cc,
                            lead = dbLead
                        };

                        //return new EmailViewResult(mail);

                        mail.Send();
                    }
                    lead.LeadID = dbLead.LeadID;
                    ModelState.Clear();


                    ViewBag.FormSucces = true;
                }
            }

            List <AssociationListModel> tmp = reposetory.GetAssociationList(); //.RemoveAll(item => CU.Memberships.ToList().Exists(p => p.Association.AssociationID == item.AssociationID));

            ViewBag.Attach = new SelectList(tmp, "AssociationID", "Name");
            return(View(lead));
        }
Example #4
0
        public ActionResult StatusUpdateRecived(Guid ID)
        {
            Lead dbLead = new Lead();

            dbLead = reposetory.GetLead(ID);
            if (dbLead == null)
            {
                return(null);
            }

            dbLead.Status            = LeadStatus.Recived;
            dbLead.RequestUpdateMail = false;

            if (reposetory.Save(dbLead))
            {
                if (dbLead.AssociationID != null)
                {
                    string        to = string.Empty;
                    List <string> cc = new List <string>();

                    AccessModel Access = reposetory.GetAccess((Guid)dbLead.AssociationID);

                    BoardModelView Board = reposetory.GetBoardView((Guid)dbLead.AssociationID);

                    to = string.Format("{0} <{1}>", Board.Chairmann.FullName, Board.Chairmann.Email);

                    foreach (PersonAccess M in Access.Form)
                    {
                        if (M.Secretary)
                        {
                            NRMembership p = reposetory.GetMembership(M.FunctionID);
                            //cc += string.Format("{0},", p.Person.Email);
                            cc.Add(string.Format("{0} <{1}>", p.Person.FullName, p.Person.Email));
                        }
                        else if (M.Planner)
                        {
                            NRMembership p = reposetory.GetMembership(M.FunctionID);
                            //cc += string.Format("{0},", p.Person.Email);
                            cc.Add(string.Format("{0} <{1}>", p.Person.FullName, p.Person.Email));
                        }
                    }



                    var mail = new LeadRecived
                    {
                        to   = to,
                        cc   = cc,
                        lead = dbLead
                    };

                    //return new EmailViewResult(mail);

                    mail.Send();
                }



                ViewBag.FormSucces = true;
            }

            return(RedirectToAction("Index"));
        }