Ejemplo n.º 1
0
        private void SetEnable(Object sender, EditModeEventArgs e)
        {
            /*TODO: для Столяровй сделать видимой инфу про водителя*/
            //if (User.GetRole() == RolesList.AccountantWayBill)
            //{
            //    this.Size = new System.Drawing.Size(410, 486);
            //    _workWithForm.SetEnableValue(btnSave, true);
            //}

            if (_workWithForm.IsEditMode())
            {
                if (_driver.From1C)
                {
                    tbCompany.ReadOnly = true;

                    rbMan.Enabled   = false;
                    rbWoman.Enabled = false;

                    tbFio.ReadOnly      = true;
                    cbRegion.Enabled    = false;
                    tbDept.ReadOnly     = true;
                    tbPosition.ReadOnly = true;
                    chbDecret.Enabled   = false;
                    chbFired.Enabled    = false;

                    mtbDateBirth.ReadOnly = true;
                    tbLogin.ReadOnly      = true;
                }

                tbNumber.ReadOnly = _driver.From1C;
            }
        }
Ejemplo n.º 2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (_workWithForm.IsEditMode())
     {
         DialogResult = System.Windows.Forms.DialogResult.OK;
     }
     Save();
 }
Ejemplo n.º 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                int idDriver;
                int.TryParse(cbDriver.SelectedValue.ToString(), out idDriver);
                _fuelCardDriver.Driver    = DriverList.getInstance().getItem(idDriver);
                _fuelCardDriver.DateBegin = dtpDateBegin.Value;

                if (chbNotUse.Checked)
                {
                    if ((!_fuelCardDriver.IsNotUse) && (chbNotUse.Checked))
                    {
                        FuelCard       fuelCard       = _fuelCardDriver.FuelCard;
                        FuelCardDriver fuelCardDriver = fuelCard.CreateFuelCardDriver();
                        fuelCardDriver.Save();
                    }

                    _fuelCardDriver.DateEnd = dtpDateEnd.Value.Date;
                }
                else
                {
                    _fuelCardDriver.IsNotUse = false;
                }

                _fuelCardDriver.Save();

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }
Ejemplo n.º 4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                if (cbMyPoint.SelectedValue == null)
                {
                    MessageBox.Show("Выберите адрес подачи", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                int idPoint;
                int.TryParse(cbMyPoint.SelectedValue.ToString(), out idPoint);
                MyPointList myPointList = MyPointList.getInstance();
                MyPoint     point       = myPointList.getItem(idPoint);
                _suppyAddress.Point = point;

                _suppyAddress.Save();

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }
Ejemplo n.º 5
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                if (!isFill())
                {
                    return;
                }

                _grade.Name    = tbName.Text;
                _grade.EPower  = tbEPower.Text;
                _grade.EVol    = tbEVol.Text;
                _grade.MaxLoad = tbMaxLoad.Text;
                _grade.NoLoad  = tbNoLoad.Text;

                int idEngineType;
                int.TryParse(cbEngineType.SelectedValue.ToString(), out idEngineType);
                EngineTypeList engineTypeList = EngineTypeList.getInstance();
                EngineType     engineType     = engineTypeList.getItem(idEngineType);
                _grade.EngineType = engineType;

                _grade.Save();

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }
Ejemplo n.º 6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                _invoice.DriverFromID = cbDriverFrom.SelectedValue.ToString();
                _invoice.DriverToID   = cbDriverTo.SelectedValue.ToString();
                _invoice.RegionFromID = cbRegionFrom.SelectedValue.ToString();
                _invoice.RegionToID   = cbRegionTo.SelectedValue.ToString();
                _invoice.Date         = dtpDate.Value;
                _invoice.DateMove     = mtbDateMove.Text;

                TextBox tbFile = ucFile.Controls["tbFile"] as TextBox;
                _invoice.File = tbFile.Text;

                _invoice.Save();

                if (_check.Checked)
                {
                    DriverList driverList = DriverList.getInstance();
                    Driver     driver     = driverList.getItem(Convert.ToInt32(cbDriverFrom.SelectedValue.ToString()));
                    driver.IsDriver = false;
                    driver.Save();
                }

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }
Ejemplo n.º 7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                if (cbMyPoint2.SelectedValue == null)
                {
                    MessageBox.Show("Выберите пункт назначения", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                else if (tbDistance.Text == string.Empty)
                {
                    MessageBox.Show("Введите дистанцию", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    MyPointList myPointList = MyPointList.getInstance();
                    int         idMyPoint2;
                    int.TryParse(cbMyPoint2.SelectedValue.ToString(), out idMyPoint2);

                    _route.MyPoint2 = myPointList.getItem(idMyPoint2);
                    int distance;
                    int.TryParse(tbDistance.Text, out distance);
                    _route.Distance = distance;
                    _route.Save();
                }

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }
Ejemplo n.º 8
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (_workWithForm.IsEditMode())
     {
         TrySave();
         this.DialogResult = System.Windows.Forms.DialogResult.OK;
     }
     else
     {
         _workWithForm.SetEditMode(true);
     }
 }
Ejemplo n.º 9
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (_workWithForm.IsEditMode())
     {
         copyFields();
         _passport.Save();
         DialogResult = System.Windows.Forms.DialogResult.OK;
     }
     else
     {
         _workWithForm.SetEditMode(true);
     }
 }
Ejemplo n.º 10
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                _userAccess.Driver = DriverList.getInstance().getItem(Convert.ToInt32(cbDriver.SelectedValue));
                _userAccess.RoleID = Convert.ToInt32(cbRole.SelectedValue);
                _userAccess.Save();

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }
Ejemplo n.º 11
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                Save();

                _fuelCard.AddEmptyDriver();

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }
Ejemplo n.º 12
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                _carDoc.Name = tbName.Text;
                TextBox tbFile = ucFile.Controls["tbFile"] as TextBox;
                _carDoc.File = tbFile.Text;

                _carDoc.Save();

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }
Ejemplo n.º 13
0
        private void save_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                _instraction.Date = dtpDate.Value.Date.ToShortDateString();
                _instraction.Name = tbNumber.Text;

                TextBox tbFile = (TextBox)ucFile.Controls["tbFile"];
                _instraction.File = tbFile.Text;

                _instraction.Save();
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }
Ejemplo n.º 14
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                _tempMove.Driver    = DriverList.getInstance().getItem(Convert.ToInt32(cbDriver.SelectedValue));
                _tempMove.Car       = CarList.getInstance().getItem(Convert.ToInt32(cbCar.SelectedValue));
                _tempMove.DateBegin = Convert.ToDateTime(dtpDateBegin.Value);
                _tempMove.DateEnd   = Convert.ToDateTime(dtpDateEnd.Value);

                _tempMove.Save();

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }
Ejemplo n.º 15
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                _mileage.Date = dtpDate.Value.Date;

                if (trySetCount())
                {
                    _mileage.Save();
                }

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }
Ejemplo n.º 16
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                _diagCard.Number = tbNumber.Text;
                _diagCard.Date   = dtpDate.Value.Date;

                TextBox tbFile = ucFile.Controls["tbFile"] as TextBox;
                _diagCard.File = tbFile.Text;

                _diagCard.Save();

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }
Ejemplo n.º 17
0
        private void save_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                _license.Number    = mtbNumber.Text;
                _license.DateBegin = dateBegin.Value.Date;
                _license.DateEnd   = dateEnd.Value.Date;
                TextBox tbFile = (TextBox)ucFile.Controls["tbFile"];
                _license.File = tbFile.Text;

                _license.Save();

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }
Ejemplo n.º 18
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                MarkList markList = MarkList.getInstance();
                int      idMark;
                int.TryParse(cbMark.SelectedValue.ToString(), out idMark);
                _ssDTP.Mark = markList.getItem(idMark);

                _ssDTP.IDServiceStantion = cbServiceStantion.SelectedValue.ToString();

                _ssDTP.Save();

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }
Ejemplo n.º 19
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                shipPart.Car         = CarList.getInstance().getItem(Convert.ToInt32(cbCar.SelectedValue));
                shipPart.Driver      = DriverList.getInstance().getItem(Convert.ToInt32(cbDriver.SelectedValue));
                shipPart.Number      = tbNumber.Text;
                shipPart.DateRequest = mtbDateRequest.Text;
                shipPart.DateSent    = mtbDateSent.Text;

                TextBox tbFile = ucFile.Controls["tbFile"] as TextBox;
                shipPart.File = tbFile.Text;

                shipPart.Save();
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }
Ejemplo n.º 20
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                RegionList regionList = RegionList.getInstance();
                int        idRegion;
                int.TryParse(cbRegion.SelectedValue.ToString(), out idRegion);
                _employees.Region = regionList.getItem(idRegion);

                _employees.IDEmployeesName = cbEmployeesName.SelectedValue.ToString();
                _employees.IDDriver        = cbDriver.SelectedValue.ToString();

                _employees.Save();

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }
Ejemplo n.º 21
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                _repair.RepairTypeID      = cbRepairType.SelectedValue.ToString();
                _repair.ServiceStantionID = cbServiceStantion.SelectedValue.ToString();

                _repair.Date = dtpDate.Value;
                _repair.Cost = tbCost.Text;

                TextBox tbFile = ucFile.Controls["tbFile"] as TextBox;
                _repair.File = tbFile.Text;

                _repair.Save();

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }
Ejemplo n.º 22
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                if (tbName.Text == string.Empty)
                {
                    MessageBox.Show("Введите название", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    _mypoint.Name = tbName.Text;
                    _mypoint.Save();
                }

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }