| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- using System.Collections.Generic;
- namespace ContractService.Views.Shared.Modals
- {
- public class ModalViewModel
- {
- public ModalViewModel()
- {
- IsCenter = true;
- ModalId = "modal";
- }
- public ModalViewModel(string header, string modalId = "modal", int footer = 0, string sizeClass = "lg", int? width = null) : this()
- {
- Header = new ModalHeaderViewModel(header);
- Footer = footer + "";
- ModalId = modalId;
- Width = width;
- SizeClass = sizeClass;
- }
- public ModalViewModel(string header1, string header2, string modalId = "modal", int footer = 0, string sizeClass = "lg", int? width = null) : this()
- {
- Header = new ModalHeaderViewModel(header1, header2);
- Footer = footer + "";
- ModalId = modalId;
- Width = width;
- SizeClass = sizeClass;
- IsCenter = true;
- }
- public ModalViewModel(string header, ModalBodyViewModel body, string modalId = "modal", string footer = "0", string sizeClass = "lg", int? width = null) : this()
- {
- Header = new ModalHeaderViewModel(header);
- Body = body;
- Body.ModalId = modalId;
- Footer = footer;
- ModalId = modalId;
- Width = width;
- SizeClass = sizeClass;
- IsCenter = true;
- }
- public ModalViewModel(string header1, string header2, ModalBodyViewModel body, string modalId = "modal", int footer = 0, string sizeClass = "lg", int? width = null) : this()
- {
- Header = new ModalHeaderViewModel(header1, header2);
- Body = body;
- if (body != null)
- {
- Body.ModalId = modalId;
- }
- Footer = footer + "";
- ModalId = modalId;
- Width = width;
- SizeClass = sizeClass;
- }
- public ModalViewModel(ModalHeaderViewModel header, ModalBodyViewModel body, string modalId = "modal", int footer = 0, string sizeClass = "lg", int? width = null) : this()
- {
- Header = header;
- Body = body;
- Body.ModalId = modalId;
- Footer = footer + "";
- ModalId = modalId;
- Width = width;
- SizeClass = sizeClass;
- }
- public ModalHeaderViewModel Header { get; set; }
- public ModalBodyViewModel Body { get; set; }
- public string Footer { get; set; }
- public string ModalId { get; set; }
- public int? Width { get; set; }
- public string SizeClass { get; set; }
- public bool IsCenter { get; set; }
- public ModalViewModel SetModalId(string id)
- {
- ModalId = id;
- return this;
- }
- public ModalViewModel SetHeader(string header1, string header2 = null)
- {
- Header = new ModalHeaderViewModel(header1, header2);
- return this;
- }
- public ModalViewModel SetHeader(ModalHeaderViewModel header)
- {
- Header = header;
- return this;
- }
- public ModalViewModel SetBody(ModalBodyViewModel body)
- {
- Body = body;
- return this;
- }
- public ModalViewModel SetInputs(List<Input> inputs, string formId = "form")
- {
- Body = new ModalBodyViewModel(inputs, formId, ModalId);
- return this;
- }
- public ModalViewModel SetSpecials(List<SpecialInputModel> inputs)
- {
- if (Body != null)
- {
- Body.Specials = inputs;
- }
- return this;
- }
- public ModalViewModel SetFooter(string footer)
- {
- Footer = footer;
- return this;
- }
- public ModalViewModel SetFooter(int footer)
- {
- Footer = footer + "";
- return this;
- }
- public ModalViewModel SetSize(string sizeClass)
- {
- SizeClass = sizeClass;
- return this;
- }
- public ModalViewModel SetSize(int width)
- {
- Width = width;
- return this;
- }
- /// <summary>
- ///取消垂直居中 (默认垂直居中)
- /// </summary>
- /// <returns></returns>
- public ModalViewModel SetNotCenter()
- {
- IsCenter = false;
- return this;
- }
- }
- }
|