public async Task <ActionResult> DeleteConfirmed(int id) { OtaCompany otaCompany = await db.OtaCompany.FindAsync(id); db.OtaCompany.Remove(otaCompany); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public ActionResult ImportCompanyFromAgentGrade() { OtaCrmModel db = new OtaCrmModel(); var cityList = (from cc in db.ChinaCity select cc).ToList(); var exsitNames = (from c in db.OtaCompany select c.CompanyName).Distinct(); List <string> exsitNameList = exsitNames.ToList(); var q = (from p in db.AgentGradeOperation select p.agentName).Distinct(); int count = 0; foreach (string companyName in q) { if (string.IsNullOrEmpty(companyName) || exsitNameList.Contains(companyName)) { continue; } OtaCompany newItem = new OtaCompany(); newItem.BossBackground = ""; newItem.BossBusinessDesp = ""; newItem.BossIdNo = ""; newItem.CompanyName = companyName; newItem.CreateTime = DateTime.Now; newItem.BossName = ""; newItem.BusinessRange = "国内"; newItem.BusinessStatus = "在线"; newItem.CapitalAsserts = ""; newItem.CityName = ""; foreach (var city in cityList) { if (companyName.Contains(city.CityName.Replace("市", ""))) { newItem.CityName = city.ProvinceName + "-" + city.CityName; break; } } newItem.LegalPerson = "未知"; newItem.LegalPersonIdNo = ""; newItem.LegalPersonPhone = ""; newItem.OfficeNo = ""; newItem.OtherInvest = ""; newItem.RealAddress = ""; newItem.RegisterAddress = ""; newItem.SalesUserName = "******"; db.OtaCompany.Add(newItem); count++; } db.SaveChanges(); return(Content("导入成功:" + count.ToString())); }
public async Task <ActionResult> Edit(OtaCompany otaCompany) { if (ModelState.IsValid) { db.Entry(otaCompany).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Details", new { id = otaCompany.Id })); } return(View(otaCompany)); }
public async Task <ActionResult> Create(OtaCompany otaCompany) { if (ModelState.IsValid) { db.OtaCompany.Add(otaCompany); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(otaCompany)); }
// GET: OtaCompanies/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OtaCompany otaCompany = await db.OtaCompany.FindAsync(id); if (otaCompany == null) { return(HttpNotFound()); } return(View(otaCompany)); }
public async Task <ActionResult> Index(int?companyId) { var result = new List <AgentGradeOperation>(); if (companyId != null && companyId > 0) { OtaCompany c = db.OtaCompany.First(p => p.Id == companyId); var model = from p in db.AgentGradeOperation where p.agentName == c.CompanyName select p; ViewBag.CompanyName = c.CompanyName; ViewBag.CompanyId = c.Id; return(View(await model.ToListAsync())); } return(View(result)); }
// GET: OtaCompanies/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OtaCompany otaCompany = await db.OtaCompany.FindAsync(id); if (otaCompany == null) { return(HttpNotFound()); } ViewData["CompanyCertificateList"] = db.CompanyCertificate.Where(p => p.CompanyId == id).ToList(); return(View(otaCompany)); }
public ActionResult Create() { var model = new OtaCompany(); model.BossBackground = "机票代理人"; model.BossBusinessDesp = "民航"; model.CreateTime = DateTime.Now; string realName = new AccountController().GetRealName(User.Identity.Name); model.SalesUserName = realName; ViewData["ChinaCityList"] = GetChinaCityList(""); ViewData["BusinessRangeList"] = GetParamDictList("业务类型", "国内"); ViewData["BusinessStatusList"] = GetParamDictList("业务状态", "在线"); return(View(model)); }
// GET: OtaCompanies/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OtaCompany otaCompany = await db.OtaCompany.FindAsync(id); if (otaCompany == null) { return(HttpNotFound()); } //如果状态不在范围内,需要重置 ViewData["ChinaCityList"] = GetChinaCityList(otaCompany.CityName); ViewData["BusinessRangeList"] = GetParamDictList("业务类型", otaCompany.BusinessRange); ViewData["BusinessStatusList"] = GetParamDictList("业务状态", otaCompany.BusinessStatus); ViewData["SalesNameList"] = GetSalesNameList(otaCompany.SalesUserName); return(View(otaCompany)); }
public ActionResult ImportCompanyFromCms() { OtaCrmModel db = new OtaCrmModel(); var cityList = (from cc in db.ChinaCity select cc).ToList(); var exsitNames = (from c in db.OtaCompany select c.CompanyName).Distinct(); List <string> exsitNameList = exsitNames.ToList(); var q = (from p in db.CompanyCmsData select p); int count = 0; foreach (CompanyCmsData cmsItem in q) { string companyName = cmsItem.CompanyName; if (string.IsNullOrEmpty(companyName) || exsitNameList.Contains(companyName)) { continue; } OtaCompany newItem = new OtaCompany(); newItem.BossBackground = cmsItem.BossBackground; newItem.BossBusinessDesp = ""; newItem.BossIdNo = ""; newItem.CompanyName = companyName; newItem.CreateTime = DateTime.Now; newItem.BossName = cmsItem.ContactPerson; string businessRange = ""; if (!string.IsNullOrEmpty(cmsItem.GuojiWebName)) { businessRange = "国内"; } if (!string.IsNullOrEmpty(cmsItem.GuojiWebName)) { businessRange = "国际"; } if (!string.IsNullOrEmpty(cmsItem.GuojiWebName) && !string.IsNullOrEmpty(cmsItem.GuojiWebName)) { businessRange = "国内,国际"; } newItem.BusinessRange = businessRange; string businessStatus = "在线"; if (!string.IsNullOrEmpty(cmsItem.TTSStatusDesp) && cmsItem.TTSStatusDesp.Contains("终止")) { businessStatus = "终止"; } newItem.BusinessStatus = businessStatus; newItem.CapitalAsserts = ""; newItem.CityName = ""; foreach (var city in cityList) { if (!string.IsNullOrEmpty(cmsItem.RealAddress) && cmsItem.RealAddress.Contains(city.CityName.Replace("市", ""))) { newItem.CityName = city.ProvinceName + "-" + city.CityName; break; } } newItem.LegalPerson = string.IsNullOrEmpty(cmsItem.LegalPerson) ? "未知" : cmsItem.LegalPerson; newItem.LegalPersonIdNo = ""; newItem.LegalPersonPhone = cmsItem.ContactPhone; newItem.OfficeNo = ""; newItem.OtherInvest = ""; newItem.RealAddress = cmsItem.RealAddress; newItem.RegisterAddress = cmsItem.RegisterAddress; newItem.SalesUserName = cmsItem.SalesName; db.OtaCompany.Add(newItem); count++; } db.SaveChanges(); return(Content("导入成功:" + count.ToString())); }