client server program edits for form editor using reftab contact; using reftab messages; { if(form.save.submitter) { if(form.record == null) { db.contact.Insert({id:guid.Generate().ToStringN(), name:form.newName.text, phone:form.newPhone.text, category:form.newCategory.selectedText, address:form.newAddress.text, mail:form.newMail.text}); } else { var current = db.contact.Read({id:form.record.id}).Single(); if(current.name == form.record.name && current.phone == form.record.phone && current.category == form.record.category && current.address == form.record.address && current.mail == form.record.mail) { db.contact.Update({id:form.record.id}, {name:form.newName.text, phone:form.newPhone.text, category:form.newCategory.selectedText, address:form.newAddress.text, mail:form.newMail.text, edit_status:null}); } else { db.contact.Update({id:form.record.id}, {edit_status:null}); db.messages.Insert({id:guid.Generate().ToStringN(), username:form.info.user.name, message:"Your edit to \n" + current.name + "\nwasn't stored because \n" + "it conflicted with another user's change to the same contact."}); } } } if (form.delete.submitter) { var current = db.contact.Read({id:form.record.id}).SingleOrDefault(); if(current != null) { if(current.name == form.record.name && current.phone == form.record.phone && current.category == form.record.category && current.address == form.record.address && current.mail == form.record.mail) { db.contact.Delete({id:form.record.id}); } else { db.contact.Update({id:form.record.id}, {edit_status:null}); db.messages.Insert({id:guid.Generate().ToStringN(), username:form.info.user.name, message:current.name + "\nwasn't deleted because \n" + "another user has just updated the contact"}); } } } if (form.discard.submitter && form.record != null) { db.contact.Update({id:form.record.id},{edit_status:null}); } }