Exemple #1
0
        public void AddData(ModelNotifiedForTagEmployee modelNotifiedForTagEmployee, out string error)
        {
            TagEmployeeBsn  bsn    = new TagEmployeeBsn(wpfConfig);
            TagEmployeeInfo dbItem = new TagEmployeeInfo();

            Cloner.CopyAllTo(typeof(ModelNotifiedForTagEmployee), modelNotifiedForTagEmployee, typeof(TagEmployeeInfo), dbItem);
            bsn.InsertOne(dbItem, out error);
            modelNotifiedForTagEmployee.NewItem = false;
            Cloner.CopyAllTo(typeof(TagEmployeeInfo), dbItem, typeof(ModelNotifiedForTagEmployee), modelNotifiedForTagEmployee);
        }
Exemple #2
0
        public void TryInclude(CreateTagEmployeeView viewToInclude, out RestExceptionError error)
        {
            error = null;
            TagEmployeeInfo dbViewToInclude = new TagEmployeeInfo();

            try
            {
                Cloner.CopyAllTo(typeof(CreateTagEmployeeView), viewToInclude, typeof(TagEmployeeInfo), dbViewToInclude);
            }
            catch (Exception ex)
            {
                error = new RestExceptionError();
                error.InternalMessage  = "Internal Error parsing data for (TagEmployee.TryInclude/Parsing)";
                error.ExceptionMessage = ex.Message;
                error.SourceError      = RestExceptionError._SourceError.ServerSide;
                error.StackTrace       = ex.StackTrace;
            }

            try
            {
                TagEmployeeBsn bsn     = new TagEmployeeBsn(restConfig);
                string         dbError = null;
                bsn.InsertOne(dbViewToInclude, out dbError);
                if (dbError != null)
                {
                    error = new RestExceptionError();
                    error.InternalMessage  = "Internal Error Save data for [TagEmployee.TryInclude/Save]";
                    error.ExceptionMessage = dbError;
                    error.SourceError      = RestExceptionError._SourceError.ServerSide;
                    error.StackTrace       = "";
                }
            }
            catch (Exception ex)
            {
                error = new RestExceptionError();
                error.InternalMessage  = "Internal Error Save data for [TagEmployee.TryInclude/Save]";
                error.ExceptionMessage = ex.Message;
                error.SourceError      = RestExceptionError._SourceError.ServerSide;
                error.StackTrace       = ex.StackTrace;
            }
        }