コード例 #1
0
        public ActionResult Create(string TagId, string TagName, string firstname, string surname, int? managerId, string ContactType, string bestContactMethod,
            string KnowAs, string JobRole, string OfficePhone, string MobilePhone, string STHomePhone,
            string EmailAddress, string Workbase, string JobTitle, string ContactIsActive="0")
        {
            if (firstname == "")
            {
                ViewBag.ErrorMessage = "Please input the contact name";
                return RedirectToAction("Add", "Contact");
            }
            if (surname == "")
            {
                ViewBag.ErrorMessage = "Please input the contact surname";
                return RedirectToAction("Add", "Contact");
            }
            if (ContactType == "")
            {
                ViewBag.ErrorMessage = "Please input the contact type";
                return RedirectToAction("Add", "Contact");
            }
            Contact contact = new Contact();

            contact.FirstName = firstname;
            contact.Surname = surname;
            contact.ManagerID = managerId;
            contact.ContactType = ContactType;
            contact.BestContactMethod = bestContactMethod;
            contact.KnownAs = KnowAs;
            contact.JobRole = JobRole;
            contact.OfficePhone = OfficePhone;
            contact.MobilePhone = MobilePhone;
            contact.STHomePhone = STHomePhone;
            contact.EmailAddress = EmailAddress;
            contact.Workbase = Workbase;
            contact.JobTitle = JobTitle;
            contact.ContactIsActive = ContactIsActive=="0"?0:1;

            db.Contacts.InsertOnSubmit(contact);
            db.SubmitChanges();

            ViewBag.TagName = TagName;
            ViewBag.TagId = TagId;

            ViewBag.Alert = "true";
            ViewBag.Message = "Action success!";
            ViewBag.URL = "/Contact/List?TagId=" + TagId + "&TagName=" + TagName;

            return View("../Shared/Redirect");
            //return Redirect("/Contact/List?TagId=" + TagId + "&TagName=" + TagName);
        }
コード例 #2
0
 public void Insert(Contact newcont)
 {
     dataAccess.Contacts.InsertOnSubmit(newcont);
     dataAccess.SubmitChanges();
 }
コード例 #3
0
 partial void DeleteContact(Contact instance);
コード例 #4
0
 partial void UpdateContact(Contact instance);
コード例 #5
0
 partial void InsertContact(Contact instance);
コード例 #6
0
		private void detach_Contacts(Contact entity)
		{
			this.SendPropertyChanging();
			entity.Contact1 = null;
		}
コード例 #7
0
		private void attach_Contacts(Contact entity)
		{
			this.SendPropertyChanging();
			entity.Contact1 = this;
		}