Example #1
0
        public void SaveData(ModelNotifiedForEmployees modelNotifiedForEmployees, out string error)
        {
            EmployeesBsn  bsn    = new EmployeesBsn(wpfConfig);
            EmployeesInfo dbItem = new EmployeesInfo();

            Cloner.CopyAllTo(typeof(ModelNotifiedForEmployees), modelNotifiedForEmployees, typeof(EmployeesInfo), dbItem);

            //Saving NxN data fro: EmployeeTerritories
            SaveNxNComboFor_EmployeeTerritories(modelNotifiedForEmployees, out error);

            bsn.UpdateOne(dbItem, out error);
        }
Example #2
0
        public void TryUpdate(UpdateEmployeesView viewToUpdate, out RestExceptionError error)
        {
            error = null;
            EmployeesInfo dbViewToInclude = new EmployeesInfo();

            try
            {
                Cloner.CopyAllTo(typeof(UpdateEmployeesView), viewToUpdate, typeof(EmployeesInfo), dbViewToInclude);
            }
            catch (Exception ex)
            {
                error = new RestExceptionError();
                error.InternalMessage  = "Internal Error parsing data for (Employees.TryUpdate/Parsing)";
                error.ExceptionMessage = ex.Message;
                error.SourceError      = RestExceptionError._SourceError.ServerSide;
                error.StackTrace       = ex.StackTrace;
            }

            try
            {
                EmployeesBsn bsn     = new EmployeesBsn(restConfig);
                string       dbError = null;
                bsn.UpdateOne(dbViewToInclude, out dbError);
                if (dbError != null)
                {
                    error = new RestExceptionError();
                    error.InternalMessage  = "Internal Error Save data for [Employees.TryUpdate]";
                    error.ExceptionMessage = dbError;
                    error.SourceError      = RestExceptionError._SourceError.ServerSide;
                    error.StackTrace       = "";
                }
            }
            catch (Exception ex)
            {
                error = new RestExceptionError();
                error.InternalMessage  = "Internal Error Update data for [Employees.TryUpdate]";
                error.ExceptionMessage = ex.Message;
                error.SourceError      = RestExceptionError._SourceError.ServerSide;
                error.StackTrace       = ex.StackTrace;
            }
        }