Exemple #1
0
        public override EntityBase ToEntity()
        {
            TenderMaterialListEquipment entity = new TenderMaterialListEquipment();

            entity.EquipmentId  = this.EquipmentId;
            entity.Quantity     = this.Quantity;
            entity.UnitTimeType = this.UnitTimeType;
            entity.UnitTime     = this.UnitTime;
            if (this.Id.HasValue)
            {
                entity.Id = this.Id.Value;
            }
            return(entity);
        }
        private void btnAracCikar_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            DialogResult result = MessageBox.Show("Silmek istediğinizden emin misiniz?", "Sil", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (result.Equals(DialogResult.Yes))
            {
                int id = SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <int>(gridViewAddWorker.GetFocusedRowCellValue("Id"));
                TenderMaterialListEquipment selectedVehicle = TenderMaterialListEquipmentProvider.Instance.GetItem(id);
                if (selectedVehicle != null)
                {
                    selectedVehicle.IsMarkedForDeletion = true;
                    TenderMaterialListEquipmentProvider.Instance.Save(selectedVehicle);
                    this.LoadWorkerMateriallistGrid();
                }
            }
            else
            {
            }
        }
Exemple #3
0
 public TenderMaterialListEquipmentModel(TenderMaterialListEquipment Entity)
 {
     this.Equipment            = Entity.Equipment;
     this.Quantity             = Entity.Quantity;
     this.Id                   = Entity.Id;
     this.UnitTime             = Entity.UnitTime;
     this.UnitTimeType         = Entity.UnitTimeType;
     this.SelectedUnitTimeType = (int)this.UnitTimeType;
     if (this.Equipment.WorkerVehicle != null)
     {
         if (this.Equipment.IsWorker)
         {
             this.SelectedWorker = this.Equipment.WorkerVehicle.Id;
         }
         else
         {
             this.SelectedVehicle = this.Equipment.WorkerVehicle.Id;
         }
     }
 }
        private void gridViewAddVehicle_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (e.Column == colAddVehicleId || e.Column == colAddVehicleWorkerUnitPrice)
            {
                return;
            }
            TenderMaterialListEquipmentModel currentItem = new TenderMaterialListEquipmentModel();
            int currentId = Convert.ToInt32(gridViewAddVehicle.GetFocusedRowCellValue("Id"));

            if (currentId <= 0)
            {
                //if (e.Value == null)
                //{
                //    return;
                //}
                currentItem = new TenderMaterialListEquipmentModel();
                TenderEquipment equipment = new TenderEquipment();
                equipment.IsWorker = false;
                equipment.TenderId = UICurrentManager.Instance.CurrentTender.Id;
                if (e.Column == colAddVehicleVehicle)
                {
                    //System.Data.DataRow row = gridViewAddVehicle.GetDataRow(gridViewAddVehicle.FocusedRowHandle);
                    //string cellValue = row[0].ToString();
                    //object a = gridViewAddVehicle.GetSelectedRow("SelectedVehicle");
                    object b = gridViewAddVehicle.ActiveEditor.EditValue;
                    equipment.WorkerVehicleId = (int)b;
                }
                OperationResult result = TenderEquipmentProvider.Instance.Save(equipment);
                if (result.Success)
                {
                    TenderMaterialListEquipment tenderMaterialListEquipment = new TenderMaterialListEquipment();
                    tenderMaterialListEquipment.EquipmentId    = equipment.Id;
                    tenderMaterialListEquipment.MaterialListId = this.SelectedMaterial.Id.Value;
                    tenderMaterialListEquipment.TenderId       = UICurrentManager.Instance.CurrentTender.Id;
                    tenderMaterialListEquipment.Equipment      = equipment;
                    OperationResult result1 = TenderMaterialListEquipmentProvider.Instance.Save(tenderMaterialListEquipment);
                    if (result1.Success)
                    {
                        currentItem           = new TenderMaterialListEquipmentModel(tenderMaterialListEquipment);
                        currentItem.Equipment = equipment;
                        gridViewAddVehicle.SetFocusedRowCellValue(colAddVehicleId, currentItem.Id);
                        LoadWorkerMateriallistGrid();
                        return;
                    }
                }
            }
            else
            {
                List <TenderMaterialListEquipmentModel> items = ((IEnumerable <TenderMaterialListEquipmentModel>)bindingSourceAddVehicle.DataSource).ToList();

                foreach (TenderMaterialListEquipmentModel item in items)
                {
                    if (item.Id == currentId)
                    {
                        currentItem = item;
                        break;
                    }
                }
            }

            if (e.Column == colAddVehicleQuantity)
            {
                currentItem.Quantity = SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <double>(e.Value);
            }
            else if (e.Column == colAddVehicleUnitTime)
            {
                currentItem.UnitTime = SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <int>(e.Value);
            }
            else if (e.Column == colAddVehicleUnitTimeType)
            {
                currentItem.UnitTimeType = SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <UnitTimeTypesEnum>(e.Value);
            }

            else if (e.Column == colAddVehicleVehicle)
            {
                currentItem.Equipment.WorkerVehicleId = (int)e.Value;
                TenderEquipmentProvider.Instance.Save(currentItem.Equipment);
                currentItem.Equipment = null;
            }

            currentItem.Save();
            grdAddVehicle.Refresh();
        }