コード例 #1
0
        public void SaveMainRow()
        {
            Loading = true;
            var saveTemp = (TblTradeAgreementTransaction) new TblTradeAgreementTransaction().InjectFrom(SelectedMainRow);

            saveTemp.TblTradeAgreementHeaders = new ObservableCollection <TblTradeAgreementHeader>();
            var details = SelectedMainRow.DetailsList.Where(d => d.TblVendorPurchaseGroup != null &&
                                                            d.ItemCode != null && d.CurrencyCode != null);

            foreach (var item in details.GroupBy(d => new { d.Vendor }))
            {
                var firstDetail          = item.FirstOrDefault();
                var TradeAgreementHeader = new TblTradeAgreementHeader()
                {
                    FromDate = SelectedMainRow.FromDate,
                    ToDate   = SelectedMainRow.ToDate,
                    Vendor   = item.Key.Vendor,
                    TblTradeAgreementTransaction = saveTemp.Iserial,
                };
                if (firstDetail != null)
                {
                    TradeAgreementHeader.Iserial = firstDetail.HeaderIserial;
                }

                TradeAgreementHeader.TblTradeAgreementDetails =
                    new ObservableCollection <TblTradeAgreementDetail>();
                GenericMapper.InjectFromObCollection(TradeAgreementHeader.TblTradeAgreementDetails,
                                                     details.Where(d => d.Vendor == item.Key.Vendor));

                saveTemp.TblTradeAgreementHeaders.Add(TradeAgreementHeader);
            }
            productionServiceClient.SaveTradeAgreementAsync(saveTemp);
        }
コード例 #2
0
        public void SaveMainRow()
        {
            if (SelectedMainRow != null)
            {
                var valiationCollection = new List <ValidationResult>();

                var isvalid = Validator.TryValidateObject(SelectedMainRow, new ValidationContext(SelectedMainRow, null, null), valiationCollection, true);

                if (SelectedMainRow.DetailsList.Sum(x => x.Percentage) != 100)
                {
                    isvalid = false;
                    MessageBox.Show("Total Percentage Should Be !00%");
                }

                if (isvalid)
                {
                    var saveRow = new TblPaymentSchedule();
                    var save    = SelectedMainRow.Iserial == 0;
                    saveRow.InjectFrom(SelectedMainRow);
                    saveRow.TblPaymentScheduleDetails = new ObservableCollection <TblPaymentScheduleDetail>();
                    GenericMapper.InjectFromObCollection(saveRow.TblPaymentScheduleDetails, SelectedMainRow.DetailsList);
                    Client.UpdateOrInsertTblPaymentScheduleAsync(saveRow, save, MainRowList.IndexOf(SelectedMainRow));
                }
            }
        }
コード例 #3
0
        public void SaveHeader()
        {
            var dyeingPlanlist = new ObservableCollection <TblDyeingPlanACC>();

            foreach (var item in HeaderViewModel.DyeingViewModelList)
            {
                var dyeingplanrow = new TblDyeingPlanACC();
                dyeingplanrow.InjectFrom(item);
                dyeingplanrow.TblDyeingPlanDetailsAccs = new ObservableCollection <TblDyeingPlanDetailsAcc>();
                GenericMapper.InjectFromObCollection(dyeingplanrow.TblDyeingPlanDetailsAccs, item.DetailsViewModel);
                dyeingPlanlist.Add(dyeingplanrow);
            }

            var summaryList = new ObservableCollection <TblDyeingSummaryAcc>();

            GenericMapper.InjectFromObCollection(summaryList, DyeingSummeryViewModelList);
            foreach (var row in DyeingSummeryViewModelList)
            {
                var sumRow =
                    FabricStorageList.Where(
                        x => x.CONFIGID == row.ColorName && x.INVENTSITEID == row.Size && x.itemid == row.FabricCode).Sum(w => w.QuantityPerMeter);
                row.Valid = row.CalculatedTotalQty <= (double)sumRow.Value;
            }

            if (DyeingSummeryViewModelList.Count(x => x.Valid) != 0)
            {
                _webService.SaveDyeingHeaderListAccAsync(new TblDyeingPlanHeaderAcc().InjectFrom(HeaderViewModel) as TblDyeingPlanHeaderAcc
                                                         , dyeingPlanlist, summaryList);
            }
            else
            {
                MessageBox.Show("Some Of The Quantities Doesn't Exists In the Warehouse");
            }
        }
コード例 #4
0
        internal static TblReservationMainDetailsViewModel MaptoViewModel(Tbl_ReservationMainDetails resRow, ObservableCollection <Fabric_UnitID> mainFabricList, ObservableCollection <GetItemOnhand_Result> onHandList)
        {
            var detailsList = new ObservableCollection <TblReservationDetailsViewModel>();

            foreach (var row in resRow.Tbl_ReservationDetails)
            {
                var newDetail = new TblReservationDetailsViewModel();
                GenericMapper.InjectFromObCollection(newDetail.ReservationListRec, row.Tbl_ReservationRec);
                newDetail.InjectFrom(row);
                detailsList.Add(newDetail);
            }

            double onhand = 0;

            try
            {
                onhand = Convert.ToDouble(onHandList.FirstOrDefault(w => w.FabricCode == resRow.Fabric && w.CONFIGID == resRow.FabricColor && w.TOBATCH == resRow.Batchno).Qty);
            }
            catch (Exception)
            {
                onhand = 0;
            }

            var newRow = new TblReservationMainDetailsViewModel();

            newRow.InjectFrom(resRow);
            newRow.ReservationDetailsViewModelList = detailsList;
            newRow.RemQtyTemp = newRow.Qty - newRow.ReservationDetailsViewModelList.Sum(x => x.IntialQty);
            newRow.RemQty     = newRow.RemQtyTemp;
            newRow.OnHandQty  = onhand;
            //  newRow.FabricName = mainFabricList.FirstOrDefault(x => x.Fabric_Code == newRow.Fabric).Fabric_Ename;
            return(newRow);
        }
コード例 #5
0
        private void DisplayPermtions(List <TblAuthPermission> result)
        {
            GenericMapper.InjectFromObCollection(TblAuthPermissionsList, result.Where(x => x.ParentPerm == 0));

            foreach (var tblAuthPermission in TblAuthPermissionsList)
            {
                //  GetImageListKey(tblAuthPermission, tblAuthPermission.PermissionTyp);
                FillMyChild(tblAuthPermission, result.Where(x => x.ParentPerm != 0).ToList());
            }
            Loading = false;
        }
コード例 #6
0
ファイル: ReservationViewModel.cs プロジェクト: Osama91/CCWFM
        internal void saveReservationForStyle()
        {
            if (SelectedMainDetails.Qty - SelectedMainDetails.ReservationDetailsViewModelList.Sum(w => w.IntialQty) >= 0)
            {
                ObservableCollection <Tbl_ReservationDetails> newlist = new ObservableCollection <Tbl_ReservationDetails>();

                GenericMapper.InjectFromObCollection(newlist, SelectedMainDetails.ReservationDetailsViewModelList);
                Client.SaveReservationDetailsAsync(newlist, LoggedUserInfo.Iserial);
            }
            else
            {
                MessageBox.Show("Qty Exceed Limit " + SelectedMainDetails.Qty + "");
            }
        }
コード例 #7
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            var viewModel = (ReservationViewModel)DataContext;

            if (viewModel.CheckFabricLineQty())
            {
                viewModel.SelectedMainDetails.RemQty = viewModel.SelectedMainDetails.RemQtyTemp;
                GenericMapper.InjectFromObCollection(viewModel.SelectedMainDetails.ReservationDetailsViewModelList, viewModel.SalesorderList);
                OkButton.IsEnabled = false;
                DialogResult       = true;
            }
            else
            {
                MessageBox.Show("Remaning Quanitity is Not enought");
            }
        }
コード例 #8
0
        private void FillMyChild(TblAuthPermissionViewModel tblAuthPermission, List <TblAuthPermission> result)
        {
            var query = (from x in result
                         where x.ParentPerm == tblAuthPermission.Iserial
                         select x).OrderBy(x => x.PermOrder).ToList();

            if (query.Count > 0)
            {
                GenericMapper.InjectFromObCollection(tblAuthPermission.SubPermissionsList, query);
                foreach (var authPermission in tblAuthPermission.SubPermissionsList)
                {
                    FillMyChild(new TblAuthPermissionViewModel().InjectFrom(authPermission) as TblAuthPermissionViewModel, result);
                }
            }

            GetImageListKey(tblAuthPermission, tblAuthPermission.PermissionTyp);

            // var a = TblAuthPermissionsList.Where(x=>x.SubPermissionsList.Where(s=>x.Ename.Contains("fabric Insp"));
        }
コード例 #9
0
        public static Tbl_ReservationMainDetails MaptoViewModel(TblReservationMainDetailsViewModel resRow)
        {
            var detailsList = new ObservableCollection <Tbl_ReservationDetails>();

            foreach (var row in resRow.ReservationDetailsViewModelList)
            {
                var newDetail = new Tbl_ReservationDetails();
                GenericMapper.InjectFromObCollection(newDetail.Tbl_ReservationRec, row.ReservationListRec);
                newDetail.InjectFrom(row);
                detailsList.Add(newDetail);
            }

            var newRow = new Tbl_ReservationMainDetails();

            newRow.InjectFrom(resRow);
            newRow.Tbl_ReservationDetails = detailsList;

            return(newRow);
        }
コード例 #10
0
ファイル: AttachmentViewModel.cs プロジェクト: Osama91/CCWFM
        internal void SaveAttachments()
        {
            var isvalid = false;

            foreach (var tblStyleAttachmentViewModel in MainRowList)
            {
                isvalid = Validator.TryValidateObject(tblStyleAttachmentViewModel, new ValidationContext(tblStyleAttachmentViewModel, null, null), null, true);

                if (!isvalid)
                {
                    return;
                }
            }
            if (isvalid)
            {
                var savelist = new ObservableCollection <TblAttachment>();
                GenericMapper.InjectFromObCollection(savelist, MainRowList);
                assistanceClient.UpdateOrInsertAttachmentAsync(savelist);
            }
        }
コード例 #11
0
        public static TblReservationMainDetailsViewModel MaptoViewModel(Tbl_ReservationMainDetails resRow, ObservableCollection <Fabric_UnitID> mainFabricList)
        {
            var detailsList = new ObservableCollection <TblReservationDetailsViewModel>();

            foreach (var row in resRow.Tbl_ReservationDetails)
            {
                var newDetail = new TblReservationDetailsViewModel();
                GenericMapper.InjectFromObCollection(newDetail.ReservationListRec, row.Tbl_ReservationRec);
                newDetail.InjectFrom(row);
                detailsList.Add(newDetail);
            }

            var newRow = new TblReservationMainDetailsViewModel();

            newRow.InjectFrom(resRow);
            newRow.ReservationDetailsViewModelList = detailsList;
            newRow.RemQtyTemp = newRow.Qty - newRow.ReservationDetailsViewModelList.Sum(x => x.IntialQty);
            newRow.RemQty     = newRow.RemQtyTemp;
            //  newRow.FabricName = mainFabricList.FirstOrDefault(x => x.Fabric_Code == newRow.Fabric).Fabric_Ename;
            return(newRow);
        }
コード例 #12
0
        internal void SaveAttachments()
        {
            FolderPath = "Uploads/Gl";
            var folderName = FolderPath;

            var counter = 0;

            foreach (var item in MainRowList)
            {
                if (item.Iserial == 0)
                {
                    item.AttachmentPath = folderName + "/" + HeaderRow.Code + counter + item.AttachmentPerRow.Extension;
                    item.FolderPath     = folderName;
                    item.UploadFile(item.AttachmentPerRow);
                    counter++;
                }
            }

            var isvalid = false;

            foreach (var glLedgerAttachmentViewModel in MainRowList)
            {
                isvalid = Validator.TryValidateObject(glLedgerAttachmentViewModel, new ValidationContext(glLedgerAttachmentViewModel, null, null), null, true);

                if (!isvalid)
                {
                    return;
                }
            }

            if (isvalid)
            {
                var savelist = new ObservableCollection <TblLedgerHeaderAttachment>();
                GenericMapper.InjectFromObCollection(savelist, MainRowList);

                Glclient.UpdateOrInsertTblLedgerHeaderAttachmentAsync(savelist);
            }
        }
コード例 #13
0
        public void SaveDetailRow()
        {
            foreach (var row in TransactionHeader.DetailsList.Where(x => x.Iserial != -1))
            {
                var  valiationCollection = new List <ValidationResult>();
                bool isvalid             = Validator.TryValidateObject(row,
                                                                       new ValidationContext(row, null, null), valiationCollection, true);
                var  valiationCollectionHeader = new List <ValidationResult>();
                bool isvalidHeader             = Validator.TryValidateObject(TransactionHeader,
                                                                             new ValidationContext(TransactionHeader, null, null), valiationCollectionHeader, true);
                TransactionHeader.TransactionType = TransactionType;
                if (
                    TransactionHeader.DetailsList.Count(
                        x =>
                        x.Brand == row.Brand &&
                        x.TblLkpBrandSection == row.TblLkpBrandSection &&
                        x.TblLkpSeason == row.TblLkpSeason &&
                        row.TblBudgetItem == x.TblBudgetItem) > 1)
                {
                    MessageBox.Show("Cannot Duplicate The Full Criteria");
                    row.BrandSectionPerRow = null;
                    row.SeasonPerRow       = null;
                    row.BudgetItemPerRow   = null;

                    isvalid = false;
                }

                if (isvalid && isvalidHeader)
                {
                    var data = new TblGlobalRetailBusinessBudgetMainDetail();
                    data.InjectFrom(row);
                    row.TblGlobalRetailBusinessBudget = TransactionHeader.Iserial;
                    if (row.TblGlobalRetailBusinessBudget == 0)
                    {
                        data.TblGlobalRetailBusinessBudget1 =
                            (TblGlobalRetailBusinessBudget)
                            new TblGlobalRetailBusinessBudget().InjectFrom(TransactionHeader);
                    }
                    data.TblGlobalRetailBusinessBudgetDetails = new ObservableCollection <TblGlobalRetailBusinessBudgetDetail>();

                    GenericMapper.InjectFromObCollection(data.TblGlobalRetailBusinessBudgetDetails,
                                                         row.DetailsList);

                    bool save = row.Iserial == 0;
                    if (save)
                    {
                        if (AllowAdd)
                        {
                            Loading = true;
                            Client.UpdateOrInsertTblGlobalRetailBusinessBudgetMainDetailAsync(data, true,
                                                                                              TransactionHeader.DetailsList.IndexOf(row), LoggedUserInfo.Iserial);
                        }

                        else
                        {
                            MessageBox.Show("You are Not Allowed to Add");
                        }
                    }
                    else
                    {
                        if (AllowUpdate)
                        {
                            Loading = true;
                            Client.UpdateOrInsertTblGlobalRetailBusinessBudgetMainDetailAsync(data, false,
                                                                                              TransactionHeader.DetailsList.IndexOf(row), LoggedUserInfo.Iserial);
                        }
                        else
                        {
                            MessageBox.Show("You are Not Allowed to Update");
                        }
                    }
                }
            }
        }
コード例 #14
0
        private void SaveAccessories()
        {
            var client    = new _Proxy.CRUD_ManagerServiceClient();
            var headerRow = new _Proxy.tbl_AccessoryAttributesHeader();

            headerRow.InjectFrom(SelectedMainRow);

            var detailsList = new ObservableCollection <_Proxy.tbl_AccessoryAttributesDetails>();

            GenericMapper.InjectFromObCollection(detailsList, AccDetailsList);


            var valiationCollection = new List <ValidationResult>();

            var isvalid = Validator.TryValidateObject(SelectedMainRow,
                                                      new ValidationContext(SelectedMainRow, null, null), valiationCollection, true);

            if (!isvalid)
            {
                MessageBox.Show("Data IS not Valid");
                return;
            }


            if (SelectedMainRow.ObjStatus.IsNew)
            {
                client.AddAllNewAccessoriesAttributesCompleted += (s, sv)
                                                                  =>
                {
                    MessageBox.Show(sv.Error == null ? strings.SavedMessage : strings.FailSavingMessage);
                    SelectedMainRow.InjectFrom(sv.Result);
                    SelectedMainRow.ObjStatus.IsNew         = false;
                    SelectedMainRow.ObjStatus.IsSavedDBItem = true;

                    AccDetailsList = new SortableCollectionView <AccessoryAttributesDetailsViewModel>();


                    foreach (var row in sv.Result.tbl_AccessoryAttributesDetails)
                    {
                        var newrow = new AccessoryAttributesDetailsViewModel
                        {
                            ObjStatus = { IsNew = false, IsSavedDBItem = true }
                        };
                        newrow.InjectFrom(row);
                        AccDetailsList.Add(newrow);
                    }
                };
                //  if (AllowAdd)
                //        {
                client
                .AddAllNewAccessoriesAttributesAsync
                    (headerRow
                    , detailsList, SelectedMainRow.IsSizeIncludedInHeader, LoggedUserInfo.Iserial);
                //       }
                //      else
                //   {
                //         MessageBox.Show("You do not have the permission to add a new item!");
                //    }
            }
            else if (SelectedMainRow.ObjStatus.IsSavedDBItem)
            {
                client.UpdateAccessoriesAttributesCompleted += (s, e) =>
                {
                    MessageBox.Show(e.Error == null ? strings.SavedMessage : strings.FailSavingMessage);
                    SelectedMainRow.InjectFrom(e.Result);
                    SelectedMainRow.ObjStatus.IsNew         = false;
                    SelectedMainRow.ObjStatus.IsSavedDBItem = true;

                    AccDetailsList = new SortableCollectionView <AccessoryAttributesDetailsViewModel>();

                    foreach (var row in e.Result.tbl_AccessoryAttributesDetails)
                    {
                        var newrow = new AccessoryAttributesDetailsViewModel
                        {
                            ObjStatus = { IsNew = false, IsSavedDBItem = true }
                        };
                        newrow.InjectFrom(row);
                        AccDetailsList.Add(newrow);
                    }
                }
                ;
                //     if (AllowUpdate)
                //     {
                var detailsNewList = new ObservableCollection <_Proxy.tbl_AccessoryAttributesDetails>();
                GenericMapper.InjectFromObCollection(detailsNewList, AccDetailsList.Where(x => x.ObjStatus.IsNew));

                var detailsUpdatedList = new ObservableCollection <_Proxy.tbl_AccessoryAttributesDetails>();
                GenericMapper.InjectFromObCollection(detailsUpdatedList, AccDetailsList.Where(x => x.ObjStatus.IsSavedDBItem));

                client
                .UpdateAccessoriesAttributesAsync
                    (headerRow,
                    detailsNewList,
                    detailsUpdatedList, LoggedUserInfo.Iserial);
                //   }
                //    else
                //    {
                //        MessageBox.Show("You do not have the update permission");
                //   }
            }
        }
コード例 #15
0
ファイル: ReservationViewModel.cs プロジェクト: Osama91/CCWFM
        internal void InitializeCompleted()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                Types = new ObservableCollection <Transactions>();
                if (LoggedUserInfo.CurrLang == 0)
                {
                    Types.Add(new Transactions {
                        TransactionId = 0, TransactionName = "أمر الشراء"
                    });
                    Types.Add(new Transactions {
                        TransactionId = 1, TransactionName = "صباغة"
                    });
                    Types.Add(new Transactions {
                        TransactionId = 2, TransactionName = "Transfer"
                    });
                }
                else
                {
                    Types.Add(new Transactions {
                        TransactionId = 0, TransactionName = "Purshase Order"
                    });
                    Types.Add(new Transactions {
                        TransactionId = 1, TransactionName = "Dyeing"
                    });
                    Types.Add(new Transactions {
                        TransactionId = 2, TransactionName = "Transfer"
                    });
                }
                Client = new CRUD_ManagerServiceClient();
                GetItemPermissions(PermissionItemName.Reservation.ToString());
                ObservableCollection <GetItemOnhand_Result> OnHandList = new ObservableCollection <GetItemOnhand_Result>();
                Client.GetReservationMainDetailByFabricCompleted += (s, f) =>
                {
                    if (f.OnHandList != null)
                    {
                        OnHandList = f.OnHandList;
                    }
                    TransactionHeader = new TblReservationHeaderViewModel();
                    foreach (var variable in f.Result)
                    {
                        TransactionHeader.TransactionMainDetails.Add(ReservationMappers.MaptoViewModel(variable, f.mainFabricList, OnHandList));
                    }
                    Loading = false;
                };
                Client.GetAllSeasonsCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        if (SeasonList.All(x => x.Iserial != row.Iserial))
                        {
                            SeasonList.Add(new TblLkpSeason().InjectFrom(row) as TblLkpSeason);
                        }
                    }
                };
                Client.GetAllSeasonsAsync();
                Client.GetAllBrandsCompleted += (s, sv) =>
                {
                    BrandsList.Clear();
                    foreach (var variable in sv.Result.OrderBy(x => x.Brand_Code))
                    {
                        BrandsList.Add(variable);
                    }
                };
                Client.GetAllBrandsAsync(0);
                TransactionGuid   = Guid.NewGuid().ToString();
                TransactionHeader = new TblReservationHeaderViewModel {
                    DocDate = DateTime.Now.Date
                };
                SelectedMainDetails = new TblReservationMainDetailsViewModel();

                Client.GetReservationHeaderListCompleted += (d, i) =>
                {
                    foreach (var item in i.Result)
                    {
                        TransactionHeaderList.Add(ReservationMappers.MaptoViewModel(item));
                    }
                };

                lkpClient.GetTblBrandSectionLinkCompleted += (x, sv) =>
                {
                    BrandSectionList.Clear();
                    foreach (var row in sv.Result)
                    {
                        BrandSectionList.Add(row.TblLkpBrandSection1);
                    }
                };
                SalesorderList = new ObservableCollection <CRUD_ManagerServiceSalesOrderDto>();

                SalesorderList.CollectionChanged += SalesorderList_CollectionChanged;

                Client.GetPurchaseOrderSalesOrdersCompleted += (d, s) =>
                {
                    foreach (var variable in s.Result)
                    {
                        if (!SalesorderList.Any(
                                x =>
                                x.SalesOrder.Contains(variable.SalesOrder) &&
                                x.SalesOrderColor.Contains(variable.SalesOrderColor)) && !SelectedMainDetails.ReservationDetailsViewModelList.Any(x => x.SalesOrder.Contains(variable.SalesOrder) &&
                                                                                                                                                  x.SalesOrderColor.Contains(variable.SalesOrderColor)))
                        {
                            SalesorderList.Add(variable);
                        }
                    }
                };

                Client.GetPurchaseOrderLinesCompleted += (s, f) =>
                {
                    foreach (var item in f.Result.Where(item => !OrderLineList.Contains(FabricInspectionMapper.MapToOrderLine(item))))
                    {
                        OrderLineList.Add(FabricInspectionMapper.MapToOrderLine(item));
                    }
                    Loading = false;
                };


                Client.GetRecivedDyedOrdersCompleted += (s, f) =>
                {
                    foreach (var item in f.Result.Where(item => !OrderLineList.Contains(FabricInspectionMapper.MapToOrderLine(item))))
                    {
                        OrderLineList.Add(FabricInspectionMapper.MapToOrderLine(item));
                    }
                };
                Client.GetTransferInventDimLinesCompleted += (s, f) =>
                {
                    foreach (var item in f.Result.Where(item => !OrderLineList.Contains(FabricInspectionMapper.MapToOrderLine(item))))
                    {
                        OrderLineList.Add(FabricInspectionMapper.MapToOrderLine(item));
                    }
                };
                Client.GetReservationMainDetailsCompleted += (s, f) =>
                {
                    foreach (var variable in f.Result)
                    {
                        if (variable.Inspected)
                        {
                            Client.GetResInspectionListAsync(variable.LineNum, TransactionHeader.TransOrder);
                        }
                        //f.mainFabricList;
                        TransactionHeader.TransactionMainDetails.Add(ReservationMappers.MaptoViewModel(variable, f.mainFabricList));
                    }
                };

                Client.SaveReservationCompleted += (a, f) =>
                {
                    if (f.ErrorExists)
                    {
                        var visList = TransactionHeader.TransactionMainDetails.Where(x => f.Result.All(s => s.Fabric == x.Fabric && s.FabricColor == x.FabricColor));

                        foreach (var item in TransactionHeader.TransactionMainDetails)
                        {
                            item.ErrorVisbility = visList.Contains(item) ? Visibility.Visible : Visibility.Collapsed;
                        }
                    }
                    else
                    {
                        var tblFabricInspectionDetail = f.Result.FirstOrDefault();
                        if (tblFabricInspectionDetail != null)
                        {
                            TransactionHeader.Iserial = tblFabricInspectionDetail.Tbl_ReservationHeader;
                        }
                        TransactionHeader.TransactionMainDetails.Clear();
                        foreach (var item in f.Result)
                        {
                            TransactionHeader.TransactionMainDetails.Add((TblReservationMainDetailsViewModel) new TblReservationMainDetailsViewModel().InjectFrom(item));
                        }
                        var currentUi = Thread.CurrentThread.CurrentUICulture;
                        if (currentUi.DisplayName == "العربية")
                        {
                            MessageBox.Show("Saved");
                        }
                        else
                        {
                            MessageBox.Show("Saved");
                        }
                    }
                };


                Client.GenerateReservationFromPlanCompleted += (s, sv) => Client.GetReservationMainDetailsAsync(TransactionHeader.Iserial);
                Client.GetSalesOrderReservationCompleted    += (s, sv) =>
                {
                    GenericMapper.InjectFromObCollection(SelectedMainDetails.ReservationDetailsViewModelList, sv.Result);
                    foreach (var item in (SelectedMainDetails.ReservationDetailsViewModelList))
                    {
                        item.Tbl_ReservationMainDetails = SelectedMainDetails.Iserial;
                    }
                };
                Client.ReservationLineNumCompleted += (s, p) =>
                {
                    var lines = new ObservableCollection <decimal>(p.Result);

                    if (TransactionHeader.TransactionMainDetails.Count() != 0)
                    {
                        foreach (var variable in TransactionHeader.TransactionMainDetails.Select(x => x.LineNum))
                        {
                            lines.Add(variable);
                        }
                    }
                    if (SortBy == null)
                    {
                        SortBy = "it.PURCHQTY";
                    }
                    if (TransactionHeader.TransactionType == 0)
                    {
                        Client.GetPurchaseOrderLinesAsync(OrderLineList.Count, PageSize, "ccm", TransactionHeader.TransOrder, lines, "it.PURCHQTY desc", Filter, ValuesObjects);
                    }
                    if (TransactionHeader.TransactionType == 1)
                    {
                        Client.GetRecivedDyedOrdersAsync(OrderLineList.Count, PageSize, TransactionHeader.TransOrder, lines, "it.PURCHQTY desc", Filter, ValuesObjects);
                    }
                    else if (TransactionHeader.TransactionType == 2)
                    {
                        Client.GetTransferInventDimLinesAsync(OrderLineList.Count, PageSize, "ccm", TransactionHeader.TransOrder, lines, "it.PURCHQTY desc", Filter, ValuesObjects);
                    }
                };
            }
        }
コード例 #16
0
ファイル: MarkerMapper.cs プロジェクト: Osama91/CCWFM
        public static MarkerListViewModel MapToMarkerDetail(tbl_MarkerDetail markerObject)
        {
            var markerMeterPersizes = new ObservableCollection <MeterPerSize>();

            foreach (var meterPerSize in markerObject.tbl_MarkerDetailMeterPerSize)
            {
                markerMeterPersizes.Add(MapToMeterPerSize(meterPerSize));
            }
            var styleColorlist = new ObservableCollection <MarkerSalesOrderDetail>
            {
                new MarkerSalesOrderDetail
                {
                    StyleColorCode    = markerObject.TblColor.Code,
                    StyleColorIserial = markerObject.TblColor.Iserial
                }
            };

            var fabricColorList = new ObservableCollection <MarkerSalesOrderDetail>
            {
                new MarkerSalesOrderDetail
                {
                    FabricColorCode    = markerObject.TblColor1.Code,
                    FabricColorIserial = markerObject.TblColor1.Iserial
                }
            };
            var listOfCutting = new ObservableCollection <CuttingOrderViewModel>();

            foreach (var variable in markerObject.Tbl_Wf_CuttingOrder)
            {
                var newrow = new CuttingOrderViewModel().InjectFrom(variable) as CuttingOrderViewModel;
                listOfCutting.Add(newrow);
            }
            double totalreq = 0;

            if (markerObject.TotalReq != null)
            {
                totalreq = (double)markerObject.TotalReq;
            }
            if (markerObject.Status == null)
            {
                markerObject.Status = 0;
            }
            var row = new MarkerListViewModel
            {
                Iserial                 = markerObject.Iserial,
                BatchNo                 = markerObject.BatchNo,
                StyleColorCode          = markerObject.StyleColorCode,
                FabricCode              = markerObject.FabricCode,
                FabricColorCode         = markerObject.FabricColorCode,
                FabricColorList         = fabricColorList,
                StyleDetailsList        = styleColorlist,
                MarkerL                 = markerObject.MarkerL,
                MarkerNo                = markerObject.MarkerNo,
                MarkerW                 = markerObject.MarkerW,
                SizeRange               = markerObject.SizeRange,
                StyleNo                 = markerObject.StyleNo,
                SalesOrder              = markerObject.SalesOrder,
                MarkerTransactionHeader = markerObject.MarkerTransactionHeader,
                CloretteCmPerPc         = markerObject.CloretteCmPerPc,
                Status = (int)markerObject.Status,
                SavedCuttingOrderlist = listOfCutting,
                TotalReq = totalreq
            };

            GenericMapper.InjectFromObCollection(row.MeterPerSizeList, markerMeterPersizes);

            return(row);
        }
コード例 #17
0
ファイル: PeriodGlViewModel.cs プロジェクト: Osama91/CCWFM
        public PeriodGlViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions(PermissionItemName.PeriodsGl.ToString());

                MainRowList     = new ObservableCollection <TblPeriodViewModel>();
                SelectedMainRow = new TblPeriodViewModel();

                Glclient.UpdateOrInsertCspPeriodLineCompleted += (s, sv) =>
                {
                    Loading = false;
                };

                Glclient.GetTblPeriodCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblPeriodViewModel();
                        newrow.InjectFrom(row);

                        if (row.TblAccount1 != null)
                        {
                            newrow.AccountPerRow = new TblAccount();
                            newrow.AccountPerRow = row.TblAccount1;
                        }

                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.UpdateOrInsertTblperiodCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }

                    MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                };
                Glclient.DeleteTblPeriodCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }

                    var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result);
                    if (oldrow != null)
                    {
                        MainRowList.Remove(oldrow);
                    }
                };

                Glclient.GetTblPeriodLineCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }

                    SelectedMainRow.TblPeriodLineList = new ObservableCollection <TblPeriodLineViewModel>();
                    GenericMapper.InjectFromObCollection(SelectedMainRow.TblPeriodLineList, ev.Result);

                    var childWindow = new PeriodLinesChildWindow(this);
                    childWindow.Show();
                };
                Glclient.ClosePeriodCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    var Period = MainRowList.FirstOrDefault(w => w.Iserial == ev.Result.Iserial);
                    Period.InjectFrom(ev.Result);
                    MessageBox.Show("Post Completed");
                    //SelectedMainRow.TblPeriodLineList = new ObservableCollection<TblPeriodLineViewModel>();
                    //GenericMapper.InjectFromObCollection(SelectedMainRow.TblPeriodLineList, ev.Result);
                };


                Glclient.ClosePeriodlineCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    var PeriodLine = SelectedMainRow.TblPeriodLineList.FirstOrDefault(w => w.Iserial == ev.Result.Iserial);
                    PeriodLine.InjectFrom(ev.Result);
                    MessageBox.Show("Post Completed");
                    //SelectedMainRow.TblPeriodLineList = new ObservableCollection<TblPeriodLineViewModel>();
                    //GenericMapper.InjectFromObCollection(SelectedMainRow.TblPeriodLineList, ev.Result);
                };

                GetMaindata();
            }
        }
コード例 #18
0
        public StyleAttachmentViewModel(TblStyleViewModel style)
        {
            Style           = style;
            MainRowList     = new SortableCollectionView <TblStyleAttachmentViewModel>();
            SelectedMainRow = new TblStyleAttachmentViewModel();

            Client.GetTblStyleAttachmentCompleted += (s, sv) =>
            {
                MainRowList.Clear();
                foreach (var row in sv.Result)
                {
                    var newrow = new TblStyleAttachmentViewModel();
                    newrow.InjectFrom(row);
                    MainRowList.Add(newrow);
                }
                Loading = false;
            };

            Client.MaxIserialOfStyleForAttachmentCompleted += (s, sv) =>
            {
                FolderPath = "Uploads" + "/" + sv.attachmentPath;
                var folderName = FolderPath + "/" + Style.SeasonPerRow.Ename + "_" + Style.Brand + "_" +
                                 Style.SectionPerRow.Ename;

                var counter = 0;
                foreach (var item in MainRowList)
                {
                    if (item.Iserial == 0)
                    {
                        var maxIserial = sv.Result;

                        item.AttachmentPath = folderName + "/" + style.StyleCode + maxIserial + counter + item.AttachmentPerRow.Extension;
                        item.FolderPath     = folderName;
                        item.UploadFile(item.AttachmentPerRow);

                        //using (FileStream fs = File.Create("binary.dat", 2048, FileOptions.None))
                        //{
                        //    BinaryFormatter formatter = new BinaryFormatter();
                        //    string s = "this is a test";
                        //    formatter.Serialize(fs, Encoding.Unicode.GetBytes(s));
                        //}

                        //using (var stream = File.Create(item.AttachmentPathThumbnail))
                        //{
                        //    stream.Write(buffer, 0, buffer.Length);
                        //    stream.Flush();
                        //    stream.Close();

                        //}
                        //var temp = new FileInfo(item.AttachmentPathThumbnail);
                        //item.UploadFile(temp);

                        counter++;
                    }
                }

                var isvalid = false;

                foreach (var tblStyleAttachmentViewModel in MainRowList)
                {
                    isvalid = Validator.TryValidateObject(tblStyleAttachmentViewModel, new ValidationContext(tblStyleAttachmentViewModel, null, null), null, true);

                    if (!isvalid)
                    {
                        return;
                    }
                }

                if (isvalid)
                {
                    var savelist = new ObservableCollection <TblStyleAttachment>();
                    GenericMapper.InjectFromObCollection(savelist, MainRowList);

                    Client.UpdateOrInsertTblStyleAttachmentAsync(savelist);
                }
            };
            Client.GetTblStyleAttachmentAsync(style.Iserial);
            Client.UpdateOrInsertTblStyleAttachmentCompleted += (s, x) => Client.GetTblStyleAttachmentAsync(style.Iserial);

            Client.DeleteTblStyleAttachmentCompleted += (s, ev) =>
            {
                if (ev.Error != null)
                {
                    throw ev.Error;
                }

                var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result);
                if (oldrow != null)
                {
                    MainRowList.Remove(oldrow);
                }
            };
        }
コード例 #19
0
        public SeasonalMasterListViewModel(StyleHeaderViewModel selectedStyle)
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                GetItemPermissions(PermissionItemName.SeasonalMasterListForm.ToString());
                SelectedStyleViewModel         = selectedStyle;
                MainRowList                    = new ObservableCollection <TblSeasonalMasterListViewModel>();
                SelectedMainRow                = new TblSeasonalMasterListViewModel();
                MainRowList.CollectionChanged += MainRowList_CollectionChanged;

                if (LoggedUserInfo.AllowedStores != null)
                {
                    Client.SearchBysStoreNameAsync(new ObservableCollection <int>(LoggedUserInfo.AllowedStores), LoggedUserInfo.Iserial, null, null, LoggedUserInfo.DatabasEname);
                }

                Client.SearchBysStoreNameCompleted += (s, sv) =>
                {
                    StoreList = sv.Result;
                };
                Client.GetSmlCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblSeasonalMasterListViewModel();

                        newrow.CanEditDeliveryDate = CanChangeDeliveryDate;

                        newrow.InjectFrom(row);
                        newrow.StylePerRow = row.TblStyle1;
                        newrow.ThemePerRow =
                            SelectedStyleViewModel.ThemesList.SingleOrDefault(
                                x => x.Iserial == row.TblSalesOrderColorTheme);
                        newrow.ColorPerRow =
                            SelectedStyleViewModel.ColorList.SingleOrDefault(
                                x => x.Iserial == row.TblColor);
                        var sizeRatioList = new ObservableCollection <TblSeasonalMasterListDetail>();
                        foreach (var sizeCode in SelectedStyleViewModel.Sizes.OrderBy(x => x.Id))
                        {
                            sizeRatioList.Add(new TblSeasonalMasterListDetail
                            {
                                Size = sizeCode.SizeCode,
                            });
                        }
                        //Added By  Hashem to Map with the NEW Stitch System Ratios with Sizes

                        ObservableCollection <TblSeasonalMasterListDetail> data = new ObservableCollection <TblSeasonalMasterListDetail>();

                        if (row.TblSeasonalMasterListDetails.Count() != 0)
                        {
                            //foreach (var r in row.TblSeasonalMasterListDetails)
                            //{
                            foreach (var item in SelectedStyleViewModel.Sizes.OrderBy(x => x.Id))
                            {
                                TblSeasonalMasterListDetail d = new TblSeasonalMasterListDetail();
                                d = row.TblSeasonalMasterListDetails.Where(x => x.Size == item.SizeCode).FirstOrDefault();
                                data.Add(d);
                            }
                            //}
                        }


                        //Commented By Hashem  to Map with the NEW Stitch System Ratios with Sizes
                        //GenericMapper.InjectFromObCollection(newrow.SeasonalMasterListDetail,
                        //row.TblSeasonalMasterListDetails.Count() != 0 ? row.TblSeasonalMasterListDetails : sizeRatioList);

                        GenericMapper.InjectFromObCollection(newrow.SeasonalMasterListDetail,
                                                             row.TblSeasonalMasterListDetails.Count() != 0 ? data : sizeRatioList);
                        try
                        {
                            newrow.DelivaryDate = row.DelivaryDate.Value;
                        }
                        catch { }
                        MainRowList.Add(newrow);
                    }
                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };

                Client.GetTblStoreIntialOrderCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblStoreIntialOrderViewModel();

                        newrow.InjectFrom(row);
                        newrow.StorePerRow = sv.Stores.FirstOrDefault(x => x.iserial == row.Store);
                        SelectedMainRow.DetailList.Add(newrow);
                    }
                    Loading         = false;
                    DetailFullCount = sv.fullCount;
                    if (DetailFullCount == 0 && SelectedMainRow.DetailList.Count == 0)
                    {
                        AddNewDetailRow(false);
                    }
                };

                Client.UpdateOrInsertTblSmlCompleted += (s, x) =>
                {
                    if (x.Error != null)
                    {
                        MessageBox.Show(x.Error.Message);
                    }
                    var savedRow = (TblSeasonalMasterListViewModel)MainRowList.GetItemAt(x.outindex);

                    if (savedRow != null)
                    {
                        savedRow.InjectFrom(x.Result);


                        foreach (var item in x.Result.TblSeasonalMasterListDetails)
                        {
                            var newsizeRow = savedRow.SeasonalMasterListDetail.FirstOrDefault(w => w.Size == item.Size);
                            if (newsizeRow != null)
                            {
                                newsizeRow.Iserial = item.Iserial;
                            }
                        }
                    }
                    Loading = false;
                    if (savedRow.Iserial == 0)
                    {
                        var amountAva    = x.AmountAvaliable;
                        var amountExc    = x.AmountExceeded;
                        var qtyAvaliable = x.QtyAvaliable;
                        var qtyExc       = x.QtyExceeded;

                        MessageBox.Show("Brand Budget Is Not Enough For The current Amounts Or Quantities, Amount Avaliable= " + amountAva + " and  Amount Exceeded= " + amountExc + "Qty Avaliable= " + qtyAvaliable + " and  Qty Exceeded= " + qtyExc);
                    }
                };

                Client.UpdateOrInsertTblStoreIntialOrderCompleted += (s, x) =>
                {
                    var savedRow = SelectedMainRow.DetailList.ElementAt(x.outindex);

                    if (savedRow != null)
                    {
                        savedRow.InjectFrom(x.Result);
                    }
                    Loading = false;
                };
                Client.DeleteSmlCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        throw ev.Error;
                    }

                    var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result);
                    if (oldrow != null)
                    {
                        MainRowList.Remove(oldrow);
                    }
                    Loading = false;
                };
                Client.DeleteTblStoreIntialOrderCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        throw ev.Error;
                    }

                    var oldrow = SelectedMainRow.DetailList.FirstOrDefault(x => x.Style == ev.Result.Style && x.Color == ev.Result.Color && x.Store == ev.Result.Store);
                    if (oldrow != null)
                    {
                        SelectedMainRow.DetailList.Remove(oldrow);
                    }
                    Loading = false;
                };
                GetMaindata();
            }
        }
コード例 #20
0
ファイル: StyleImageViewModel.cs プロジェクト: Osama91/CCWFM
        public StyleImageViewModel(TblStyleViewModel style)
        {
            Style       = style;
            MainRowList = new SortableCollectionView <TblStyleImageViewModel>();

            GetColors();
            MainRowList.CollectionChanged += MainRowList_CollectionChanged;
            SelectedMainRow = new TblStyleImageViewModel();

            Client.GetTblStyleImageCompleted += (s, sv) =>
            {
                MainRowList.Clear();
                foreach (var row in sv.Result)
                {
                    var newrow = new TblStyleImageViewModel();
                    newrow.InjectFrom(row);
                    newrow.ColorPerRow = row.TblColor1;
                    MainRowList.Add(newrow);
                }
                Loading = false;
            };

            Client.GetTblColorLinkCompleted += (s, sv) =>
            {
                ColorList = new ObservableCollection <TblColor>();
                foreach (var row in sv.Result)
                {
                    ColorList.Add(row.TblColor1);
                }
            };

            Client.MaxIserialOfStyleCompleted += (s, sv) =>
            {
                FolderPath = "Uploads" + "/" + sv.imagePath;

                string folderName = FolderPath + "/" + Style.SeasonPerRow.Ename + "_" + Style.Brand + "_" +
                                    Style.SectionPerRow.Ename;

                var counter = 0;
                foreach (var item in MainRowList)
                {
                    if (item.Iserial == 0)
                    {
                        var maxIserial = sv.Result;

                        item.ImagePath  = folderName + "/" + style.StyleCode + maxIserial + counter + ".png";
                        item.FolderPath = folderName;
                        item.UploadFile(item.ImagePerRow);

                        counter++;
                    }
                }

                var isvalid = false;

                foreach (var tblStyleImageViewModel in MainRowList)
                {
                    isvalid = Validator.TryValidateObject(tblStyleImageViewModel, new ValidationContext(tblStyleImageViewModel, null, null), null, true);

                    if (!isvalid)
                    {
                        return;
                    }
                }

                if (isvalid)
                {
                    var savelist = new ObservableCollection <TblStyleImage>();
                    GenericMapper.InjectFromObCollection(savelist, MainRowList);

                    Client.UpdateOrInsertTblStyleImageAsync(savelist);
                }
            };
            Client.GetTblStyleImageAsync(style.Iserial);
            Client.UpdateOrInsertTblStyleImageCompleted += (s, x) => Client.GetTblStyleImageAsync(style.Iserial);

            Client.DeleteTblStyleImageCompleted += (s, ev) =>
            {
                if (ev.Error != null)
                {
                    throw ev.Error;
                }

                var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result);
                if (oldrow != null)
                {
                    MainRowList.Remove(oldrow);
                }
            };
        }
コード例 #21
0
        public void AddNewMainRow(bool checkLastRow)
        {
            if (AllowAdd != true)
            {
                MessageBox.Show(strings.AllowAddMsg);
                return;
            }
            var currentRowIndex = (MainRowList.IndexOf(SelectedMainRow));

            if (checkLastRow)
            {
                var valiationCollection = new List <ValidationResult>();

                var isvalid = Validator.TryValidateObject(SelectedMainRow, new ValidationContext(SelectedMainRow, null, null), valiationCollection, true);

                if (!isvalid)
                {
                    return;
                }
            }

            var sizeRatioList = new ObservableCollection <TblSeasonalMasterListDetail>();

            foreach (var sizeCode in SelectedStyleViewModel.Sizes.OrderBy(x => x.Id))
            {
                sizeRatioList.Add(new TblSeasonalMasterListDetail
                {
                    Size = sizeCode.SizeCode,
                });
            }

            var style = new TblStyle();

            style.InjectFrom(SelectedStyleViewModel.SelectedMainRow);

            var prevRow = new TblSeasonalMasterListViewModel();

            if (currentRowIndex != -1)
            {
                prevRow = MainRowList.ElementAt(currentRowIndex);
            }

            var newrow = new TblSeasonalMasterListViewModel
            {
                TblStyle    = SelectedStyleViewModel.SelectedMainRow.Iserial,
                StylePerRow = style,
            };

            GenericMapper.InjectFromObCollection(newrow.SeasonalMasterListDetail,
                                                 prevRow.SeasonalMasterListDetail.Count() != 0 ? prevRow.SeasonalMasterListDetail : sizeRatioList);

            newrow.ThemePerRow = prevRow.ThemePerRow;

            foreach (var size in newrow.SeasonalMasterListDetail)
            {
                size.ProductionPerSize = 0;
            }

            MainRowList.Insert(currentRowIndex + 1, newrow);
            SelectedMainRow = newrow;
        }
コード例 #22
0
ファイル: GenericViewModel.cs プロジェクト: Osama91/CCWFM
        public GenericViewModelCollection(string tablEname, PermissionItemName userJobsForm)
        {
            if (DesignerProperties.IsInDesignTool)
            {
                return;
            }
            TablEname = tablEname;
            Client    = new _Proxy.CRUD_ManagerServiceClient();
            GetItemPermissions(userJobsForm.ToString());

            Client.GetGenericCompleted += (s, ev) =>
            {
                Loading = false;
                GenericMapper.InjectFromObCollection(MainRowList, ev.Result);
                //FullCount = ev.fullCount;
                if (MainRowList.Any() && (SelectedMainRow == null || SelectedMainRow.Iserial == 0))
                {
                    SelectedMainRow = MainRowList.FirstOrDefault();
                }
                if (FullCount == 0 && MainRowList.Count == 0)
                {
                    AddNewMainRow(false);
                }

                if (Export)
                {
                    Export = false;
                    ExportGrid.ExportExcel(userJobsForm.ToString());
                }
            };

            MainRowList = new SortableCollectionView <GenericViewModel>();

            Client.GenericUpdateOrInsertCompleted += (s, ev) =>
            {
                if (ev.Error != null)
                {
                    MessageBox.Show(ev.Error.Message);
                }
                Loading = false;
                MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
            };

            Client.DeleteGenericCompleted += (s, ev) =>
            {
                if (ev.Error != null)
                {
                    MessageBox.Show(ev.Error.Message);
                }
                Loading = false;
                var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result);
                if (oldrow != null)
                {
                    MainRowList.Remove(oldrow);
                }
                if (!MainRowList.Any())
                {
                    AddNewMainRow(false);
                }
            };
            GetMaindata();
        }