private void btnActive_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            DialogResult result = MessageBox.Show("Aktif yapmak istediğinizden emin misiniz?", "Aktif Yap", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (result.Equals(DialogResult.OK))
            {
                this.FocusedRowHandle = gridViewOBFList.FocusedRowHandle;
                int id          = SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <int>(gridViewOBFList.GetFocusedRowCellValue("Id"));
                OBF selectedOBF = OBFProvider.Instance.GetItem(id);
                selectedOBF.IsActive = true;
                OBFProvider.Instance.Save(selectedOBF);
                this.LoadGrid();
            }
            else
            {
            }
        }
예제 #2
0
 public OBFModel(OBF Entity)
 {
     this.Number                 = Entity.Number;
     this.Unit                   = Entity.Unit;
     this.UnitPrice              = Entity.UnitPrice;
     this.Description            = Entity.Description;
     this.Id                     = Entity.Id;
     this.IsActive               = Entity.IsActive;
     this.StokNumber             = Entity.StokNumber;
     this.DescriptionForSupplier = Entity.DescriptionForSupplier;
     this.ParentId               = Entity.ParentId;
     this.Childrens              = CustomSaveableModelBase.GetModels <OBFModel, OBF>(Entity.Childrens);
     this.InserTime              = Entity.InsertTime;
     this.CurrencyType           = Entity.CurrencyType;
     //if (this.Childrens.Count != 0)
     //{
     //    this.UnitPrice = this.Childrens.OrderByDescending(p => p.InserTime).FirstOrDefault().UnitPrice;
     //}
 }
예제 #3
0
        public override EntityBase ToEntity()
        {
            OBF OBF = new OBF();

            OBF.Description = this.Description;
            if (this.Id.HasValue)
            {
                OBF.Id = this.Id.Value;
            }
            OBF.Number                 = this.Number;
            OBF.Unit                   = this.Unit;
            OBF.UnitPrice              = this.UnitPrice;
            OBF.CurrencyType           = this.CurrencyType;
            OBF.StokNumber             = this.StokNumber;
            OBF.IsActive               = this.IsActive;
            OBF.DescriptionForSupplier = this.DescriptionForSupplier;
            OBF.ParentId               = this.ParentId;
            return(OBF);
        }
예제 #4
0
        private void LoadMaterialListGrid()
        {
            string obfNumber      = txtNumber.Text;
            string obfDescription = txtDescription.Text;

            oBFModels = new List <OBFModel>();
            Offer offer = UICurrentManager.Instance.CurrentTender.Offer;
            List <MaterialList> selectedMaterialLists = UICurrentManager.Instance.CurrentTender.MaterialList.Where(p => !p.IsPoz).ToList();

            if (offer == null)
            {
                oBFModels = UIOBFManager.Instance.GetOBFs(obfNumber, obfDescription).Where(p => p.IsActive).ToList();
                if (selectedMaterialLists != null)
                {
                    foreach (MaterialList item in selectedMaterialLists)
                    {
                        bool     isExistingPozModel = false;
                        OBFModel selectedOBFModel   = null;
                        foreach (var obfModel in oBFModels)
                        {
                            OBF PozObf = OBFProvider.Instance.GetItem(item.PozOBFId);

                            if (obfModel.Id == PozObf.Id || PozObf.ParentId == obfModel.ParentId || PozObf.ParentId == obfModel.Id)
                            {
                                isExistingPozModel = true;
                                selectedOBFModel   = obfModel;
                                break;
                            }
                        }

                        if (isExistingPozModel)
                        {
                            oBFModels.Remove(selectedOBFModel);
                        }
                    }
                }
            }

            else
            {
                List <OfferMaterialList> items = offer.MaterialList.Where(p => !p.IsPoz).ToList();
                if (items != null && items.Count != 0)
                {
                    foreach (var item in items)
                    {
                        bool isExist = false;

                        foreach (var selectedMaterialList in selectedMaterialLists)
                        {
                            if (selectedMaterialList.PozOBFId == item.PozOBFId)
                            {
                                isExist = true;
                                break;
                            }
                        }

                        if (!isExist)
                        {
                            OBFModel model = new OBFModel();
                            model.Description = item.PozOBF.Description;
                            model.Number      = item.PozOBF.Number.Trim();
                            model.StokNumber  = item.PozOBF.Number;
                            model.Unit        = item.PozOBF.Unit;
                            model.UnitPrice   = item.PozOBF.UnitPrice;
                            model.Id          = item.PozOBFId;
                            double offerPrice = 0;
                            if (item.IsSelected)
                            {
                                // Malzeme tedarikciye gonderilmisse fiyatini offerMatetialdan ceksin.
                                offerPrice       = OfferManager.Instance.GetOfferMaterialListPrice(item.Id).PriceWithRisk;
                                model.OfferPrice = offerPrice;
                            }
                            else
                            {
                                offerPrice       = item.PozOBF.UnitPrice; // Malzeme tedarikciye gonderilmemisse fiyatini obf den ceksin.
                                model.OfferPrice = offerPrice;
                            }

                            if (!string.IsNullOrEmpty(obfNumber))
                            {
                                if (item.PozOBF.Number.ToLower().Contains(obfNumber.ToLower()))
                                {
                                    oBFModels.Add(model);
                                }
                            }
                            else if (!string.IsNullOrEmpty(obfDescription))
                            {
                                if (item.PozOBF.Description.ToLower().Contains(obfDescription.ToLower()))
                                {
                                    oBFModels.Add(model);
                                }
                            }
                            else
                            {
                                oBFModels.Add(model);
                            }
                        }
                    }
                }
            }
            grdOBFList.DataSource = null;
            grdOBFList.DataSource = oBFModels;
        }