public ActionResult DeleteConfirmed(int id)
        {
            Webpcon webpcon = db.Webpcon.Find(id);

            db.Webpcon.Remove(webpcon);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,MyDate,Number,Side,System,Module,Project,FProject,AddFunction,elsetext,Description,Fid,Department,Applicant,Status")] Webpcon webpcon)
 {
     if (ModelState.IsValid)
     {
         db.Entry(webpcon).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(webpcon));
 }
        public ActionResult SentForm(Webpcon model)
        {
            var    service = new workflow();
            string pid     = service.Webpconwork(Session["Account"].ToString(), Session["Did"].ToString(), model);

            model.Department = Session["Did"].ToString();
            model.Applicant  = Session["Account"].ToString();
            model.Fid        = pid;
            var db = new DatabaseEntities();

            db.Webpcon.Add(model);
            db.SaveChanges();
            return(Content(pid));
        }
        // GET: Webpcons/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Webpcon webpcon = db.Webpcon.Find(id);

            if (webpcon == null)
            {
                return(HttpNotFound());
            }
            return(View(webpcon));
        }
Exemple #5
0
        public string Webpconwork(string account, string did, Webpcon model = null)
        {
            WebReference.WorkflowServiceService ws  = new WebReference.WorkflowServiceService();
            Dictionary <string, string>         dic = new Dictionary <string, string>();

            dic.Add("Date04", model.MyDate.ToString());                          //申請日期
            dic.Add("Textbox8", model.Number);                                   //編號
            dic.Add("Checkbox1", model.Side);                                    //端
            dic.Add("Textbox2", model.System);                                   //系統
            dic.Add("Textbox5", model.Module);                                   //模組
            dic.Add("Textbox9", model.Project);                                  //作業/功能項目
            dic.Add("Checkbox2", model.FProject);                                //
            dic.Add("Checkbox3", model.AddFunction);                             //新增功能
            dic.Add("Textbox0", model.elsetext);                                 //其他輸入欄位
            dic.Add("TextArea11", model.Description);                            //詳細敘述

            string FormoId      = ws.findFormOIDsOfProcess("PKG15666550428311"); //流程編號
            string FormTemplate = ws.getFormFieldTemplate(FormoId);

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(XmlReader.Create(new StringReader(FormTemplate)));
            XmlNodeList nodeList = xmlDoc.SelectSingleNode("WebPcon").ChildNodes;

            foreach (XmlNode xn in nodeList)
            {
                XmlElement xe = (XmlElement)xn;

                if (dic.ContainsKey(xe.GetAttribute("id")))
                {
                    xe.InnerText = dic[xe.GetAttribute("id")];
                }
            }

            MemoryStream memStream = new MemoryStream(500);

            xmlDoc.Save(memStream);
            string result = Encoding.UTF8.GetString(memStream.ToArray());
            string pid    = "";

            pid = ws.invokeProcess("PKG15666550428311", account, did, FormoId, result, "");

            return(pid);
        }