Esempio n. 1
0
        override public DEntity ToDEntity()
        {
            DEntity entity = base.ToDEntity();

            entity.name = this.user;
            return(entity);
        }
Esempio n. 2
0
        internal IFacadeUpdateResult <DEntityData> SaveDEntity(DEntityDto dto)
        {
            ArgumentValidator.IsNotNull("dto", dto);

            FacadeUpdateResult <DEntityData> result = new FacadeUpdateResult <DEntityData>();
            IDEntityService service  = UnitOfWork.GetService <IDEntityService>();
            DEntity         instance = RetrieveOrNew <DEntityData, DEntity, IDEntityService>(result.ValidationResult, dto.Id);

            if (result.IsSuccessful)
            {
                instance.Code            = dto.Code;
                instance.Description     = dto.Description;
                instance.EntityTypeId    = dto.EntityTypeId;
                instance.AllowAddItem    = dto.AllowAddItem;
                instance.AllowDeleteItem = dto.AllowDeleteItem;
                instance.AllowEditItem   = dto.AllowEditItem;

                var saveQuery = service.Save(instance);

                result.AttachResult(instance.RetrieveData <DEntityData>());
                result.Merge(saveQuery);
            }

            return(result);
        }
Esempio n. 3
0
        internal IFacadeUpdateResult <DEntityData> DeleteDEntityItem(object parentId, object childId)
        {
            ArgumentValidator.IsNotNull("parentId", parentId);
            ArgumentValidator.IsNotNull("childId", childId);

            FacadeUpdateResult <DEntityData> result = new FacadeUpdateResult <DEntityData>();
            IDEntityService service = UnitOfWork.GetService <IDEntityService>();
            var             query   = service.Retrieve(parentId);

            if (query.HasResult)
            {
                DEntity     parent = query.ToBo <DEntity>();
                DEntityItem child  = parent.DEntityItems.SingleOrDefault(o => object.Equals(o.Id, childId));
                if (child != null)
                {
                    parent.DEntityItems.Remove(child);
                    var saveQuery = parent.Save();
                    result.Merge(saveQuery);
                    result.AttachResult(parent.RetrieveData <DEntityData>());
                }
                else
                {
                    AddError(result.ValidationResult, "DEntityItemCannotBeFound");
                }
            }
            else
            {
                AddError(result.ValidationResult, "DEntityCannotBeFound");
            }

            return(result);
        }
Esempio n. 4
0
        internal IFacadeUpdateResult <DEntityData> SaveDEntityItem(object parentId, DEntityItemDto childDto)
        {
            ArgumentValidator.IsNotNull("parentId", parentId);
            ArgumentValidator.IsNotNull("childDto", childDto);

            FacadeUpdateResult <DEntityData> result = new FacadeUpdateResult <DEntityData>();
            IDEntityService service     = UnitOfWork.GetService <IDEntityService>();
            var             parentQuery = service.Retrieve(parentId);

            if (parentQuery.HasResult)
            {
                DEntity     parent = parentQuery.ToBo <DEntity>();
                DEntityItem child  = RetrieveOrNewDEntityItem(parent, childDto.Id);
                if (child != null)
                {
                    child.Text  = childDto.Text;
                    child.Value = childDto.Value;

                    var saveQuery = service.Save(parent);
                    result.Merge(saveQuery);
                    result.AttachResult(parent.RetrieveData <DEntityData>());
                }
                else
                {
                    AddError(result.ValidationResult, "DEntityItemCannotBeFound");
                }
            }

            return(result);
        }
Esempio n. 5
0
        public ActionResult GetAllFunction()
        {
            DEntity <Function> e = new DEntity <Function>(ConstValue.ConnectionString, Function.getTableName());

            e.setPrimaryKey("id");
            return(Json(e.getAll()));
        }
Esempio n. 6
0
        public ActionResult GetListMember(int id)
        {
            DEntity <Member> e = new DEntity <Member>(ConstValue.ConnectionString, Member.getTableName());

            e.setPrimaryKey("id");
            return(Json(e.getList("group_id", id)));
        }
Esempio n. 7
0
        internal void Create(EMap m)
        {
            // Name ve Root bilgileri Before üzerinden yükleniyor.
            // Güncelleme bu bilgiler Instruction kısmı için düzenleniyor.
            // Kullandığımız entity'in Name ve Root bilgileri alınmalı.

            DEntity d = new DEntity();
            Envoy   e = new Envoy();

            d.TargetLocation = m.ExternalLocation;

            d = e.Before(new EMap(), d);
            e.CreateIfNotThere(d);
            UpdateList(d.TargetLocation);

            if (!IsThereAny(m.Entity))
            {
                if (l.Count > 0)
                {
                    m.Id = l[l.Count - 1].Id + 1;
                }
                else
                {
                    m.Id = 1;
                }

                DataAccess.Insert insert = new DataAccess.Insert
                                               (m, d);
            }
        }
Esempio n. 8
0
        public Change(XEntity entity, DEntity _)
        {
            if (_.Continuity)
            {
                XDocument xdoc;

                using (StreamReader oreader = new StreamReader(_.MainLocation, Encoding.UTF8))
                {
                    xdoc = XDocument.Load(oreader);
                }

                XElement rootelement = xdoc.Root; entity.GetType().GetProperty(_.Key).GetValue(entity).ToString();

                foreach (XElement item1 in rootelement.Elements())
                {
                    if (item1.Attribute("id").Value == entity.GetType().GetProperty(_.Key).GetValue(entity).ToString())
                    {
                        foreach (var item2 in entity.GetType().GetProperties())
                        {
                            if (item2.Name == _.Key)
                            {
                                continue;
                            }
                            item1.Element(item2.Name).Value = item2.GetValue(entity).ToString();
                        }
                        break;
                    }
                }
                xdoc.Save(_.MainLocation);
            }
        }
Esempio n. 9
0
        public IActionResult DetailAccount(int id)
        {
            DEntity <AccountDetail> e   = new DEntity <AccountDetail>(ConstValue.ConnectionString, AccountDetail.getTableName());
            AccountDetail           lst = e.get("iduser", id);

            return(View(lst));
        }
Esempio n. 10
0
        internal void Add(string ExternalLocation, string categoryName)
        {
            DEntity d = new DEntity();

            d.TargetLocation = ExternalLocation;
            d = e.Before(new ECategory(), d);
            e.CreateIfNotThere(d);
            UpdateList(ExternalLocation);

            if (!IsThereAny(categoryName))
            {
                ECategory c = new ECategory();
                c.Name = categoryName;
                if (s.Count > 0)
                {
                    c.Id = s[s.Count - 1].Id + 1;
                }
                else
                {
                    c.Id = 1;
                }
                DataAccess.Insert insert = new DataAccess.Insert
                                               (c, d);
            }
        }
Esempio n. 11
0
        public override DEntity ToDEntity()
        {
            DEntity dEntity = base.ToDEntity();

            dEntity.active = !dead;
            return(dEntity);
        }
Esempio n. 12
0
        internal void CreateIfNotThere(DEntity d)
        {
            string path;

            if (String.IsNullOrWhiteSpace(d.TargetLocation))
            {
                path = d.CategorizeName;
            }
            else
            {
                path = d.TargetLocation + @"\" + d.CategorizeName;
            }

            if (d.IsCategorized == true)
            {
                Directory.CreateDirectory(path);
            }

            if (!File.Exists(d.MainLocation))
            {
                XmlTextWriter writer = new XmlTextWriter(d.MainLocation, System.Text.Encoding.UTF8);
                writer.WriteStartDocument(true);
                writer.Formatting  = Formatting.Indented;
                writer.Indentation = 2;
                writer.WriteStartElement(d.Root);

                writer.WriteEndElement();
                writer.WriteEndDocument();
                writer.Close();
            }

            Debug.WriteLine(d.MainLocation);
            Debug.WriteLineIf(true, d.Name);
        }
Esempio n. 13
0
        internal void Create(string ExternalLocation, Type t)
        {
            DEntity d = new DEntity();

            d.TargetLocation = ExternalLocation;
            //
            d = e.Before(new EStatus(), d);
            e.CreateIfNotThere(d);
            UpdateList(ExternalLocation);

            EStatus state = IsThereAny(t.Name);

            if (state is null)
            {
                EStatus status = new EStatus();
                status.Entity = t.Name;
                status.Recent = 0;
                if (s.Count > 0)
                {
                    status.Id = s[s.Count - 1].Id + 1;
                }
                else
                {
                    status.Id = 1;
                }

                DataAccess.Insert add = new DataAccess.Insert(status, d);
            }
        }
Esempio n. 14
0
        public ActionResult Index()
        {
            DEntity <Page> e   = new DEntity <Page>(ConstValue.ConnectionString, Page.getTableName());
            List <Page>    lst = e.getAll();

            return(View(lst));
        }
Esempio n. 15
0
        public DEntity ToDEntity()
        {
            DEntity entity = new DEntity();

            entity.name = name;

            entity.pos.x = transform.position.x;
            entity.pos.y = transform.position.y;
            entity.pos.z = transform.position.z;

            entity.rot.x = transform.rotation.x;
            entity.rot.y = transform.rotation.y;
            entity.rot.z = transform.rotation.z;
            entity.rot.w = transform.rotation.w;

            entity.forClone = canClone;
            Damageable damageable = GetComponent <Damageable>();

            if (damageable != null)
            {
                entity.currentHP = entity.maxHP = damageable.maxHitPoints;
                entity.invTime   = damageable.invulnerabiltyTime;
                entity.speed     = damageable.maxSpeed;
                entity.hitAngle  = damageable.hitAngle;
            }
            entity.type = (int)entityType;
            foreach (NetworkEntity child in children)
            {
                DEntity childEntity = child.ToDEntity();
                childEntity.parent = entity;
                entity.children.Add(childEntity);
            }
            return(entity);
        }
Esempio n. 16
0
        public void SendSpawn(DEntity entity)
        {
            SSpawn msg = new SSpawn();

            msg.entity = entity;
            msg.isMine = entity.entityID == entityId;
            connection.Send(msg);
        }
Esempio n. 17
0
        public ActionResult SubperAdminIndex()
        {
            //Session["fullname"] = HttpContext.Session["FullName"];
            DEntity <Group> e = new DEntity <Group>(ConstValue.ConnectionString, Group.getTableName());
            List <Group>    g = e.getAll();

            return(View(g));
        }
Esempio n. 18
0
        public ActionResult Index()
        {
            //Session["fullname"] = HttpContext.Session["FullName"];
            DEntity <Group> e = new DEntity <Group>(ConstValue.ConnectionString, Group.getTableName());
            List <Group>    g = e.getAll();

            g = g.Where(r => r.id != 1).ToList();
            return(View(g));
        }
Esempio n. 19
0
        internal void UpdateList(string ExternalLocation)
        {
            s.Clear();
            DEntity d = new DEntity();

            d.TargetLocation = ExternalLocation;
            d = e.Before(new ECategory(), d);
            s = e.DataToList <ECategory>(d);
        }
Esempio n. 20
0
        internal void UpdateList(string externalLocation)
        {
            s.Clear();
            DEntity d = new DEntity();

            d.TargetLocation = externalLocation;
            d = e.Before(new EStatus(), d);
            s = e.DataToList <EStatus>(d);
        }
Esempio n. 21
0
        private void UpdateList(string ExternalLocation)
        {
            l.Clear();
            DEntity d = new DEntity();
            Envoy   e = new Envoy();

            d.TargetLocation = ExternalLocation;
            d = e.Before(new EMap(), d);
            l = e.DataToList <EMap>(d);
        }
Esempio n. 22
0
        override public DEntity ToDEntity()
        {
            DEntity entity = base.ToDEntity();

            entity.currentHP = currentHP;
            entity.maxHP     = maxHP;
            entity.level     = level;
            entity.speed     = speed;

            return(entity);
        }
Esempio n. 23
0
 override public void FromDEntity(DEntity entity)
 {
     currentHP        = entity.currentHP;
     maxHP            = entity.maxHP;
     level            = entity.level;
     speed            = entity.speed;
     aggressive       = entity.aggressive;
     invulnerableTime = entity.invTime;
     hitAngle         = entity.hitAngle;
     base.FromDEntity(entity);
 }
Esempio n. 24
0
        public ActionResult Member(int id)
        {
            //Session["fullname"] = HttpContext.Session["FullName"];
            //ViewData["Account"] ="";// AccountRes.GetAll();
            ViewData["group_id"] = id;
            DEntity <Member> e = new DEntity <Member>(ConstValue.ConnectionString, API.Models.Member.getTableName());

            e.setPrimaryKey("id");
            List <Member> lst = e.getList("group_id", id);

            return(View(lst));
        }
Esempio n. 25
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            DEntity dd = new DEntity();

            dd.LoanFriends    = Utils.GetDoubleValue(LoanFriends.Value);
            dd.LoanSecurity   = Utils.GetDoubleValue(LoanSecurity.Value);
            dd.OtherLiability = Utils.GetStringValue(OtherLiability.Value);

            UserBL userBL = new UserBL();
            int    year   = Utils.GetIntValue(Request["Year"]);

            UserEntity user = Session[Constants.USERSESSIONVAR] as UserEntity;

            userBL.SaveFormD(dd, year, user.UserId);
        }
Esempio n. 26
0
        internal DEntityItem RetrieveOrNewDEntityItem(DEntity parent, object childId)
        {
            DEntityItem child = null;

            if (childId != null)
            {
                child = parent.DEntityItems.SingleOrDefault(o => object.Equals(o.Id, childId));
            }
            else
            {
                child = parent.DEntityItems.AddNewBo();
            }

            return(child);
        }
Esempio n. 27
0
        override public DEntity ToDEntity()
        {
            DEntity entity = base.ToDEntity();

            entity.currentHP    = currentHP;
            entity.maxHP        = maxHP;
            entity.level        = level;
            entity.speed        = speed;
            entity.attack       = attack;
            entity.defense      = defense;
            entity.intelligence = intelligence;
            entity.SilverNum    = SilverNum;
            entity.GoldNum      = GoldNum;
            return(entity);
        }
Esempio n. 28
0
        internal void Add(string externalLocation, Type t)
        {
            DEntity d = new DEntity();

            d.TargetLocation = externalLocation;

            d = e.Before(new EStatus(), d);

            UpdateList(externalLocation);

            EStatus s = IsThereAny(t.Name);

            s.Recent += 1;

            DataAccess.Change change = new DataAccess.Change(s, d);
        }
Esempio n. 29
0
 override public void FromDEntity(DEntity entity)
 {
     currentHP        = entity.currentHP;
     maxHP            = entity.maxHP;
     level            = entity.level;
     speed            = entity.speed;
     aggressive       = entity.aggressive;
     invulnerableTime = entity.invTime;
     hitAngle         = entity.hitAngle;
     attack           = entity.attack;
     defense          = entity.defense;
     intelligence     = entity.intelligence;
     GoldNum          = entity.GoldNum;
     SilverNum        = entity.SilverNum;
     base.FromDEntity(entity);
 }
Esempio n. 30
0
        public void SaveFormD(DEntity dd, int year, int userId)
        {
            DataSet           dsUsers  = new DataSet();
            SpParamCollection spParams = new SpParamCollection();

            sqlConn = new SqlConnection(m_connectionString);


            spParams.Add(new SpParam("@userID", userId));
            spParams.Add(new SpParam("@year", year));
            spParams.Add(new SpParam("@LoanFriends", dd.LoanFriends));
            spParams.Add(new SpParam("@LoanSecurity", dd.LoanSecurity));
            spParams.Add(new SpParam("@OtherLiabilities", dd.OtherLiability));



            DBHelper.ExecProcNonQuery("SaveFormD", spParams, sqlConn);
        }