Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Cwma cwma = db.Cwma.Find(id);

            db.Cwma.Remove(cwma);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
 public ActionResult Edit([Bind(Include = "Id,Department,Applicant,MyDate,StartDay,EndDay,Mytime1,Mytime2,Purpose,ApplicantMatter,AssistanceMatter,Description,Fid,Status")] Cwma cwma)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cwma).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cwma));
 }
Example #3
0
        //送出表單
        public ActionResult SentForm(Cwma model)
        {
            var    service = new workflow();
            string pid     = service.test(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.Cwma.Add(model);
            db.SaveChanges();
            return(Content(pid));
        }
Example #4
0
        // GET: AppCwmas/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Cwma cwma = db.Cwma.Find(id);

            if (cwma == null)
            {
                return(HttpNotFound());
            }
            return(View(cwma));
        }
Example #5
0
        public string test(string account, string did, Cwma model = null)
        {
            WebReference.WorkflowServiceService ws  = new WebReference.WorkflowServiceService();
            Dictionary <string, string>         dic = new Dictionary <string, string>();

            dic.Add("Textbox9", model.Department);         //申請單位
            dic.Add("Textbox10", model.Applicant);         //申請人/分機
            dic.Add("Date0", model.MyDate.ToString());     //申請日期
            dic.Add("Date1", model.StartDay?.ToString());  //刊登時間(始)
            dic.Add("Date2", model.EndDay?.ToString());    //刊登時間(末)
            dic.Add("Time12", model.Mytime1?.ToString());  //刊登時間(始)
            dic.Add("Time13", model.Mytime2?.ToString());  //刊登時間(末)
            dic.Add("Textbox13", model.Purpose);           //目的
            dic.Add("Checkbox16", model.ApplicantMatter);  //申請事項  ApplicantMatter
            dic.Add("Checkbox17", model.AssistanceMatter); //協助事項 AssistanceMatter
            dic.Add("TextArea1", model.Description);       //申請事項說明

            string FormoId      = ws.findFormOIDsOfProcess("PKG15459841889111");
            string FormTemplate = ws.getFormFieldTemplate(FormoId);

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(XmlReader.Create(new StringReader(FormTemplate)));
            XmlNodeList nodeList = xmlDoc.SelectSingleNode("L1105137216").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("PKG15459841889111", account, did, FormoId, result, "");

            return(pid);
        }