예제 #1
0
        public ActionResult FormItemView(long siteId, long menuId, long id, byte checkStatus, string remark, bool?isEvent)
        {
            FormItem item = FormItemDAO.GetItem(id);

            item.CheckStatus = checkStatus;
            item.Remark      = remark;
            FormItemDAO.SetItem(item);

            ViewBag.IsEvent   = isEvent ?? false;
            ViewBag.SiteID    = siteId;
            ViewBag.MenuID    = menuId;
            ViewBag.UploadUrl = Golbal.UpdFileInfo.GetVPathByMenuID(siteId, menuId).TrimEnd('/');

            ViewBag.Exit = true;
            return(View(item));
        }
예제 #2
0
        private FormItem FormItemSave(FormModel form)
        {
            FormItem formItem = new FormItem {
                FormID = form.ID, ID = WorkLib.GetItem.NewSN(), IsTemp = false
            };
            IEnumerable <FieldModel> fields = form.GetFields();

            foreach (FieldModel field in fields)
            {
                string val = Request.Form[field.ID.ToString()] ?? string.Empty;
                if (field.TypeID == "address")
                {
                    string regions    = Request.Form["Regions_" + field.ID] ?? string.Empty;
                    int[]  regionList = null;
                    if (regions != string.Empty)
                    {
                        regionList = JsonConvert.DeserializeObject <int[]>(regions);
                    }

                    string address = Request.Form["Address_" + field.ID] ?? string.Empty;
                    val = JsonConvert.SerializeObject(new FieldAddress {
                        Regions = regionList, Address = address
                    });
                }

                FieldValueDAO.SetItem(new FieldValue
                {
                    FormItemID = formItem.ID,
                    FieldID    = field.ID,
                    Value      = val
                });

                if (field.DefaultType != null)
                {
                    switch ((FieldDefaultType)(byte)field.DefaultType)
                    {
                    case FieldDefaultType.Email:
                        formItem.Email = val;
                        break;

                    case FieldDefaultType.姓名:
                        formItem.Name = val;
                        break;

                    case FieldDefaultType.性別:
                        formItem.Sex = val;
                        break;

                    case FieldDefaultType.身份證字號:
                        formItem.IDCard = val;
                        break;

                    case FieldDefaultType.手機:
                        formItem.Mobile = val;
                        break;

                    case FieldDefaultType.電話:
                        formItem.Phone = val;
                        break;
                    }
                }
            }

            FormItemDAO.SetItem(formItem);
            return(formItem);
        }