示例#1
0
        public void UpdateFormStatus(int FormId, FormStatus status)
        {
            Dataform form = GetForm(FormId);

            form.Status = (int)status;
            FormData.SubmitChanges();
        }
示例#2
0
        public void UpdateHistory(int FormId, FormStatus Status, string Note)
        {
            Dataform thisForm = GetForm(FormId);

            XElement published = new XElement("Action");

            published.Add(new XElement("Status", Status));
            published.Add(new XElement("User", WebContext.Profile.dbUserName));
            published.Add(new XElement("Date", DateTime.Now));
            published.Add(new XElement("Note", Note));
            if (thisForm.History == null)
            {
                //create a cml node
                thisForm.History = new XElement("xml");
            }
            thisForm.History.Add(published);
            FormData.SubmitChanges();

            UpdateXML(FormId, thisForm.History.ToString());
        }
示例#3
0
        public string GetHistory(int FormId)
        {
            Dataform form        = GetForm(FormId);
            string   retVal      = "";
            XElement formHistory = form.History;
            var      actions     = from ms in formHistory.Descendants("Action")
                                   orderby ms.Element("Date").Value descending
                                   select new
            {
                Status = ms.Element("Status").Value,
                User   = ms.Element("User").Value,
                Date   = ms.Element("Date").Value,
                Note   = ms.Element("Note").Value
            };

            string head = "", bottom = "";

            if (actions.Count() > 0)
            {
                head   = "<div class=\"table-responsive\"><table class=\"table table-bordered table-striped\"><thead><th>Status</th><th>Contact Name</th><th>Action Date</th><th>Notes</th></thead><tbody>";
                bottom = "</tbody></table></div>";
            }
            StringBuilder sb = new StringBuilder();

            sb.Append(head);

            foreach (var action in actions)
            {
                sb.Append("<tr>");
                sb.Append(string.Format("<td><span class=\"label label-{0}\">{0}</span></td>", action.Status));
                sb.Append(string.Format("<td class=\"user\">{0}</td>", action.User));
                sb.Append(string.Format("<td class=\"date\">{0:f}</td>", Convert.ToDateTime(action.Date)));
                sb.Append(string.Format("<td class=\"note\">{0}</td>", action.Note));
                sb.Append("</tr>");


                //retVal = retVal + "<div><span class=\"status\">Status: " + action.Status + " </span> by: <span class=\"user\">" + action.User + " </span> Date: <span class=\"date\">" + string.Format("{0:f}", Convert.ToDateTime(action.Date)) + "</span> <div class=\"note\">Note:" + action.Note + "</div></div>";
            }
            sb.Append(bottom);
            return(sb.ToString());
        }
示例#4
0
        public String SaveFormData(string type, string email, string name, string data, string attachements)
        {
            string ipAddress = getUserIP();

            Dataform dtForm = new Dataform
            {
                Guid         = System.Guid.NewGuid(),
                FormType     = type,
                IP           = ipAddress,
                Email        = email,
                Name         = name,
                DateCreated  = DateTime.Now,
                Data         = data,
                Attachements = attachements,
                Status       = (int)FormStatus.Pending,
                History      = new XElement("xml")
            };

            FormData.Dataforms.InsertOnSubmit(dtForm);
            FormData.SubmitChanges();

            return(dtForm.Guid.ToString());
        }
 partial void DeleteDataform(Dataform instance);
 partial void UpdateDataform(Dataform instance);
 partial void InsertDataform(Dataform instance);