Пример #1
0
 private void AssignDataObjectToEntity(tbl_Categories dbCategory, ref Category entCategory)
 {
     entCategory.IdCategory = dbCategory.IdCategory;
     entCategory.Name = dbCategory.Name;
     entCategory.Description = dbCategory.Description;
     entCategory.AssignedTo = new UserInfo()
     {
         IdUser = dbCategory.tbl_Users.IdUser,
         UserCompleteName = dbCategory.tbl_Users.FirstName + ' ' + dbCategory.tbl_Users.LastName,
         CreatedOn = dbCategory.tbl_Users.CreatedOn,
         Email = dbCategory.tbl_Users.Email,
         FirstName = dbCategory.tbl_Users.FirstName,
         LastName = dbCategory.tbl_Users.LastName,
         HashCode = dbCategory.tbl_Users.HashCode,
         ModifiedOn = dbCategory.tbl_Users.ModifiedOn,
         Password = dbCategory.tbl_Users.Password,
         UserName = dbCategory.tbl_Users.UserName,
         Company = new Company()
         {
             IdCompany = dbCategory.tbl_Users.tbl_Companies.IdCompany,
             Name = dbCategory.tbl_Users.tbl_Companies.Name,
             Description = dbCategory.tbl_Users.tbl_Companies.Description,
             EntStatus = new Status() { IdStatus = dbCategory.tbl_Users.tbl_Companies.tbl_Status.IdStatus, Name = dbCategory.tbl_Users.tbl_Companies.tbl_Status.Name }
         },
         EntRole = new RoleInfo()
         {
             IdRole = dbCategory.tbl_Users.tbl_Roles.IdRole,
             Description = dbCategory.tbl_Users.tbl_Roles.Description,
             Name = dbCategory.tbl_Users.tbl_Roles.Name,
             RoleCode = dbCategory.tbl_Users.tbl_Roles.RoleCode,
             EntStatus = new Status()
             {
                 IdStatus = dbCategory.tbl_Users.tbl_Roles.tbl_Status.IdStatus,
                 Name = dbCategory.tbl_Users.tbl_Roles.tbl_Status.Name
             }
         },
         EntStatus = new Status() { IdStatus = dbCategory.tbl_Users.tbl_Status.IdStatus, Name = dbCategory.tbl_Users.tbl_Status.Name }
     };
     entCategory.AlternativeMail = dbCategory.AlternativeMail;
     entCategory.EntStatus = new Status() { IdStatus = dbCategory.tbl_Status.IdStatus,Name=dbCategory.tbl_Status.Name};
     entCategory.DefaultMail = entCategory.AssignedTo.Email;
 }
Пример #2
0
 partial void Deletetbl_Categories(tbl_Categories instance);
Пример #3
0
 partial void Updatetbl_Categories(tbl_Categories instance);
Пример #4
0
 partial void Inserttbl_Categories(tbl_Categories instance);
Пример #5
0
		private void detach_tbl_Categories(tbl_Categories entity)
		{
			this.SendPropertyChanging();
			entity.tbl_Users = null;
		}
Пример #6
0
		private void attach_tbl_Categories(tbl_Categories entity)
		{
			this.SendPropertyChanging();
			entity.tbl_Status = this;
		}
Пример #7
0
        //MySQLConnector mscConnector;
        //CategoryQueries cqQuery;
        //UtilsService Utilities;
        //private void InitializeControllers()
        //{
        //    mscConnector = new MySQLConnector();
        //    cqQuery = new CategoryQueries();
        //    Utilities = new UtilsService();
        //}
        private bool Insert(Category entCategory)
        {
            TCRepositoryDataContext context = DataBaseUtils.GetContext();
            try
            {
                tbl_Categories dbCategory = new tbl_Categories()
                {
                    Name = entCategory.Name,
                    Description = entCategory.Description,
                    AlternativeMail = entCategory.AlternativeMail,
                    IdUserAssigned = entCategory.AssignedTo.IdUser,
                    IdStatus = entCategory.EntStatus.IdStatus
                };
                context.tbl_Categories.InsertOnSubmit(dbCategory);
                context.SubmitChanges();
                return true;
            }
            catch
            {}

            return false;
        }