コード例 #1
0
ファイル: FormController.cs プロジェクト: jim-deng-git/Ask
        public ActionResult Edit(long siteId, CardsModels model, Captcha captcha)
        {
            SitePage  curPage = CardsDAO.GetPage(model.No);
            FormModel item    = FormDAO.GetItemFromSourceID(curPage.MenuID);

            if (item.HasCaptcha)
            {
                if (captcha == null || !captcha.Validate())
                {
                    return(new HttpStatusCodeResult(System.Net.HttpStatusCode.NonAuthoritativeInformation, "驗證碼錯誤"));
                }
            }

            FormItem formItem = FormItemSave(item);

            SendEmail(curPage.SiteID, item, formItem);

            ViewBag.CurPage         = curPage;
            ViewBag.FormItem        = formItem;
            ViewBag.UploadDesignUrl = Golbal.UpdFileInfo.GetVPathBySiteID(curPage.SiteID, formDesignFileDir).TrimEnd('/') + "/";
            ViewBag.UploadUrl       = Golbal.UpdFileInfo.GetVPathByMenuID(curPage.SiteID, curPage.MenuID);
            ViewBag.Int64Convert    = new Golbal.Int64Converter();

            ViewBag.Exit = true;

            return(View(item));
        }
コード例 #2
0
        public ActionResult Statistics(long siteId, long menuId, long?id, bool?isEvent)
        {
            if (id == null)
            {
                id = 0;
                FormModel item = FormDAO.GetItemFromSourceID(menuId);
                if (item != null)
                {
                    id = item.ID;
                }
            }
            IEnumerable <FieldModel> fields      = FieldDAO.GetItems((long)id);
            IEnumerable <FieldValue> fieldValues = FieldValueDAO.GetItemsByFormID((long)id);
            bool hasValues = false;

            foreach (var item in fields)
            {
                IEnumerable <FieldValue> values = fieldValues.Where(v => v.FieldID == item.ID);
                int total = values.Count();
                if (total > 0)
                {
                    hasValues = true;
                    break;
                }
            }
            ViewBag.hasValues = hasValues;
            ViewBag.Values    = fieldValues;
            ViewBag.SiteID    = siteId;
            ViewBag.MenuID    = menuId;
            ViewBag.IsEvent   = isEvent ?? false;

            return(View(fields));
        }
コード例 #3
0
        public ActionResult FieldSetting(long formId, string type, long?id)
        {
            FieldModel field = null;

            if (id != null)
            {
                field = FieldDAO.GetItem((long)id);
            }

            if (field == null)
            {
                field = new FieldModel {
                    ID = WorkLib.GetItem.NewSN(), TypeID = type, Width = (int)WorkV3.Common.FieldWidth.Half, High = (int)WorkV3.Common.FieldHeight.五行, RepeatLimit = (byte)FieldRepeatLimit.可任意報名
                };
            }

            FormModel form = FormDAO.GetItem(formId);

            ViewBag.UploadUrl    = Golbal.UpdFileInfo.GetVPathBySiteID((long)form.SiteID, formDesignFileDir).TrimEnd('/');
            ViewBag.SiteID       = form.SiteID;
            ViewBag.MenuID       = form.SourceID;
            ViewBag.FormID       = formId;
            ViewBag.CustomFolder = formDesignFileDir;
            return(View($"Field{ type }", field));
        }
コード例 #4
0
        public MainWindow()
        {
            InitializeComponent();

            tableDatas = new List <string>();
            tableDatas.Add("form");
            tableDatas.Add("question");
            tableDatas.Add("question_option");
            UpdateTableData.ItemsSource = tableDatas;
            DeleteTableData.ItemsSource = tableDatas;

            formdata           = new FormDAO();
            questiondata       = new QuestionDAO();
            questionOptiondata = new QuestionOptionDAO();
            resultdata         = new ResultDAO();
            usersdata          = new UsersDAO();

            MySqlConnection connection = MyMySQLConnection.ConnectionSingleton();

            connection.Open();
            formColumnNames           = formdata.FindColumnNamesOnlyString(connection);
            questionColumnNames       = questiondata.FindColumnNamesOnlyString(connection);
            questionOptionColumnNames = questionOptiondata.FindColumnNamesOnlyString(connection);
            resultColumnNames         = resultdata.FindColumnNamesOnlyString(connection);
            connection.Close();
        }
コード例 #5
0
        public ActionResult LoadTemplate(long siteId, long menuId, long formId)
        {
            ViewBag.SiteID = siteId;
            ViewBag.MenuID = menuId;
            ViewBag.FormID = formId;

            return(View(FormDAO.GetTemplates(siteId)));
        }
コード例 #6
0
        public ActionResult AdminSelect(long siteId, long formId)
        {
            ViewBag.SiteID = siteId;

            IEnumerable <FormAdmin> sysAdmins = FormDAO.GetSystemAdmins(siteId);

            ViewBag.Int64Converter = new WorkV3.Golbal.Int64Converter();
            return(View(sysAdmins));
        }
コード例 #7
0
        public void SendOutMail(FormType formType)
        {
            IList <FormDTO> formDTOList = FormDAO.LoadUnsentForms <FormDTO>(formType);

            foreach (FormDTO currentForm in formDTOList)
            {
                EmailSender.MailSend(server, FormDAO.GetEmailAddresses(), EmailSender.BodyBuilderFormDTO(currentForm), formType.GetDescription(), currentForm.Email.ToString());
                FormDAO.SetEmailSent(currentForm, true);
            }
        }
コード例 #8
0
        public ActionResult FieldDesignViewAsync(string ids)
        {
            IEnumerable <long>       idList = ids.Split(',').Select(item => long.Parse(item));
            IEnumerable <FieldModel> fields = FieldDAO.GetItems(idList);

            FormModel form = FormDAO.GetItem(fields.First().ParentID);

            ViewBag.UploadDesignUrl = Golbal.UpdFileInfo.GetVPathBySiteID((long)form.SiteID, formDesignFileDir).TrimEnd('/');

            return(View("FieldDesignView", fields));
        }
コード例 #9
0
        public void submitButtonClicked(object sender, EventArgs args)
        {
            var form = CreateFormDTO(FormType.GarantieKeuring);

            FormDAO.SaveForm(form);
            ThreadPool.SetMaxThreads(4, 16);
            ThreadPool.QueueUserWorkItem(new WaitCallback((x) => SendOutMail(FormType.GarantieKeuring)));

            // Meg visszaigazoljon
            Response.Redirect("/confirmation.htm");
        }
コード例 #10
0
        public string SendMail(long siteId, long menuId, FormMailModel mail, string[] fileList, string recipientIds, string recipientEmails, bool isTest, bool?isEvent = false)
        {
            if (mail == null || string.IsNullOrWhiteSpace(mail.MailBody))
            {
                return("Mail 為 NULL");
            }

            if (isTest && string.IsNullOrWhiteSpace(recipientEmails))
            {
                return("測試郵件缺少收信人");
            }

            if (!isTest && string.IsNullOrWhiteSpace(recipientIds))
            {
                return("未選擇郵件發送用戶");
            }

            SitesModels site = SitesDAO.GetInfo(siteId);

            System.Collections.ArrayList emailFiles = new System.Collections.ArrayList();
            List <ResourceFilesModels>   files      = new List <ResourceFilesModels>();

            if (fileList?.Length > 0)
            {
                string uploadPath = Golbal.UpdFileInfo.GetUPathByMenuID(siteId, menuId).TrimEnd('\\') + "\\";
                foreach (string item in fileList)
                {
                    ResourceFilesModels file = JsonConvert.DeserializeObject <ResourceFilesModels>(item);
                    files.Add(file);
                    emailFiles.Add(uploadPath + file.FileInfo);
                }
            }
            mail.Files = JsonConvert.SerializeObject(files);

            FormModel form        = FormDAO.GetItem(mail.FormID);
            string    mailSubject = mail.MailSubject.Replace("[WebsiteName]", site.Title).Replace("[SendDate]", DateTime.Now.ToString(WebInfo.DateFmt));
            string    mailBody    = mail.MailBody.Replace("[WebsiteName]", site.Title).Replace("[SendDate]", DateTime.Now.ToString(WebInfo.DateFmt));

            mailSubject = mailSubject.Replace("[FormName]", form.Title);
            mailBody    = mailBody.Replace("[FormName]", form.Title);

            if (isTest)
            {
                SendMailTest(siteId, mail, mailSubject, mailBody, emailFiles, recipientEmails, isEvent);
                return("測試郵件發送成功");
            }

            mail.ID = WorkLib.GetItem.NewSN();
            FormMailDAO.SetItem(mail);
            MailSend(siteId, mail, mailSubject, mailBody, emailFiles, recipientIds);
            return("郵件發送成功");
        }
コード例 #11
0
ファイル: FormController.cs プロジェクト: jim-deng-git/Ask
        public ActionResult Edit(CardsModels model)
        {
            SitePage curPage = CardsDAO.GetPage(model.No);

            ViewBag.CurPage = curPage;

            FormModel item = FormDAO.GetItemFromSourceID(curPage.MenuID);

            ViewBag.UploadDesignUrl = Golbal.UpdFileInfo.GetVPathBySiteID(curPage.SiteID, formDesignFileDir).TrimEnd('/') + "/";
            ViewBag.UploadUrl       = Golbal.UpdFileInfo.GetVPathByMenuID(curPage.SiteID, curPage.MenuID);
            ViewBag.Int64Convert    = new Golbal.Int64Converter();
            return(View(item));
        }
コード例 #12
0
ファイル: FormRepository.cs プロジェクト: hungvimanh/TF2.2.BE
        public async Task <bool> Create(Form form)
        {
            FormDAO formDAO = new FormDAO
            {
                Id                    = form.Id,
                Graduated             = form.Graduated,
                ClusterContestId      = form.ClusterContestId,
                RegisterPlaceOfExamId = form.RegisterPlaceOfExamId,
                Maths                 = form.Maths,
                Literature            = form.Literature,
                Languages             = form.Languages,
                NaturalSciences       = form.NaturalSciences,
                SocialSciences        = form.SocialSciences,
                Physics               = form.Physics,
                Chemistry             = form.Chemistry,
                Biology               = form.Biology,
                History               = form.History,
                Geography             = form.Geography,
                CivicEducation        = form.CivicEducation,

                ExceptLanguages       = form.ExceptLanguages,
                Mark                  = form.Mark,
                ReserveMaths          = form.ReserveMaths,
                ReserveLiterature     = form.ReserveLiterature,
                ReserveLanguages      = form.ReserveLanguages,
                ReservePhysics        = form.ReservePhysics,
                ReserveChemistry      = form.ReserveChemistry,
                ReserveBiology        = form.ReserveBiology,
                ReserveHistory        = form.ReserveHistory,
                ReserveGeography      = form.ReserveGeography,
                ReserveCivicEducation = form.ReserveCivicEducation,

                PriorityType = form.PriorityType,
                Area         = form.Area,
                Status       = form.Status,
                StudentId    = CurrentContext.StudentId,
            };

            tFContext.Form.Add(formDAO);
            if (form.Aspirations.Any())
            {
                await BulkCreateAspirations(form);
            }
            //else
            //{
            //    form.Aspirations = new List<Aspiration>()
            //}
            await tFContext.SaveChangesAsync();

            return(true);
        }
コード例 #13
0
        public ActionResult FieldCopy(long id)
        {
            FieldModel field = FieldDAO.GetItem(id);

            field.ID = WorkLib.GetItem.NewSN();

            FieldDAO.SetItem(field);

            FormModel form = FormDAO.GetItem(field.ParentID);

            ViewBag.UploadDesignUrl = Golbal.UpdFileInfo.GetVPathBySiteID((long)form.SiteID, formDesignFileDir).TrimEnd('/');

            return(View("FieldDesignView", new FieldModel[] { field }));
        }
コード例 #14
0
        public async Task <Student> Get(Guid Id)
        {
            Student student = await tFContext.Student.Where(s => s.Id.Equals(Id)).Select(s => new Student
            {
                Id             = s.Id,
                Address        = s.Address,
                Dob            = s.Dob,
                Email          = s.Email,
                Gender         = s.Gender,
                EthnicId       = s.EthnicId,
                EthnicCode     = s.Ethnic.Code,
                EthnicName     = s.Ethnic.Name,
                HighSchoolId   = s.HighSchoolId,
                HighSchoolCode = s.HighSchool.Code,
                HighSchoolName = s.HighSchool.Name,
                Name           = s.Name,
                Phone          = s.Phone,
                PlaceOfBirth   = s.PlaceOfBirth,
                TownId         = s.TownId,
                TownCode       = s.Town.Code,
                TownName       = s.Town.Name,
                DistrictId     = s.Town.DistrictId,
                DistrictCode   = s.Town.District.Code,
                DistrictName   = s.Town.District.Name,
                ProvinceId     = s.Town.District.ProvinceId,
                ProvinceCode   = s.Town.District.Province.Code,
                ProvinceName   = s.Town.District.Province.Name,
                Identify       = s.Identify,
                Image          = s.Image,
                Biology        = s.Biology,
                Chemistry      = s.Chemistry,
                CivicEducation = s.CivicEducation,
                Geography      = s.Geography,
                History        = s.History,
                Languages      = s.Languages,
                Literature     = s.Literature,
                Maths          = s.Maths,
                Physics        = s.Physics,
                Status         = s.Status
            }).FirstOrDefaultAsync();

            FormDAO formDAO = tFContext.Form.Where(f => f.StudentId == Id).FirstOrDefault();

            if (formDAO != null && formDAO.Graduated.HasValue)
            {
                student.Graduated = formDAO.Graduated.Value;
            }

            return(student);
        }
コード例 #15
0
        public ActionResult Edit(long siteId, long menuId, FormModel item, string fields, string admins)
        {
            if (!string.IsNullOrWhiteSpace(item.Image))
            {
                ResourceImagesModels imgModel = JsonConvert.DeserializeObject <ResourceImagesModels>(item.Image);
                if (imgModel.ID == 0)   // 新上傳的圖片
                {
                    HttpPostedFileBase postedFile = Request.Files["fImage"];
                    if (postedFile == null || postedFile.ContentLength == 0)
                    {
                        item.Image = string.Empty;
                    }
                    else
                    {
                        item.Image = Golbal.UpdFileInfo.SaveFilesBySiteID(postedFile, siteId, formDesignFileDir);
                    }
                }
                else
                {
                    item.Image = imgModel.Img;
                }
            }

            item.SourceID = menuId;
            item.SiteID   = siteId;
            FormDAO.SetItem(item);

            FieldDesignItem[] fieldList = null;
            if (!string.IsNullOrWhiteSpace(fields))
            {
                fieldList = JsonConvert.DeserializeObject <FieldDesignItem[]>(fields);
            }
            item.SetFields(fieldList);

            FormAdmin[] adminList = null;
            if (!string.IsNullOrWhiteSpace(admins))
            {
                adminList = JsonConvert.DeserializeObject <FormAdmin[]>(admins);
            }
            item.SetAdmins(adminList);

            ViewBag.UploadUrl    = Golbal.UpdFileInfo.GetVPathBySiteID(siteId, formDesignFileDir).TrimEnd('/');
            ViewBag.SiteID       = siteId;
            ViewBag.MenuID       = menuId;
            ViewBag.SitePage     = FormDAO.GetFormPage(item.ID);
            ViewBag.Int64Convert = new WorkV3.Golbal.Int64Converter();
            ViewBag.Exit         = true;
            return(View(item));
        }
コード例 #16
0
        public ActionResult List(long siteId, long menuId, int?index, FormItemSearch search)
        {
            FormModel form = FormDAO.GetItemFromSourceID(menuId);

            if (Request.HttpMethod == "GET")
            {
                if (index == null)
                {
                    Utility.ClearSearchValue();
                }
                else
                {
                    FormItemSearch prevSearch = Utility.GetSearchValue <FormItemSearch>();
                    if (prevSearch != null)
                    {
                        search = prevSearch;
                    }
                }
            }
            else if (Request.HttpMethod == "POST")
            {
                Utility.SetSearchValue(search);
            }
            search.FormID = form.ID;

            ViewBag.Search = search;

            Pagination pagination = new Pagination {
                PageIndex = index ?? 1,
                PageSize  = 20
            };

            int totalRecord;
            IEnumerable <FormItem> items = FormItemDAO.GetItems(search, pagination.PageSize, pagination.PageIndex, out totalRecord);

            pagination.TotalRecord = totalRecord;
            ViewBag.Pagination     = pagination;

            ViewBag.Form   = form;
            ViewBag.Fields = FieldDAO.GetItems(search.FormID).Where(f => f.ShowInList).ToList();

            ViewBag.SiteID    = siteId;
            ViewBag.MenuID    = menuId;
            ViewBag.UploadUrl = Golbal.UpdFileInfo.GetVPathByMenuID(siteId, menuId).TrimEnd('/') + "/";

            return(View(items));
        }
コード例 #17
0
ファイル: FormSetController.cs プロジェクト: jim-deng-git/Ask
        public ActionResult Setting(long SiteID, long MenuID, long CardNo)
        {
            ViewBag.SiteID = SiteID;
            ViewBag.MenuID = MenuID;
            ViewBag.CardNo = CardNo;

            var query = new Query();

            query.Where.Add(new QWhere("SiteID", COperator.Equal, SiteID));
            query.Where.Add(new QWhere("Title", COperator.NoEqual, " "));
            var Model = FormDAO.Instance.Get(query);

            var formSet = FormDAO.getFormSet(CardNo);

            ViewBag.FormSet = formSet;
            return(View(Model));
        }
コード例 #18
0
        public FileResult ImportTmpl(long siteId, long menuId, long formId, bool?isEvent)
        {
            ViewData["Fields"] = FieldDAO.GetItems(formId);

            string html = Utility.GetViewHtml(this, "ImportTmpl", null);

            FormModel form  = FormDAO.GetItem(formId);
            string    title = form.Title;

            title = $"{ title }-匯入名單範本.xls";

            ViewBag.SiteID  = siteId;
            ViewBag.MenuID  = menuId;
            ViewBag.FormID  = formId;
            ViewBag.IsEvent = isEvent ?? false;
            return(File(System.Text.Encoding.UTF8.GetBytes(html), "application/vnd.ms-excel", title));
        }
コード例 #19
0
        public async Task <bool> Create(Student student)
        {
            StudentDAO studentDAO = new StudentDAO
            {
                Id             = student.Id,
                Address        = student.Address,
                Dob            = student.Dob,
                Email          = student.Email,
                Gender         = student.Gender,
                EthnicId       = student.EthnicId,
                HighSchoolId   = student.HighSchoolId,
                Name           = student.Name,
                Phone          = student.Phone,
                PlaceOfBirth   = student.PlaceOfBirth,
                TownId         = student.TownId,
                Identify       = student.Identify,
                Image          = student.Image,
                Biology        = student.Biology,
                Chemistry      = student.Chemistry,
                CivicEducation = student.CivicEducation,
                Geography      = student.Geography,
                History        = student.History,
                Languages      = student.Languages,
                Literature     = student.Literature,
                Maths          = student.Maths,
                Physics        = student.Physics,
                Status         = 0
            };

            tFContext.Student.Add(studentDAO);
            await tFContext.SaveChangesAsync();

            FormDAO FormDAO = new FormDAO
            {
                Id                    = Guid.NewGuid(),
                StudentId             = student.Id,
                Status                = 0,
                ClusterContestId      = tFContext.Province.Where(x => x.Name == student.PlaceOfBirth).Select(x => x.Id).FirstOrDefault(),
                RegisterPlaceOfExamId = student.HighSchoolId.Value
            };

            tFContext.Form.Add(FormDAO);
            await tFContext.SaveChangesAsync();

            return(true);
        }
コード例 #20
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            var formDTO = FormDAO.LoadForm(RequestFormType, RequestId);

            foreach (var field in formDTO.GetType().GetProperties())
            {
                var label = field.GetCustomAttribute <NLNameAttribute>();
                if (label != null)
                {
                    var formField = LoadControl("FormField.ascx") as FormField;
                    formField.Label    = label.NLName + (label.Mandatory ? "*" : "");
                    formField.TextMode = TextBoxMode.SingleLine;
                    formField.Text     = field.GetValue(formDTO)?.ToString();
                    form.Controls.Add(formField);
                }
            }
        }
コード例 #21
0
        public async Task <bool> Create(Form form)
        {
            FormDAO formDAO = new FormDAO
            {
                Id                      = form.Id,
                NumberForm              = form.NumberForm,
                DepartmentCode          = form.DepartmentCode,
                Date                    = form.Date,
                PersonalInfomartionId   = form.PersonalInfomationId,
                RegisterInformationId   = form.RegisterInformationId,
                GraduationInformationId = form.GraduationInformationId,
                UniversityAdmissionId   = form.UniversityAdmissionId
            };

            tFContext.Form.Add(formDAO);
            await tFContext.SaveChangesAsync();

            return(true);
        }
コード例 #22
0
        public FileResult FormItemExport(long id, bool?privacy, bool?isEvent = false)
        {
            FormItemSearch search = Utility.GetSearchValue <FormItemSearch>();

            if (search == null)
            {
                search = new FormItemSearch();
            }
            search.FormID         = id;
            ViewData["FormItems"] = FormItemDAO.GetItems(search);

            FormModel form = FormDAO.GetItem(id);

            ViewData["Fields"]  = form.GetFields();
            ViewData["Privacy"] = privacy ?? false;
            ViewData["IsEvent"] = isEvent ?? false;

            string html = Utility.GetViewHtml(this, "FormItemExport", null);

            string title = $"{ form.Title }-填寫.xls";

            return(File(System.Text.Encoding.UTF8.GetBytes(html), "application/vnd.ms-excel", title));
        }
コード例 #23
0
        public ActionResult Edit(long siteId, long menuId)
        {
            FormModel item = FormDAO.GetItemFromSourceID(menuId);

            if (item == null)
            {
                item = new FormModel {
                    ID = WorkLib.GetItem.NewSN(), SiteID = siteId, ForceStatement = true, SourceID = menuId
                };
                FormDAO.SetItem(item);

                FieldDAO.SetItem(new FieldModel {
                    ID     = WorkLib.GetItem.NewSN(), ParentID = item.ID, SN = 1, DefaultType = (int)FieldDefaultType.姓名,
                    TypeID = "input", Title = "姓名", Width = (int)FieldWidth.Quarter, Requied = true, ShowInList = true
                });
                FieldDAO.SetItem(new FieldModel {
                    ID    = WorkLib.GetItem.NewSN(), ParentID = item.ID, SN = 2, DefaultType = (int)FieldDefaultType.性別, TypeID = "radio",
                    Width = (int)FieldWidth.Quarter, OptionArray = true, Options = "先生;女士", Requied = true
                });
                FieldDAO.SetItem(new FieldModel {
                    ID     = WorkLib.GetItem.NewSN(), ParentID = item.ID, SN = 3, DefaultType = (int)FieldDefaultType.Email,
                    TypeID = "input", Title = "Email", Width = (int)FieldWidth.Half, Requied = true, Fomat = true, FomatType = (int)FieldInputFormat.Email, ShowInList = true
                });
                FieldDAO.SetItem(new FieldModel {
                    ID     = WorkLib.GetItem.NewSN(), ParentID = item.ID, SN = 4, DefaultType = (int)FieldDefaultType.電話,
                    TypeID = "input", Title = "手機", Width = (int)FieldWidth.Half, Requied = true, Fomat = true, FomatType = (int)FieldInputFormat.台灣手機號, ShowInList = true
                });
            }

            ViewBag.UploadUrl    = Golbal.UpdFileInfo.GetVPathBySiteID(siteId, formDesignFileDir).TrimEnd('/');
            ViewBag.SiteID       = siteId;
            ViewBag.MenuID       = menuId;
            ViewBag.SitePage     = FormDAO.GetFormPage(item.ID);
            ViewBag.Int64Convert = new WorkV3.Golbal.Int64Converter();
            return(View(item));
        }
コード例 #24
0
        public ActionResult FieldSetting(long formId, FieldModel item, byte?oldRepeatLimit)
        {
            item.ParentID = formId;

            FormModel form = FormDAO.GetItem(formId);

            if (!string.IsNullOrWhiteSpace(item.Template))
            {
                ResourceFilesModels fileModel = JsonConvert.DeserializeObject <ResourceFilesModels>(item.Template);
                if (fileModel.Id == 0)   // 新上傳的檔案
                {
                    HttpPostedFileBase postedFile = Request.Files["fTemplate"];
                    if (postedFile == null || postedFile.ContentLength == 0)
                    {
                        item.Template = string.Empty;
                    }
                    else
                    {
                        item.Template = Golbal.UpdFileInfo.SaveFilesBySiteID(postedFile, (long)form.SiteID, formDesignFileDir);
                    }
                }
                else
                {
                    item.Template = fileModel.FileInfo;
                }
            }

            if (!string.IsNullOrWhiteSpace(item.Image))
            {
                ResourceImagesModels imgModel = JsonConvert.DeserializeObject <ResourceImagesModels>(item.Image);
                if (imgModel.ID == 0)   // 新上傳的圖片
                {
                    HttpPostedFileBase postedFile = Request.Files["fImage"];
                    if (postedFile == null || postedFile.ContentLength == 0)
                    {
                        item.Image = string.Empty;
                    }
                    else
                    {
                        item.Image = Golbal.UpdFileInfo.SaveFilesBySiteID(postedFile, (long)form.SiteID, formDesignFileDir);
                    }
                }
                else
                {
                    item.Image = imgModel.Img;
                }
            }

            if (!string.IsNullOrWhiteSpace(item.VideoCustomPhoto))
            {
                ResourceImagesModels imgModel = JsonConvert.DeserializeObject <ResourceImagesModels>(item.VideoCustomPhoto);
                if (imgModel.ID == 0)
                { // 新上傳的圖片
                    HttpPostedFileBase postedFile = Request.Files["youtubeCustomImg"];
                    if (postedFile == null || postedFile.ContentLength == 0)
                    {
                        item.VideoCustomPhoto = string.Empty;
                    }
                    else
                    {
                        item.VideoCustomPhoto = Golbal.UpdFileInfo.SaveFilesBySiteID(postedFile, (long)form.SiteID, formDesignFileDir);
                    }
                }
                else
                {
                    item.VideoCustomPhoto = imgModel.Img;
                }
            }

            FieldDAO.SetItem(item);

            ViewBag.UploadUrl    = Golbal.UpdFileInfo.GetVPathBySiteID((long)form.SiteID, formDesignFileDir).TrimEnd('/');
            ViewBag.SiteID       = form.SiteID;
            ViewBag.MenuID       = form.SourceID;
            ViewBag.FormID       = formId;
            ViewBag.CustomFolder = formDesignFileDir;
            ViewBag.Exit         = true;
            if (item.TypeID == "input" && oldRepeatLimit == (byte)FieldRepeatLimit.可任意報名 && item.RepeatLimit != (byte)FieldRepeatLimit.可任意報名)
            {
                ViewBag.IsFirst = true;
            }

            return(View($"Field{ item.TypeID }", item));
        }
コード例 #25
0
 public void LoadTemplate(long siteId, long menuId, long formId, long templateId)
 {
     FormDAO.CreateFromTemplate(menuId, formId, templateId);
 }
コード例 #26
0
ファイル: FormSetController.cs プロジェクト: jim-deng-git/Ask
 public ActionResult Setting(long SiteID, long MenuID, long CardNo, long FormID)
 {
     FormDAO.SvaeFormSetting(FormID, CardNo);
     return(RedirectToAction("List", "Intro", new { SiteID = SiteID, MenuID = MenuID }));
 }
コード例 #27
0
 public IEnumerable <FormAdmin> GetAdmins()
 {
     return(FormDAO.GetItemAdmins(ID));
 }
コード例 #28
0
 public void SaveTemplate(long id, string name)
 {
     FormDAO.SaveTemplate(id, name);
 }