private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            ServiceMadeModel servMade = dgvServiceMade.SelectedItem as ServiceMadeModel;

            if (servMade != null)
            {
                if (!string.IsNullOrEmpty(datePicker.Text))
                {
                    DateTime date1   = DateTime.Parse(servMade.DateServiced);
                    string   strDate = DateTime.Now.ToShortDateString();
                    DateTime now     = DateTime.Parse(strDate);
                    if (date1 < now && user.Type > 1)
                    {
                        System.Windows.MessageBox.Show("Sorry. You can't edit previous rendered service!");
                    }
                    else
                    {
                        servMade.DateServiced = datePicker.Text;
                        ServiceForm service = new ServiceForm(this, servMade, clientModel, user);
                        service.ShowDialog();
                    }
                }
                else
                {
                    System.Windows.MessageBox.Show("Please select date.");
                }
            }
            else
            {
                System.Windows.MessageBox.Show("No record selected!");
            }
        }
Example #2
0
        protected override void Run(string serviceName, string applicationRootFolder, string configurationFile)
        {
            // Only the first container is used.

            var form = new ServiceForm(new ServiceParameters(serviceName, applicationRootFolder, configurationFile));

            form.ShowDialog();
        }
Example #3
0
        private void Service_AddButtonClicked(Object sender, EventArgs e)
        {
            try
            {
                ServiceForm Form = !Dic_Changes.Any() ? new ServiceForm(Context, UniversalCard, CardScript.CardFrame.CardHost, Guid.Empty, Convert.ToDateTime(GetControlValue(RefApplicationCard.MainInfo.RegDate)))
                    : new ServiceForm(Context, UniversalCard, CardScript.CardFrame.CardHost, Guid.Empty,
                                      Convert.ToDateTime(GetControlValue(RefApplicationCard.MainInfo.RegDate)),
                                      Dic_Changes.Select(ch => ch.DeviceNumberId.NewValue).ToList(),
                                      Dic_Changes.SelectMany(ch => String.IsNullOrEmpty(ch.Sensors.NewValue) ? new List <String>() : ch.Sensors.NewValue.Split(';').ToList()).ToList());
                switch (Form.ShowDialog())
                {
                case DialogResult.OK:
                    BaseCardProperty Row   = Table_Service[Table_Service.FocusedRowIndex];
                    Guid             RowId = Guid.NewGuid();
                    Row[RefApplicationCard.Service.Id]       = RowId;
                    Row[RefApplicationCard.Service.DeviceID] = Form.DeviceId;

                    Row[RefApplicationCard.Service.DeviceNumber]   = Form.DeviceNumber;
                    Row[RefApplicationCard.Service.DeviceNumberID] = Form.DeviceNumberId;

                    Row[RefApplicationCard.Service.AC] = Form.AC;

                    Row[RefApplicationCard.Service.Sensors] = Form.Sensors;

                    Row[RefApplicationCard.Service.Verify]    = Form.Verify;
                    Row[RefApplicationCard.Service.Repair]    = Form.Repair;
                    Row[RefApplicationCard.Service.Calibrate] = Form.Calibrate;
                    Row[RefApplicationCard.Service.Wash]      = Form.Wash;

                    Row[RefApplicationCard.Service.WarrantyServices] = Form.Warranty;

                    Row[RefApplicationCard.Service.ACList]   = Form.ACList;
                    Row[RefApplicationCard.Service.Comments] = Form.Comment;

                    Row[RefApplicationCard.Service.PackedListData] = Form.CData;
                    Row[RefApplicationCard.Service.PackedListID]   = Guid.Empty;
                    Table_Service.RefreshRow(Table_Service.FocusedRowIndex);

                    ServiceTableChange Change = (ServiceTableChange)Row;
                    Change.FileIsChanged = true;
                    Dic_Changes.Add(Change);

                    UpdateACRows(RowId, Form.ACRows.Select(i => (SKB.PaymentAndShipment.Forms.AccountCard.SaleCompleteRow)i).ToList());
                    break;

                default:
                    Table_Service.RemoveRow(CardScript.BaseObject, Table_Service.FocusedRowIndex);
                    break;
                }
            }
            catch (MyException) { Table_Service.RemoveRow(CardScript.BaseObject, Table_Service.FocusedRowIndex); }
            catch (Exception Ex) { CallError(Ex); }
        }
 public override void EditSelectedItem()
 {
     if (_methoEnum == MethodologyEnum.CONSUMPTION)
     {
         ConsumptionForm frm = new ConsumptionForm(GetSelectedConsumption(), MdiParentForm);
         frm.ShowDialog();
     }
     else if (_methoEnum == MethodologyEnum.SERVICE_STATISTIC)
     {
         ServiceForm frm = new ServiceForm(GetSelectedConsumption(), MdiParentForm);
         frm.ShowDialog();
     }
 }
        private void lbtAddnew_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            ForecastInfo finfo = new ForecastInfo();

            finfo.Methodology = _methoEnum.ToString();

            if (_methoEnum == MethodologyEnum.CONSUMPTION)
            {
                ConsumptionForm frm = new ConsumptionForm(finfo, MdiParentForm);
                frm.ShowDialog();
            }
            else if (_methoEnum == MethodologyEnum.SERVICE_STATISTIC)
            {
                ServiceForm frm = new ServiceForm(finfo, MdiParentForm);
                frm.ShowDialog();
            }
        }
Example #6
0
        public void Update()
        {
            QueriesTableAdapter queries = new QueriesTableAdapter();
            int highCopies = Convert.ToInt32(queries.GetNumberOfCopiesInProductSaleById(Node.Id));

            servsAdapter.FillBy(servs, Node.Id);

            if (servs.Rows.Count != 1)
            {
                throw new Exception();
            }

            var         row  = servs.Rows[0];
            ServiceForm form = new ServiceForm(Convert.ToInt32(row[2]), Convert.ToInt32(row[3]), highCopies);

            form.ShowDialog();

            int     service;
            int     copies;
            decimal cost;

            if (form.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                service = form.Service;
                copies  = form.Copies;
                cost    = form.Cost;
            }
            else
            {
                return;
            }

            UpdateServSales(Node.Id, service, copies, cost);

            servShowAdapter.FillById(servShow, Node.Id);
            UpdateParentDeal(false);

            if (servShow.Rows.Count != 1)
            {
                throw new Exception();
            }

            row       = servShow.Rows[0];
            Node.Text = Convert.ToString(row[2]);
        }
Example #7
0
        public void Add()
        {
            QueriesTableAdapter queries = new QueriesTableAdapter();
            int highCopies = Convert.ToInt32(queries.GetNumberOfCopiesInProductSaleById(Node.Id));

            ServiceForm form = new ServiceForm(highCopies);

            form.ShowDialog();

            int     service;
            int     copies;
            decimal cost;

            if (form.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                service = form.Service;
                copies  = form.Copies;
                cost    = form.Cost;
            }
            else
            {
                return;
            }

            int id = InsertIntoServSales(Node.Id, service, copies, cost);

            servShowAdapter.FillById(servShow, id);
            UpdateParentDeal(true);

            if (servShow.Rows.Count != 1)
            {
                throw new Exception();
            }

            var        row     = servShow.Rows[0];
            CustomNode newNode =
                new CustomNode(text: Convert.ToString(row[2]), type: CustomNode.SERVICE, id: Convert.ToInt32(row[1]),
                               pId: Convert.ToInt32(row[0]));

            newNode.ContextMenu =
                new CustomMenu(new Controller().GetServiceMenuItems(), newNode);

            Node.Nodes.Add(newNode);
        }
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(datePicker.Text))
                {
                    if (!string.IsNullOrEmpty(clientModel.ID1))
                    {
                        if (clientModel.LoyaltyID.Equals("0"))
                        {
                            if (chkAvailLoyalty.IsChecked == true)
                            {
                                clientModel.LoyaltyID = cmbLoyaltycards.SelectedValue.ToString();
                                clientModel.isLoyal   = "1";
                            }
                            else
                            {
                                clientModel.LoyaltyID = "0";
                                clientModel.isLoyal   = "0";
                            }
                        }
                        DateTime dte = DateTime.Parse(datePicker.ToString());
                        clientModel.DateServiced = dte.Year + "/" + dte.Month + "/" + dte.Day;

                        ServiceForm serviceForm = new ServiceForm(this, clientForm, clientModel, user);
                        serviceForm.ShowDialog();
                    }
                    else
                    {
                        if (checkFields())
                        {
                            ClientModel model = new ClientModel();

                            model.DateServiced = datePicker.Text;
                            model.SerialNumber = txtSerialNumber.Text;
                            model.Cod          = txtCOD.Text;
                            model.FirstName    = txtFirstName.Text;
                            model.LastName     = txtLastName.Text;
                            model.Address      = txtAddress.Text;
                            model.PhoneNumber  = txtPhoneNumber.Text;
                            model.TimeIn       = timeInPicker.Text;
                            model.TimeOut      = timeOutPicker.Text;
                            model.ServiceMode  = cmbServiceMode.SelectedValue.ToString();

                            if (chkAvailLoyalty.IsChecked == true)
                            {
                                model.LoyaltyID = cmbLoyaltycards.SelectedValue.ToString();
                                model.isLoyal   = "1";
                            }
                            else
                            {
                                model.LoyaltyID = "0";
                                model.isLoyal   = "0";
                            }

                            ServiceForm serviceForm = new ServiceForm(this, clientForm, model, user);
                            serviceForm.ShowDialog();
                        }
                    }
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Please select date.");
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message);
            }
        }
Example #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            var seriveForm = new ServiceForm();

            seriveForm.ShowDialog();
        }
Example #10
0
        private void Service_DoubleClick(Object sender, EventArgs e)
        {
            try
            {
                BaseCardProperty Row   = Table_Service[Table_Service.FocusedRowIndex];
                Guid             RowId = Row[RefApplicationCard.Service.Id].ToGuid();
                ServiceForm      Form  = !Dic_Changes.Any(ch => ch.RowId != RowId) ? new ServiceForm(Context, UniversalCard, CardScript.CardFrame.CardHost, Row[RefApplicationCard.Service.DeviceID].ToGuid(), Convert.ToDateTime(GetControlValue(RefApplicationCard.MainInfo.RegDate)))
                    : new ServiceForm(Context, UniversalCard, CardScript.CardFrame.CardHost, Row[RefApplicationCard.Service.DeviceID].ToGuid(),
                                      Convert.ToDateTime(GetControlValue(RefApplicationCard.MainInfo.RegDate)),
                                      Dic_Changes.Select(ch => ch.DeviceNumberId.NewValue).ToList(),
                                      Dic_Changes.SelectMany(ch => String.IsNullOrEmpty(ch.Sensors.NewValue) ? new List <String>() : ch.Sensors.NewValue.Split(';').ToList()).ToList());

                Form.DeviceNumberId = Row[RefApplicationCard.Service.DeviceNumberID].ToGuid();
                Form.DeviceNumber   = Row[RefApplicationCard.Service.DeviceNumber] as String;

                Form.AC = (Boolean)Row[RefApplicationCard.Service.AC];

                Form.Sensors = Row[RefApplicationCard.Service.Sensors] as String;

                Form.Verify    = (Boolean)Row[RefApplicationCard.Service.Verify];
                Form.Repair    = (Boolean)Row[RefApplicationCard.Service.Repair];
                Form.Calibrate = (Boolean)Row[RefApplicationCard.Service.Calibrate];
                Form.Wash      = (Boolean)Row[RefApplicationCard.Service.Wash];

                Form.Warranty = (Boolean)Row[RefApplicationCard.Service.WarrantyServices];

                Form.ACList  = Row[RefApplicationCard.Service.ACList] as String;
                Form.Comment = Row[RefApplicationCard.Service.Comments] as String;

                String OldCData = Row[RefApplicationCard.Service.PackedListData] as String;
                Form.CData = OldCData;
                switch (Form.ShowDialog())
                {
                case DialogResult.OK:
                    Row[RefApplicationCard.Service.DeviceID] = Form.DeviceId;

                    Row[RefApplicationCard.Service.DeviceNumber]   = Form.DeviceNumber;
                    Row[RefApplicationCard.Service.DeviceNumberID] = Form.DeviceNumberId;

                    Row[RefApplicationCard.Service.AC] = Form.AC;

                    Row[RefApplicationCard.Service.Sensors] = Form.Sensors;

                    Row[RefApplicationCard.Service.Verify]    = Form.Verify;
                    Row[RefApplicationCard.Service.Repair]    = Form.Repair;
                    Row[RefApplicationCard.Service.Calibrate] = Form.Calibrate;
                    Row[RefApplicationCard.Service.Wash]      = Form.Wash;

                    Row[RefApplicationCard.Service.WarrantyServices] = Form.Warranty;

                    Row[RefApplicationCard.Service.ACList]   = Form.ACList;
                    Row[RefApplicationCard.Service.Comments] = Form.Comment;

                    Row[RefApplicationCard.Service.PackedListData] = Form.CData;
                    Table_Service.RefreshRow(Table_Service.FocusedRowIndex);
                    Grid_Service.FocusedRowHandle = -1;

                    ServiceTableChange Change = Dic_Changes.Find(RowId);
                    Change.DeviceId.NewValue = Form.DeviceId;
                    Change.FileIsChanged     = !OldCData.Equals(Form.CData);
                    Change.Warranty.NewValue = Form.Warranty;
                    Change.AC.NewValue       = Form.AC;

                    if (!OldCData.Equals(Form.CData))
                    {
                        UpdateACRows(RowId, Form.ACRows.Select(i => (SKB.PaymentAndShipment.Forms.AccountCard.SaleCompleteRow)i).ToList());
                    }
                    break;

                default:
                    Table_Service.RemoveRow(CardScript.BaseObject, Table_Service.FocusedRowIndex);
                    break;
                }
            }
            catch (Exception Ex) { CallError(Ex); }
        }