Exemplo n.º 1
0
 public ActionResult CreateNewProfile(ProfileModel model)
 {
     if (ModelState.IsValid)
     {
         AccountController ac  = new AccountController();
         String            id  = ac.RegisterNewAccount(model.username, model.password, System.Web.HttpContext.Current, "SalesRep");
         SaleRepProfile    srp = new SaleRepProfile();
         srp.userID    = id;
         srp.FirstName = model.firstname;
         srp.LastName  = model.lastname;
         srp.FullName  = model.firstname + " " + model.fullname + " " + model.lastname;
         srp.Email     = model.email;
         srp.City      = model.city;
         srp.Phone     = model.phone;
         Storage storeage = new Storage();
         srp.Avatar        = storeage.uploadMyfile(id, "avatar", model.avatar);
         srp.EmployedScine = DateTime.Today;
         srp.Country       = model.country;
         srp.dateOfBirth   = model.birthday;
         SSMEntities se = new SSMEntities();
         se.SaleRepProfiles.Add(srp);
         se.SaveChanges();
         return(RedirectToAction("Detail", new { id = id }));
     }
     return(RedirectToAction("NewProfile"));
 }
Exemplo n.º 2
0
        public ActionResult Detail(int id)
        {
            SSMEntities         se      = new SSMEntities();
            SaleRepProfile      profile = se.SaleRepProfiles.Find(id);
            AspNetUser          user    = profile.AspNetUser;
            List <GrapDataSets> lst     = new List <GrapDataSets>();
            List <String>       color   = new List <String> {
                "#0072BB", "#FF4C3B", "#FFD034", "#C6C8CA", "#0072BB", "#93228D"
            };

            foreach (Product_responsible pr in user.Product_responsible.ToList())
            {
                GrapDataSets gds = new GrapDataSets();


                gds.backgroundColor = color[0];
                gds.data            = new Random().Next(0, 100);
                gds.label           = pr.softwareProduct.name;
                lst.Add(gds);
                color.RemoveAt(0);
            }
            var jsonSerialiser = new JavaScriptSerializer();
            var json           = jsonSerialiser.Serialize(lst);

            ViewData["SaleRepRevenue"] = json;
            ViewData["SalerepDetail"]  = se.SaleRepProfiles.SqlQuery("SELECT * FROM SaleRepProfile where userID='" + user.Id + "'").FirstOrDefault();

            return(View());
        }
Exemplo n.º 3
0
        public ActionResult Commision()
        {
            SSMEntities    se      = new SSMEntities();
            SaleRepProfile profile = se.SaleRepProfiles.SqlQuery("SELECT * FROM SaleRepProfile where userID='" + User.Identity.GetUserId() + "'").FirstOrDefault();

            ViewData["TotalContactMade"] = profile.AspNetUser.contact_resposible.Count();
            ViewData["SaleCycle"]        = profile.SaleCycle;

            ViewData["Revenue"]               = profile.AspNetUser.SaleRepCommisions.Sum(u => u.Total);
            ViewData["Collected"]             = profile.AspNetUser.SaleRepCommisions.Sum(u => u.Paid);
            ViewData["TotalFromSubscription"] = profile.AspNetUser.SaleRepCommisions.Sum(u => u.MoneyFromSubcription);
            ViewData["TotalFromNewContract"]  = profile.AspNetUser.SaleRepCommisions.Sum(u => u.MoneyFromNewContract);
            ViewData["TotalUnpaid"]           = (double)ViewData["Revenue"] - (double)ViewData["Collected"];
            return(View("PersonalComission"));
        }