public ActionResult AttributeDetail(int id) { SSMEntities se = new SSMEntities(); ViewData["attr"] = se.productAttributes.Find(id); return(View("AttributeFragment")); }
public ActionResult Create() { List <SelectListItem> client = new List <SelectListItem>(); List <SelectListItem> product = new List <SelectListItem>(); //new SelectListItem() {Text="Alabama", Value="AL"} SSMEntities se = new SSMEntities(); String userID = User.Identity.GetUserId(); AspNetUser thissalerep = se.AspNetUsers.Find(userID); foreach (contact_resposible crm in thissalerep.contact_resposible.ToList()) { client.Add(new SelectListItem() { Text = crm.contact.FirstName + " " + crm.contact.MiddleName + " " + crm.contact.LastName, Value = crm.contactID + "" }); } foreach (Product_responsible plan in thissalerep.Product_responsible) { product.Add(new SelectListItem() { Text = plan.softwareProduct.name, Value = plan.softwareProduct.id + "" }); } ViewData["ProductResponsibleFor"] = product; ViewData["ClientResponsibleFor"] = client; ViewData["ProductPlan"] = se.productMarketPlans.ToList(); return(View("Create")); }
public ActionResult AddItemToDeal(int planID, float suggestprice, int quantity, int dealID) { SSMEntities se = new SSMEntities(); Deal deal = se.Deals.Find(dealID); if (deal != null) { Deal_Item item = new Deal_Item(); item.planID = planID; item.dealID = dealID; item.price = suggestprice; item.Quantity = quantity; if (deal.Value == null) { deal.Value = suggestprice * quantity; } else { deal.Value = deal.Value + suggestprice * quantity; } se.Deal_Item.Add(item); se.SaveChanges(); } return(RedirectToAction("Detail", new { id = dealID })); }
public ActionResult Detail(int id) { try { SSMEntities se = new SSMEntities(); Deal thisDeal = se.Deals.Find(id); List <SelectListItem> productPlan = new List <SelectListItem>(); foreach (productMarketPlan plan in thisDeal.productMarketPlan.softwareProduct.productMarketPlans.ToList()) { productPlan.Add(new SelectListItem() { Text = plan.Name, Value = plan.id + "" }); } ViewData["DealDetail"] = thisDeal; ViewData["PlanList"] = productPlan; ViewData["TaskStatus"] = se.TaskStatus.ToList(); ViewData["TaskTypes"] = se.TaskTypes.ToList(); softwareProduct thisproduct = thisDeal.PrePurchase_FollowUp_Plan.softwareProduct; foreach (PrePurchase_FollowUp_Plan plan in thisproduct.PrePurchase_FollowUp_Plan.ToList()) { if (plan.isOperation) { ViewData["ActiveFollowUpPlan"] = plan; } } } catch (Exception e) { } return(View("Detail")); }
public ActionResult Detail(int id) { SSMEntities se = new SSMEntities(); ViewData["ticketdetail"] = se.Tickets.Find(id); return(View("TicketDetail")); }
public ActionResult NewCommend(String description, int ticketID, HttpPostedFileBase file) { try { SSMEntities se = new SSMEntities(); if (file != null) { TicketFile ticketFile = new TicketFile(); Storage storeage = new Storage(); ticketFile.Url = storeage.uploadMyfile("ticket" + ticketID, "file" + ticketID, file); ticketFile.FileName = file.FileName; se.TicketFiles.Add(ticketFile); ticketFile.TicketID = ticketID; se.SaveChanges(); } TicketComment commend = new TicketComment(); commend.Creator = User.Identity.GetUserId(); commend.Description = description; commend.createddate = DateTime.Today; commend.point = 1; commend.ticketID = ticketID; commend.Accepted = false; se.TicketComments.Add(commend); se.SaveChanges(); return(RedirectToAction("Detail", new { id = ticketID })); } catch (Exception e) { } return(RedirectToAction("Index")); }
public ActionResult Downloads(int id) { SSMEntities se = new SSMEntities(); order or = se.orders.Find(id); CloudStorageAccount storageAccount = CloudStorageAccount.Parse("UseDevelopmentStorage=true"); // Create the blob client. CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); // Retrieve reference to a previously created container. CloudBlobContainer container = blobClient.GetContainerReference(or.customer.userID); container.CreateIfNotExists(); // Retrieve reference to a blob named "myblob". CloudBlockBlob blockBlob = container.GetBlockBlobReference("order" + or.id); blockBlob.FetchAttributes(); long fileByteLength = blockBlob.Properties.Length; byte[] fileContent = new byte[fileByteLength]; for (int i = 0; i < fileByteLength; i++) { fileContent[i] = 0x20; } blockBlob.DownloadToByteArray(fileContent, 0); return(File(fileContent, "application/pdf", "Contract")); }
public async Task <ActionResult> guimail() { var body = "<p>Email From: {0} ({1})</p><p>Message:</p><p>{2}</p>"; var message = new MailMessage(); message.To.Add(new MailAddress("*****@*****.**")); // replace with valid value message.From = new MailAddress("*****@*****.**"); // replace with valid value message.Subject = "Your email subject"; SSMEntities context = new SSMEntities(); message.Body = string.Format(body, "*****@*****.**", "*****@*****.**", context.Email_Template.ToList().First().MailContent); message.IsBodyHtml = true; using (var smtp = new SmtpClient()) { var credential = new NetworkCredential { UserName = "******", // replace with valid value Password = "******" // replace with valid value }; smtp.Credentials = credential; smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; await smtp.SendMailAsync(message); return(Json(new { success = " suc" }, JsonRequestBehavior.AllowGet)); } return(Json(new { success = " fale" }, JsonRequestBehavior.AllowGet)); }
// GET: Ticket public ActionResult Index() { SSMEntities se = new SSMEntities(); AspNetUser thisuer = se.AspNetUsers.Find(User.Identity.GetUserId()); ViewData["mytickets"] = thisuer.Tickets.ToList(); return(View("MyTickets")); }
// GET: Profile public ActionResult Index() { SSMEntities se = new SSMEntities(); String userID = User.Identity.GetUserId(); ViewData["SalerepDetail"] = se.SaleRepProfiles.SqlQuery("SELECT * FROM SaleRepProfile where userID='" + userID + "'").FirstOrDefault(); return(View()); }
public ActionResult LicenseUsing(int id) { SSMEntities se = new SSMEntities(); contact con = se.contacts.Find(id); ViewData["Licenses"] = se.Licenses.Where(u => u.customer.cusEmail.Equals(con.emails)).ToList(); ViewData["thiscontact"] = con; return(View("ContactDetail")); }
public ActionResult UpdateMail(string username, string password) { SSMEntities se = new SSMEntities(); se.ConfigureSys.Where(u => u.id == 1).First().value = username + ""; se.ConfigureSys.Where(u => u.id == 2).First().value = password + ""; se.SaveChanges(); return(RedirectToAction("SystemConfig")); }
public ActionResult NewPlan(int productID) { SSMEntities se = new SSMEntities(); ViewData["MailCate"] = se.EMAIL_Category.ToList(); ViewData["Product"] = productID; return(View("NewFollowUpPlan", new FollowupProgressModel())); }
// GET: Ticket public ActionResult Index() { SSMEntities se = new SSMEntities(); AspNetUser thisuer = se.AspNetUsers.Find(User.Identity.GetUserId()); ViewData["myticket"] = thisuer.Tickets.ToList(); ViewData["catelist"] = se.TicketCategories.ToList(); ViewData["mostviewedticket"] = se.Tickets.SqlQuery("select top 10 * from [Ticket] order by ViewCounted").ToList(); return(View()); }
public bool getScheduleByCell(int cellID, String userID) { SSMEntities se = new SSMEntities(); List <MasterSchedule_User> lst = se.MasterSchedule_User.SqlQuery("SELECT * FROM MasterSchedule_User WHERE userid='" + userID + "' and scheduleID = " + cellID).ToList(); if (lst.Count() > 0) { return(true); } return(false); }
public ActionResult PlanList() { SSMEntities se = new SSMEntities(); List <productMarketPlan> lst = se.productMarketPlans.SqlQuery("SELECT * FROM productMarketPlan WHERE operating =1").ToList(); List <softwareProduct> lst2 = se.softwareProducts.ToList(); ViewData["ProductList"] = lst2; ViewData["PlanList"] = lst; return(View("MarketPlan")); }
public JsonResult getPlanMinMax(int planID) { SSMEntities se = new SSMEntities(); productMarketPlan plan = se.productMarketPlans.Find(planID); if (plan != null) { return(Json(new { min = plan.floorprice, max = plan.ceilPrice }, JsonRequestBehavior.AllowGet)); } return(Json(new { result = "fail" }, JsonRequestBehavior.AllowGet)); }
public ActionResult UdpateMetric(int sc, int act, int ncm, int wr, int asv) { SSMEntities se = new SSMEntities(); se.ConfigureSys.Where(u => u.id == 15).First().value = sc + ""; se.ConfigureSys.Where(u => u.id == 16).First().value = act + ""; se.ConfigureSys.Where(u => u.id == 17).First().value = ncm + ""; se.ConfigureSys.Where(u => u.id == 19).First().value = wr + ""; se.ConfigureSys.Where(u => u.id == 20).First().value = asv + ""; se.SaveChanges(); return(RedirectToAction("SystemConfig")); }
public ActionResult LicenseImport(HttpPostedFileBase excelfile, int planID) { SSMEntities se = new SSMEntities(); if (excelfile == null || excelfile.ContentLength == 0) { ViewBag.Error = "Please select an Excel file<br>"; return(View("Index")); } else { if (excelfile.FileName.EndsWith("xls") || excelfile.FileName.EndsWith("xlsx")) { string path = Server.MapPath("~/Content/" + excelfile.FileName); System.Diagnostics.Debug.WriteLine("noa ne: " + path); if (System.IO.File.Exists(path)) { System.IO.File.Delete(path); } excelfile.SaveAs(path); // Read data from excel file Excel.Application application = new Excel.Application(); Excel.Workbook workbook = application.Workbooks.Open(path); Excel.Worksheet worksheet = workbook.ActiveSheet; Excel.Range range = worksheet.UsedRange; List <TrialAccount> listAccounts = new List <TrialAccount>(); // row = 3 is the row data begin with - 1 for (int row = 3; row <= range.Rows.Count; row++) { License lic = new License(); lic.LicenseKey = ((Excel.Range)range.Cells[row, 1]).Text; lic.PlanID = planID; lic.licenseDuration = ((Excel.Range)range.Cells[row, 2]).Text; lic.LinkUse = ((Excel.Range)range.Cells[row, 3]).Text; lic.AdminAccount = ((Excel.Range)range.Cells[row, 4]).Text; lic.AdminPassword = ((Excel.Range)range.Cells[row, 5]).Text; //account.PlanID = int.Parse(((Excel.Range)range.Cells[row, 3]).Text); //DateTime createdDate = Convert.ToDateTime(((Excel.Range)range.Cells[row, 4]).Text); //account.createdDate = createdDate; se.Licenses.Add(lic); } application.Workbooks.Close(); se.SaveChanges(); return(RedirectToAction("MarketPlanDetail", new { id = planID })); } else { return(RedirectToAction("MarketPlanDetail", new { id = planID })); } } }
public ActionResult newRequest(int planid) { ViewData["planID"] = planid; SSMEntities se = new SSMEntities(); productMarketPlan plan = se.productMarketPlans.Find(planid); int salerepresponse = plan.softwareProduct.Product_responsible.Count(); List <Calendar> blockeddate = se.Calendars.Where(u => u.repeat).ToList(); if (blockeddate.Count() > 0) { System.Diagnostics.Debug.WriteLine("cc"); Calendar core = blockeddate.First(); List <Calendar> coreDate = blockeddate.Where(u => u.userID.Equals(core.userID)).ToList(); List <Calendar> BlockedDate = new List <Calendar>(); var dates = new List <Tuple <DateTime, DateTime> >(); foreach (Calendar corecal in coreDate) { int meet = 0; foreach (Calendar cal in blockeddate) { if (cal != corecal) { if (cal.startTime <= corecal.endTime && cal.endTime >= corecal.startTime) { meet = meet + 1; corecal.startTime = bigger(cal.startTime, corecal.startTime); corecal.endTime = smaller(cal.endTime, corecal.endTime); } } } System.Diagnostics.Debug.WriteLine("mett " + meet + " res " + salerepresponse); if (meet == salerepresponse - 1) { BlockedDate.Add(corecal); } } if (BlockedDate.Count() > 0) { ViewData["unavailabledate"] = BlockedDate; } } else { ViewData["unavailabledate"] = null; } ViewData["repcount"] = salerepresponse; return(View("ScheduleDemo")); }
public ActionResult CreateNewProgress(FollowupProgressModel model) { PrePurchase_FollowUp_Plan plan = new PrePurchase_FollowUp_Plan(); plan.Description = model.Desription; plan.name = model.Name; plan.isActive = true; plan.isOperation = false; plan.productID = model.productID; plan.createDate = DateTime.Today; SSMEntities se = new SSMEntities(); se.PrePurchase_FollowUp_Plan.Add(plan); se.SaveChanges(); foreach (Plan_Step step in model.steps.ToList()) { if (step.StepEmailContent == null) { model.steps.Remove(step); } else if (step.StepEmailContent.Trim().Length == 0) { model.steps.Remove(step); } } for (int i = 0; i < model.steps.Count(); i++) { Plan_Step step = model.steps[i]; step.stepNo = (i + 1); step.planID = plan.id; se.Plan_Step.Add(step); se.SaveChanges(); } for (int i = 0; i < model.steps.Count(); i++) { Plan_Step step = model.steps[i]; if (i != 0) { step.previousStep = model.steps[i - 1].id; } if (i != model.steps.Count() - 1) { step.nextStep = model.steps[i + 1].id; } se.SaveChanges(); } return(RedirectToAction("Detail", new { id = model.productID })); }
public ActionResult NewTrialAccount(String username, String password, int planID) { SSMEntities se = new SSMEntities(); TrialAccount trail = new TrialAccount(); trail.UserName = username; trail.Password = password; trail.PlanID = planID; trail.Status = 1; se.TrialAccounts.Add(trail); se.SaveChanges(); return(RedirectToAction("MarketPlanDetail", new { id = planID })); }