public ActionResult Create(Project item, IEnumerable <HttpPostedFileBase> attachments) { this.AddErrorIfAllNamesEmpty(item); this.AddErrorStateIfStartDateLaterThanEndDate(item.StartDate, item.EndDate); if (ModelState.IsValid) { if (attachments != null) { if (string.IsNullOrEmpty(item.SalesBriefName)) { item.SalesBriefName = "销售简介"; } foreach (var file in attachments) { var fileName = Path.GetFileName(file.FileName).Replace(" ", "");; string serverpath = "/Uploads/Projects/" + item.ProjectCode + "/Salesbrief"; string path = Server.MapPath(serverpath); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } var physicalPath = Path.Combine(path, fileName); file.SaveAs(physicalPath); item.SalesBriefUrl = serverpath + "/" + fileName; } } CH.Create <Project>(item); return(RedirectToAction("Index")); } return(View(item)); }
public ActionResult AddBreakdown(List <string> checkin, List <string> dealin, int projectid, int TargetOfMonthid, DateTime?startdate, DateTime?enddate, string OldDate) { ViewBag.ProjectID = projectid; ViewBag.TargetOfMonthID = TargetOfMonthid; this.AddErrorStateIfStartDateAndEndDateEmpty(startdate, enddate); if (ModelState.IsValid) { this.AddErrorStateIfNotFromMondayToFriday(startdate.Value, enddate.Value); this.AddErrorStateIfTargetOfWeekExist(startdate.Value, TargetOfMonthid); } if (ModelState.IsValid) { if (checkin != null) { for (int i = 0; i < checkin.Count; i++) { var ck = checkin[i].Split('|'); var name = ck[0]; var ckvalue = ck[1]; var dl = dealin[i].Split('|'); var dlvalue = dl[1]; CH.Create <TargetOfWeek>(new TargetOfWeek() { CheckIn = Decimal.Parse(ckvalue), Deal = Decimal.Parse(dlvalue), EndDate = enddate.Value, Member = name, StartDate = startdate.Value, ProjectID = projectid, TargetOfMonthID = TargetOfMonthid }); } } return(RedirectToAction("BreakdownIndex", "teamleader", new { id = projectid })); } return(View(@"~\views\targetofmonth\Breakdown.cshtml", CH.GetAllData <Member>(m => m.ProjectID == projectid))); }
public ActionResult AddCompany(Company item, int?projectid, int[] checkedCategorys) { projectid = this.TrySetProjectIDForUser(projectid); ViewBag.ProjectID = projectid; this.AddAddErrorStateIfOneOfNameExist <Company>(item.Name_EN, item.Name_CH); this.AddErrorIfAllNamesEmpty(item); if (ModelState.IsValid) { List <Category> lc = new List <Category>(); if (checkedCategorys != null) { lc = CH.GetAllData <Category>(i => checkedCategorys.Contains(i.ID)); } var p = CH.GetDataById <Project>(projectid); CH.Create <Company>(item); var ms = new List <Member>(); ms.Add(p.GetMemberInProjectByName(Employee.CurrentUserName)); var cr = new CompanyRelationship() { CompanyID = item.ID, ProjectID = projectid, Importancy = 1, Members = ms, Categorys = lc }; CH.Create <CompanyRelationship>(cr); return(RedirectToAction("CompanyRelationshipIndex", "productinterface", new { projectid = projectid })); } else { return(View()); } }
public ActionResult Create(Lead item) { if (EntityUtl.Utl.CheckPropertyAllNull(item, "Name_EN", "Name_CH")) { ModelState.AddModelError("", "名字不完整,中文名和英文名不能同时为空"); } if (EntityUtl.Utl.CheckPropertyAllNull(item, "EMail", "Fax")) { ModelState.AddModelError("", "联系方式不完整,座机和传真号不能同时为空"); } if (ModelState.IsValid) { Image image = ImageController.UploadImg(Request, item.Image); if (image != null) { item.ImageID = image.ID; } CH.Create <Lead>(item); return(RedirectToAction("Index", "Company")); } ViewBag.CompanyID = item.CompanyID; return(View(item)); }
/// <summary> /// 拷贝对象 /// </summary> /// <param name="allPropertyUpdate">是否识别为所有属性都被修改</param> /// <returns></returns> public object Clone() { object target = CH.Create(this.GetType()); CopyTo(target); return(target); }
public ActionResult Create(PaymentType item) { if (ModelState.IsValid) { CH.Create <PaymentType>(item); return(RedirectToAction("Index")); } return(View(item)); }
public ActionResult Create(Department item) { if (ModelState.IsValid) { CH.Create <Department>(item); return(RedirectToAction("Index")); } return(View(item)); }
public ActionResult Create(DistrictNumber item) { if (ModelState.IsValid) { CH.Create <DistrictNumber>(item); return(RedirectToAction("Index")); } return(View(item)); }
public ActionResult Create(PhoneSaleSupport item) { if (ModelState.IsValid) { CH.Create <PhoneSaleSupport>(item); return(RedirectToAction("Index")); } return(View(item)); }
public ActionResult Create(Area item) { if (ModelState.IsValid) { CH.Create <Area>(item); return(RedirectToAction("Index")); } return(View(item)); }
public ActionResult Create(SubCompany item, int?projectid) { if (ModelState.IsValid) { CH.Create <SubCompany>(item); return(RedirectToAction("Management", "Project", new { id = projectid, tabindex = 3 })); } return(View(item)); }
public ActionResult Create(OnPhoneBlockType item) { if (ModelState.IsValid) { CH.Create <OnPhoneBlockType>(item); return(RedirectToAction("Index")); } return(View(item)); }
public ActionResult Create(PackageItem item) { if (ModelState.IsValid) { CH.Create <PackageItem>(item); return(RedirectToAction("Index", "Package")); } ViewBag.PackageID = item.PackageID; return(View(item)); }
public ActionResult Create(Template item) { if (ModelState.IsValid) { item.Content = HttpUtility.HtmlDecode(item.Content); CH.Create <Template>(item); return(RedirectToAction("Index")); } return(View(item)); }
public ActionResult _InsertParticipantAjaxEditing(int participantid) { var item = new Participant(); if (TryUpdateModel(item)) { CH.Create <Participant>(item); } return(View(new GridModel(GetParticipant(item.ProjectID, item.DealID)))); }
public ActionResult Create(ProjectRight item, List <int> rights) { if (ModelState.IsValid) { var ars = CH.GetAllData <AccessRight>(a => rights.Contains(a.ID)); item.AccessRights = ars; CH.Create <ProjectRight>(item); return(RedirectToAction("Index")); } return(View(item)); }
public ActionResult Create(TargetOfMonth item) { this.AddErrorStateIfTargetOfMonthNoValid(item); if (ModelState.IsValid) { CH.Create <TargetOfMonth>(item); return(RedirectToAction("Management", "Project", new { id = item.ProjectID, tabindex = 2 })); } ViewBag.ProjectID = item.ProjectID; return(View(item)); }
public ActionResult Create(TargetOfMonthForMember item) { this.AddErrorStateIfTargetOfMonthNoValid(item); if (ModelState.IsValid) { CH.Create <TargetOfMonthForMember>(item); return(RedirectToAction("MyTargetIndex", new { projectid = item.ProjectID })); } ViewBag.ProjectID = item.ProjectID; return(View(item)); }
public ActionResult _InsertAjaxEditing() { var item = new ProjectType(); if (TryUpdateModel(item)) { CH.Create <ProjectType>(item); } //Rebind the grid return(View(new GridModel(CH.GetAllData <ProjectType>()))); }
public ActionResult _Insert() { var item = new UserFavorsCrmGroup(); if (TryUpdateModel(item)) { item.UserName = Employee.CurrentUserName; CH.Create <UserFavorsCrmGroup>(item); } return(View(new GridModel(DataQuery()))); }
/// <summary> /// 添加已存在的公司到项目 /// </summary> /// <param name="item"></param> public static void AddExistCompanyToNewCompanyRelationship(this Project item, int?companyid) { bool exist = item.CompanyRelationships.Any(ex => ex.CompanyID == companyid); if (!exist) { CH.Create <CompanyRelationship>(new CompanyRelationship() { CompanyID = companyid, ProjectID = item.ID, Importancy = 6 }); } }
public ActionResult Save_LeadCall(LeadCall callresult) { CH.Create <LeadCall>(callresult); callresult = CH.GetAllData <LeadCall>(lc => lc.LeadID == callresult.LeadID).FirstOrDefault(); //return new DataJsonResult<Lead>() { Data = data }; return(new DataJsonResult <LeadCall>() { Data = callresult }); }
public ActionResult Create(Category item) { //this.AddErrorStateIfFieldExist<Category>(item, "Name"); if (ModelState.IsValid) { CH.Create <Category>(item); return(RedirectToAction("management", "project", new { id = item.ProjectID, tabindex = 0 })); } ViewBag.ProjectID = item.ProjectID; return(View(item)); }
public ActionResult Create(Member item) { //this.AddErrorStateIfMemberExist(item.ProjectID,item.Name); if (ModelState.IsValid) { CH.Create <Member>(item); return(RedirectToAction("Management", "Project", new { id = item.ProjectID, tabindex = 1 })); } ViewBag.ProjectID = item.ProjectID; return(View(item)); }
public ActionResult Create(string enname, string chname, CompanyRelationship item, int[] checkedCategorys) { this.AddErrorIfAllNamesEmpty(enname, chname); this.AddAddErrorStateIfOneOfNameExist <Company>(enname, chname); if (ModelState.IsValid) { var company = new Company() { Name_EN = enname, Name_CH = chname, Creator = Employee.CurrentUserName, From = Employee.GetCurrentProfile("Department").ToString() }; CH.Create <Company>(company); if (ModelState.IsValid) { string categorystring = string.Empty; if (checkedCategorys != null) { var ck = CH.GetAllData <Category>(i => checkedCategorys.Contains(i.ID)); item.Categorys = ck; ck.ForEach(l => { if (string.IsNullOrEmpty(categorystring)) { categorystring = l.Name; } else { categorystring += "|" + l.Name; } }); item.CategoryString = categorystring; } item.CompanyID = company.ID; CH.Create <CompanyRelationship>(item); if (Employee.EqualToProductInterface()) { return(RedirectToAction("companyrelationshipindex", "productinterface", new { id = item.ProjectID })); } else { return(RedirectToAction("management", "project", new { id = item.ProjectID, tabindex = 3 })); } } } ViewBag.ProjectID = item.ProjectID; return(View()); }
public ActionResult Create(Message item) { if (ModelState.IsValid) { item.Member = Employee.CurrentUserName; var p = CH.GetDataById <Project>(item.ProjectID); item = item.SetFlowNumber(p); var m = p.GetMemberInProjectByName(item.Member); item.SalesTypeID = m.SalesTypeID; CH.Create <Message>(item); return(RedirectToAction("Management", "Project", new { id = item.ProjectID, tabindex = 5 })); } return(View(item)); }
public ActionResult Create(FormCollection c) { try { int id = int.Parse(c["id"]); string summary = Server.UrlDecode(c["summary"]); ProjectReview pr = new ProjectReview(); pr.ProjectID = id; pr.Summary = summary; CH.Create <ProjectReview>(pr); } catch (Exception e) { } return(Json("")); }
public ActionResult Save_LeadPackage(int leadid, int companyrelationshipid, int packageid) { var old = CH.GetAllData <TargetOfPackage>(i => i.LeadID == leadid).FirstOrDefault(); if (old != null && old.PackageID != packageid) { CH.Delete <TargetOfPackage>(old.ID); } CH.Create <TargetOfPackage>(new TargetOfPackage() { PackageID = packageid, LeadID = leadid, CompanyRelationshipID = companyrelationshipid }); return(new JsonResult()); }
public ActionResult _InsertAjaxEditing() { var item = new CommentContent(); if (TryUpdateModel(item)) { if (ModelState.IsValid) { CH.Create <CommentContent>(item); } } //Rebind the grid List <CommentContent> list = CH.GetAllData <CommentContent>(); return(View(new GridModel(list))); }
public ActionResult Create(Research item) { if (ModelState.IsValid) { // item.Contents = HttpUtility.HtmlEncode(item.Contents); item.AddPerson = Employee.CurrentUserName; Image image = ImageController.UploadImg(Request, item.Image); if (image != null) { item.ImageID = image.ID; } CH.Create <Research>(item); return(RedirectToAction("MyIndex")); } return(View(item)); }