Exemple #1
0
 private void SaveAllNew()
 {
     if (AllowAdd)
     {
         IsLoading = true;
         Client.UpdateOrInsertRFSCompleted += (s, e) =>
         {
             try
             {
                 if (e.Error == null)
                 {
                     MessageBox.Show("Document Number is: [ " + e.Result.DocNumber + " ]", strings.Save, MessageBoxButton.OK);
                     DocNum = e.Result.DocNumber;
                     ResetViewModel(ObjectMode.StandBy);
                 }
                 else
                 {
                     //MessageBox.Show(strings.FailSavingMessage, strings.Save, MessageBoxButton.OK);
                     throw e.Error;
                 }
             }
             finally
             {
                 IsLoading = false;
             }
         };
         Client.UpdateOrInsertRFSAsync(RFSMVM_Mapper.MapToModel(this, true));
     }
     else
     {
         MessageBox.Show("You do not have the permission to add a new item!");
     }
 }
Exemple #2
0
        private void PostPOheaderToax()
        {
            if (!ObjStatus.IsSavedDBItem)
            {
                MessageBox.Show("You cannot POST this before saving!");
                return;
            }
            var param = RFSMVM_Mapper.MapToModel(this);

            Client.PostNewPoToAxAsync(param);
        }
Exemple #3
0
        private void InitializeServiceEvents()
        {
            Client.GetRFSCompleted += (s, e) =>
            {
                try
                {
                    if (e.Error != null)
                    {
                        return;
                    }
                    RFQGlobalLkps.ColorsList = new ObservableCollection <TblColor>(e.colorsList);
                    //RFQGlobalLkps.StatisSizesCollection = new ObservableCollection<_proxy.SizesWithGroups>();
                    if (e.Result != null)
                    {
                        RFSMVM_Mapper.MapToViewModel(e.Result, this);
                        IsCodeExists    = false;
                        IsSearchingMode = false;
                        foreach (var item in RFQHeaderList)
                        {
                            item.ObjStatus.IsSavedDBItem = true;
                            item.ObjStatus.IsNew         = false;
                        }
                        IsLoaded = true;
                    }
                    else if (e.Result == null)
                    {
                        MessageBox.Show("Document number does not exist");
                    }
                }
                finally
                {
                    IsLoading = false;
                }
            };

            Client.GetTblColorLinkCompleted += (s, e) =>
            {
                if (e.Result == null || e.Error != null)
                {
                    return;
                }
                RFQGlobalLkps.ColorsList = new ObservableCollection <TblColor>();
                RFQGlobalLkps.ColorsList.Clear();
                foreach (var item in e.Result)
                {
                    RFQGlobalLkps.ColorsList.Add(item.TblColor1);
                }
            };

            Client.GetStyleSizesFromRetailCompleted += (s, e) =>
            {
                if (e.Error != null && e.Result == null)
                {
                    return;
                }
                //var res = e.Result;

                RFQGlobalLkps.StatisSizesCollection.Clear();
                foreach (var siz in e.Result)
                {
                    RFQGlobalLkps.StatisSizesCollection.Add(siz);
                }
            };

            Client.UpdateOrInsertRFSDetailServicesCompleted += (s, e) =>
            {
                try
                {
                    if (e.Error == null)
                    {
                        //MessageBox.Show("Document Number is: [ " + e.Result + " ]", strings.Save, MessageBoxButton.OK);
                        // DocNum = e.Result;
                        ResetViewModel(ObjectMode.StandBy);
                    }
                    else
                    {
                        //MessageBox.Show(strings.FailSavingMessage, strings.Save, MessageBoxButton.OK);
                        throw e.Error;
                    }
                }
                finally
                {
                    IsLoading = false;
                }
            };
        }
Exemple #4
0
        private void Update()
        {
            if (AllowUpdate)
            {
                IsLoading = true;
                var addedSubHeaderList     = new ObservableCollection <TblRFSDetail>();
                var addedSubHeaderItems    = new ObservableCollection <TblRFSDetailItem>();
                var addedSubHeaderServices = new ObservableCollection <TblRFSDetailService>();

                var updatedSubHeaderList     = new ObservableCollection <TblRFSDetail>();
                var updatedSubHeaderItems    = new ObservableCollection <TblRFSDetailItem>();
                var updatedSubHeaderServices = new ObservableCollection <TblRFSDetailService>();

                var deletedSubHeaderList     = new ObservableCollection <TblRFSDetail>();
                var deletedSubHeaderItems    = new ObservableCollection <TblRFSDetailItem>();
                var deletedSubHeaderServices = new ObservableCollection <TblRFSDetailService>();

                foreach (var item in RFQHeaderDeletedList)
                {
                    deletedSubHeaderList.Add(RFSMVM_Mapper.MapToModel(item));
                }

                foreach (var item in RFQHeaderList)
                {
                    if (item.ObjStatus.IsNew)
                    {
                        addedSubHeaderList.Add(RFSMVM_Mapper.MapToModel(item));
                    }
                    else if (item.ObjStatus.IsSavedDBItem)
                    {
                        updatedSubHeaderList.Add(RFSMVM_Mapper.MapToModel(item));
                    }

                    foreach (var itms in item.HeaderItems)
                    {
                        if (itms.ObjStatus.IsNew)
                        {
                            addedSubHeaderItems.Add(RFSMVM_Mapper.MapToModel(itms));
                        }
                        else if (item.ObjStatus.IsSavedDBItem)
                        {
                            updatedSubHeaderItems.Add(RFSMVM_Mapper.MapToModel(itms));
                        }
                    }

                    foreach (var itms in item.HeaderItemsDeletedList)
                    {
                        deletedSubHeaderItems.Add(RFSMVM_Mapper.MapToModel(itms));
                    }

                    foreach (var srvs in item.HeaderServices)
                    {
                        if (srvs.ObjStatus.IsNew)
                        {
                            addedSubHeaderServices.Add(RFSMVM_Mapper.MapToModel(srvs));
                        }
                        else if (item.ObjStatus.IsSavedDBItem)
                        {
                            updatedSubHeaderServices.Add(RFSMVM_Mapper.MapToModel(srvs));
                        }
                    }

                    foreach (var srvs in item.HeaderServicesDeletedList)
                    {
                        deletedSubHeaderServices.Add(RFSMVM_Mapper.MapToModel(srvs));
                    }
                }

                try
                {
                    /////////////////////////////////////////////////////////////////////////////////
                    /////////////////////////////////////////////////////////////////////////////////
                    //Client.UpdateRFQAsync(RFQMVM_Mapper.MapToModel(this, true));
                    Client.UpdateOrInsertRFSDetailAsync(updatedSubHeaderList, addedSubHeaderList, deletedSubHeaderList);
                    Client.UpdateOrInsertRFSDetailItemsAsync(updatedSubHeaderItems, addedSubHeaderItems, deletedSubHeaderItems);
                    Client.UpdateOrInsertRFSDetailServicesAsync(updatedSubHeaderServices, addedSubHeaderServices, deletedSubHeaderServices);
                    /////////////////////////////////////////////////////////////////////////////////
                    /////////////////////////////////////////////////////////////////////////////////
                }
                catch (Exception)
                {
                    MessageBox.Show(strings.FailSavingMessage, strings.Save, MessageBoxButton.OK);
                }
            }
            else
            {
                MessageBox.Show("You do not have the update permission");
            }
        }