示例#1
0
        private void SaveNxNComboFor_EmployeeTerritories(ModelNotifiedForEmployees modelNotifiedForEmployees, out string error)
        {
            error = null;
            EmployeeTerritoriesBsn bsn = new EmployeeTerritoriesBsn(wpfConfig);

            foreach (ModelNotifiedForTerritories item in modelNotifiedForEmployees.LookDownComboDataTerritories)
            {
                if (item.ItemChanged)
                {
                    item.ItemChanged = false;
                    EmployeeTerritoriesInfo itemToAddOrDelete = new EmployeeTerritoriesInfo();
                    //Setting NxN object to include/delete
                    itemToAddOrDelete.EmployeeID  = modelNotifiedForEmployees.EmployeeID;
                    itemToAddOrDelete.TerritoryID = item.TerritoryID;

                    if (item.Check_Status)
                    {
                        bsn.InsertOne(itemToAddOrDelete, out error);
                    }
                    else
                    {
                        bsn.Delete(itemToAddOrDelete, out error);
                    }
                }
            }
        }
示例#2
0
        public void AddData(ModelNotifiedForEmployeeTerritories modelNotifiedForEmployeeTerritories, out string error)
        {
            EmployeeTerritoriesBsn  bsn    = new EmployeeTerritoriesBsn(wpfConfig);
            EmployeeTerritoriesInfo dbItem = new EmployeeTerritoriesInfo();

            Cloner.CopyAllTo(typeof(ModelNotifiedForEmployeeTerritories), modelNotifiedForEmployeeTerritories, typeof(EmployeeTerritoriesInfo), dbItem);
            bsn.InsertOne(dbItem, out error);
            modelNotifiedForEmployeeTerritories.NewItem = false;
            Cloner.CopyAllTo(typeof(EmployeeTerritoriesInfo), dbItem, typeof(ModelNotifiedForEmployeeTerritories), modelNotifiedForEmployeeTerritories);
        }
示例#3
0
        public void TryInclude(CreateEmployeeTerritoriesView viewToInclude, out RestExceptionError error)
        {
            error = null;
            EmployeeTerritoriesInfo dbViewToInclude = new EmployeeTerritoriesInfo();

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

            try
            {
                EmployeeTerritoriesBsn bsn = new EmployeeTerritoriesBsn(restConfig);
                string dbError             = null;
                bsn.InsertOne(dbViewToInclude, out dbError);
                if (dbError != null)
                {
                    error = new RestExceptionError();
                    error.InternalMessage  = "Internal Error Save data for [EmployeeTerritories.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 [EmployeeTerritories.TryInclude/Save]";
                error.ExceptionMessage = ex.Message;
                error.SourceError      = RestExceptionError._SourceError.ServerSide;
                error.StackTrace       = ex.StackTrace;
            }
        }