public override void InitPrototype(IGlobal global)
        {
            ((JsFunction)Prototype).Scope = global.ObjectClass.Scope;
            Prototype.DefineOwnProperty("constructor", this, PropertyAttributes.DontEnum);

            Prototype.DefineOwnProperty(CALL.ToString(), new JsCallFunction(this), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty(APPLY.ToString(), new JsApplyFunction(this), PropertyAttributes.DontEnum);

            Prototype.DefineOwnProperty("toString", New <JsDictionaryObject>(ToString2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLocaleString", New <JsDictionaryObject>(ToString2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("length", new PropertyDescriptor <JsObject>(global, Prototype, "length", GetLengthImpl, SetLengthImpl));
        }
Exemplo n.º 2
0
        public override void InitPrototype(IGlobal global)
        {
            var Prototype = PrototypeProperty;

            // ((JsFunction)Prototype).Scope = global.ObjectClass.Scope;

            Prototype.DefineOwnProperty("constructor", this, PropertyAttributes.DontEnum);

            Prototype.DefineOwnProperty(CALL.ToString(), new JsCallFunction(this), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty(APPLY.ToString(), new JsApplyFunction(this), PropertyAttributes.DontEnum);

            Prototype.DefineOwnProperty("toString", New <JsDictionaryObject>(ToString2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLocaleString", New <JsDictionaryObject>(ToString2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty(new PropertyDescriptor <JsObject>(global, Prototype, "length", GetLengthImpl, SetLengthImpl));

            if (global.HasOption(Options.Ecmascript5))
            {
                Prototype.DefineOwnProperty("bind", global.FunctionClass.New <JsObject>(Bind, 1), PropertyAttributes.DontEnum);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 儲存報名資料
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ApplyDataModel SaveApply(ApplyDataModel model)
        {
            int            identityId = 0;
            ApplyDataModel result     = new ApplyDataModel();

            using (var transction = DB.Database.CurrentTransaction ?? DB.Database.BeginTransaction())
            {
                APPLY apply = new APPLY()
                {
                    MAP_ACT_GUP_ID = model.ApplyGroupID,
                    TEAM_COACH     = model.Coach,
                    CONTACT        = model.Contact,
                    CONTACT_PHONE  = model.ContactPhone,
                    EMAIL          = model.Email,
                    REMRK          = model.Remark,
                    TEAM_NM        = model.TeamName,
                    MAP_ACT_ID     = model.ActivityID,
                    BUD_DT         = DateTime.UtcNow.AddHours(8),
                    UPD_DT         = DateTime.UtcNow.AddHours(8),
                    APPLY_SUCCESS  = false
                };

                try
                {
                    DB.APPLY.Add(apply);
                    DB.SaveChanges();
                    identityId = apply.ID;
                    transction.Commit();
                }
                catch (Exception ex)
                {
                    transction.Rollback();
                    throw ex;
                }
            }

            using (var transaction = DB.Database.CurrentTransaction ?? DB.Database.BeginTransaction(System.Data.IsolationLevel.Serializable))
            {
                var aply = DB.APPLY.Where(o => o.ID == identityId).FirstOrDefault();
                aply.APPLY_IDEN_NUM       = CreateApplyNumberByActivityID(model.ActivityID, identityId, DB);
                this.DB.Entry(aply).State = EntityState.Modified;
                try
                {
                    DB.SaveChanges();
                    transaction.Commit();
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw ex;
                }
            };

            if (model.Member.Count > 0)
            {
                using (var transaction = DB.Database.CurrentTransaction ?? DB.Database.BeginTransaction())
                {
                    List <APPLY_MEMBER> memberList = new List <APPLY_MEMBER>();
                    foreach (var member in model.Member)
                    {
                        APPLY_MEMBER temp = new APPLY_MEMBER()
                        {
                            MEMBER_IDEN_ID = member.MemberIdentityID,
                            MEMBER_BIRDT   = member.MemberBirthday,
                            MERBER_NM      = member.MemberName,
                            MERBER_TP      = member.MemberType,
                            BUD_DT         = DateTime.UtcNow.AddHours(8),
                            UPD_DT         = DateTime.UtcNow.AddHours(8),
                            MAP_APPLY_ID   = identityId,
                            REF_ACT_ID     = model.ActivityID
                        };
                        memberList.Add(temp);
                    }
                    ;
                    try
                    {
                        DB.APPLY_MEMBER.AddRange(memberList);

                        DB.SaveChanges();
                        transaction.Commit();
                    }
                    catch (Exception ex)
                    {
                        transaction.Rollback();
                        throw ex;
                    }
                }
            }

            result = GetApplyDetailsByID(identityId, model.ActivityID);
            return(result);
        }