Beispiel #1
0
 /// <summary>
 /// 編輯
 /// </summary>
 /// <returns></returns>
 public ActionResult ConstructorList(ConstructorParameter param)
 {
     param.KeyWord = HttpUtility.UrlDecode(param.KeyWord);
     return(View(
                new InternalDataTransferToView
     {
         List = ConstructorProvider.List(param),
         Data = param
     }));
 }
        ConstructorInfo exec <T>()
        {
            Type @class = typeof(T);
            ServiceFlagsGenerator flagsGenerator =
                new ServiceFlagsGenerator(new ServiceFlagsProvider(new AttributesFinder(), new MemberGenerator(new MemberFlagsGenerator())), new ServiceFlagsIssuesResolver());

            ServiceFlags flags = flagsGenerator.GenerateFlags(@class);

            ConstructorProvider provider = new ConstructorProvider(new ConstructorChecker(), new DefaultConstructorProvider(), new ConstructorGenerator(new ParametersGenerator(new ParameterGenerator())));

            return(provider.ProvideConstructor(@class).Instance);
        }
Beispiel #3
0
        public ActionResult ConstructorEdit(ConstructorParameter param)

        {
            if ((0L < param.Entity.Id))
            {
                param.Entity = ConstructorProvider.GetRecordById(param);
            }
            //取承包商的承包工程類別清單
            param.Entity.ConsDetailType = ConstructorProvider.GetConstructorConType(param.Entity.Id);

            return(View(new InternalDataTransferToView
            {
                List = ConstructorProvider.GetAllConType(), //取工程類別總清單
                //ConstructorProvider.GetDetail(param),
                Data = param
            }));
        }
Beispiel #4
0
        public ActionResult AjaxConstructorDelete(ConstructorParameter param)
        {
            var result = new JsonNetResult();
            var r      = new GeneralResponse();

            try
            {
                r.Code = ConstructorProvider.Delete(param).ToString(Section.Get.Common.Culture);
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message, ex);
                r.Code = "-11";
            }
            result.Data = r;
            return(result);
        }
        /// <inheritdoc />
        public object GetOptions()
        {
            var provider = OptionsProvider ?? ConstructorProvider <TOptions> .CreateOrThrow();

            object options;

            try
            {
                options = provider.GetInstance();
            }
            catch (Exception ex)
            {
                throw ConfigurationExceptions.OptionsProviderFailed(typeof(TOptions), ex);
            }

            return(options ?? throw ConfigurationExceptions.OptionsProviderReturnedNull(typeof(TOptions)));
        }
Beispiel #6
0
        public ActionResult AjaxConstructorEdit(ConstructorParameter param)
        {
            var result = new JsonNetResult();
            var r      = new GeneralResponse();

            try
            {
                r.Code = (0L < param.Entity.Id
                    ? ConstructorProvider.Update(param)
                    : ConstructorProvider.Create(param)).ToString(Section.Get.Common.Culture);
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message, ex);
                r.Code = "-11" + ex.Message;
            }
            result.Data = r;
            return(result);
        }
Beispiel #7
0
        public ActionResult ContractEdit(ContractParameter param)
        {
            if ((0L < param.Entity.Id))
            {
                param.Entity = ContractProvider.GetRecordById(param);
                param.Entity.ConsDetailType = ConstructorProvider.GetConstructorConType(param.Entity.ConstructorId);
            }
            else
            {
                param.Entity.ConsDetailType = ConstructorProvider.GetAllConType();
            }
            param.Entity.ContractDetail = ContractProvider.GetContractDetail(param.Entity.Id); //取明細表

            return(View(new InternalDataTransferToView
            {
                //List = ConstructorProvider.GetConstructionTypeList(), //取工程類別總清單
                //ContractProvider.GetDetail(param),
                Data = param
            }));
        }
Beispiel #8
0
 /// <summary>
 /// Uses the default constructor provider for the options type.
 /// </summary>
 /// <returns>Configuration.</returns>
 /// <exception cref="Exception">No default constructor exists.</exception>
 public CommandConfiguration <TOptions> UseDefault() => Sink(ConstructorProvider <TOptions> .CreateOrThrow());
Beispiel #9
0
 public void ProviderCreatesInstance()
 {
     ConstructorProvider <SomeType> .CreateOrThrow().GetInstance().ShouldBeOfType <SomeType>();
 }
Beispiel #10
0
 public void CreateOrThrowReturnsInstance()
 {
     ConstructorProvider <SomeType> .CreateOrThrow().ShouldNotBeNull();
 }
Beispiel #11
0
 public void ThrowsForNoDefaultConstructor()
 {
     Should.Throw <ConfigurationException>(() => ConstructorProvider <Parameterized> .CreateOrThrow());
 }
Beispiel #12
0
 /// <summary>
 /// Factory Method that creates an instance of type T
 /// </summary>
 /// <typeparam name="T">The type to create an instance of</typeparam>
 /// <returns>An instance of type T</returns>
 public static T CreateInstance <T>()
 {
     return((T)ConstructorProvider <T> .EmptyConstructorFunction());
 }