コード例 #1
0
ファイル: printService.cs プロジェクト: sikisuti/gyorok
 public printService(ServiceWorksheets sw, servicePrintType printType)
 {
     //db = new dbGyorokEntities();
     pType = printType;
     //serviceToPrint = SQLConnection.Execute.ServiceSumView.Single(ss => ss.worksheetID == sw.worksheetID);
     Printing();
 }
コード例 #2
0
        private void SetStatus()
        {
            List<Parts> tempParts = new List<Parts>();
            ServiceWorksheets changableWS = new ServiceWorksheets();
            bool waitForPart = false;

            //tempParts = SQLConnection.Execute.PartsTable.Where(p => p.serviceID == _serviceID).ToList();
            foreach (var item in tempParts)
            {
                if (item.mustOrder)
                {
                    waitForPart = true;
                    break;
                }
            }

            //changableWS = SQLConnection.Execute.ServiceWorksheetsTable.Single(ws => ws.worksheetID == _serviceID);
            if (waitForPart)
            {
                if (selectedWorksheet.statusID != 2)
                {
                    changableWS.statusID = 4;
                }
            }
            else
            {
                if (selectedWorksheet.quotRequested && !selectedWorksheet.quotAccepted)
                {
                    changableWS.statusID = 2;
                }
                else
                {
                    changableWS.statusID = 1;
                }
            }

            SQLConnection.Execute.SaveDb();
            RefreshGroupList();
        }
コード例 #3
0
 void serviceDoneExecute()
 {
     ServiceWorksheets sw = new ServiceWorksheets();
     //sw = SQLConnection.Execute.ServiceWorksheetsTable.Single(w => w.worksheetID == selectedWorksheet.worksheetID);
     sw.statusID = 5;
     if (sw.serviceCost == null)
     {
         sw.serviceCost = 0;
     }
     SQLConnection.Execute.SaveDb();
     RefreshGroupList();
 }
コード例 #4
0
 void saveExecute()
 {
     long tempSS;
     tempSS = selectedWorksheet.worksheetID;
     ServiceWorksheets sw = new ServiceWorksheets();
     //sw = SQLConnection.Execute.ServiceWorksheetsTable.Single(w => w.worksheetID == tempSS);
     sw.serviceCost = laborFee;
     sw.discount = discount / 100;
     sw.errorDescription = error;
     sw.comment = comment;
     SQLConnection.Execute.SaveDb();
     RefreshGroupList();
     selectedWorksheet = worksheetList.Single(wl => wl.worksheetID == tempSS);
     mustSave = false;
 }
コード例 #5
0
 void quotUndoExecute()
 {
     long tempSS;
     tempSS = selectedWorksheet.worksheetID;
     ServiceWorksheets sw = new ServiceWorksheets();
     //sw = SQLConnection.Execute.ServiceWorksheetsTable.Single(w => w.worksheetID == tempSS);
     if (sw.quotRequested)
     {
         sw.statusID = 2;
     }
     else
     {
         sw.statusID = 1;
     }
     sw.quotAccepted = false;
     sw.inQuotMode = false;
     SQLConnection.Execute.SaveDb();
     RefreshGroupList();
     selectedWorksheet = worksheetList.Single(wl => wl.worksheetID == tempSS);
 }
コード例 #6
0
 void quotCreatedExecute()
 {
     long tempSS;
     tempSS = selectedWorksheet.worksheetID;
     ServiceWorksheets sw = new ServiceWorksheets();
     //sw = SQLConnection.Execute.ServiceWorksheetsTable.Single(w => w.worksheetID == tempSS);
     sw.statusID = 3;
     sw.inQuotMode = true;
     if (sw.serviceCost == null)
     {
         sw.serviceCost = 0;
     }
     SQLConnection.Execute.SaveDb();
     RefreshGroupList();
     selectedWorksheet = worksheetList.Single(wl => wl.worksheetID == tempSS);
 }
コード例 #7
0
        void takeAwayExecute()
        {
            ServiceWorksheets takedAwayWS = new ServiceWorksheets();

            if (selectedWorksheet.worksheetID != 0)
            {
                //takedAwayWS = SQLConnection.Execute.ServiceWorksheetsTable.Single(sws => sws.worksheetID == selectedWorksheet.worksheetID);
                takedAwayWS.serviceEnd = DateTime.Now;
                takedAwayWS.isPaid = true;
                if (takedAwayWS.serviceCost == null)
                {
                    takedAwayWS.serviceCost = 0;
                }

                SQLConnection.Execute.SaveDb();
                new Print.printService(takedAwayWS, Print.servicePrintType.takesAway);
                RefreshServiceList();
            }
        }
コード例 #8
0
        void saveExecute()
        {
            long tempID;
            //string tempComment;
            //tempComment = selectedWorksheet.wsComment;
            tempID = selectedWorksheet.worksheetID;
            ServiceWorksheets sw = new ServiceWorksheets();
            //sw = SQLConnection.Execute.ServiceWorksheetsTable.Single(s => s.worksheetID == tempID);
            sw.comment = comment;
            SQLConnection.Execute.SaveDb();
            RefreshServiceList();

            //selectedWorksheet = SQLConnection.Execute.ServiceSumView.Single(ss => ss.worksheetID == tempID);
            mustSave = false;
        }
コード例 #9
0
        void quotRejectExecute()
        {
            ServiceWorksheets rejectedWS = new ServiceWorksheets();

            //rejectedWS = SQLConnection.Execute.ServiceWorksheetsTable.Single(sws => sws.worksheetID == selectedWorksheet.worksheetID);
            rejectedWS.quotAccepted = false;
            rejectedWS.quotRequested = true;
            //rejectedWS.inQuotMode = false;
            rejectedWS.statusID = 7;

            SQLConnection.Execute.SaveDb();
            RefreshServiceList();
        }
コード例 #10
0
        void quotAcceptExecute()
        {
            ServiceWorksheets acceptedWS = new ServiceWorksheets();
            List<Parts> tempParts = new List<Parts>();
            bool waitForPart = false;

            //acceptedWS = SQLConnection.Execute.ServiceWorksheetsTable.Single(sws => sws.worksheetID == selectedWorksheet.worksheetID);
            acceptedWS.quotAccepted = true;

            //tempParts = SQLConnection.Execute.PartsTable.Where(p => p.serviceID == acceptedWS.worksheetID).ToList();
            foreach (var item in tempParts)
            {
                if (item.mustOrder)
                {
                    waitForPart = true;
                    break;
                }
            }

            if (waitForPart)
            {
                acceptedWS.statusID = 4;
            }
            else
            {
                acceptedWS.statusID = 1;
            }

            SQLConnection.Execute.SaveDb();
            RefreshServiceList();
        }
コード例 #11
0
        void backToServiceExecute()
        {
            ServiceWorksheets sentWS = new ServiceWorksheets();

            //sentWS = SQLConnection.Execute.ServiceWorksheetsTable.Single(sws => sws.worksheetID == selectedWorksheet.worksheetID);
            sentWS.inQuotMode = false;
            sentWS.quotAccepted = false;
            if (sentWS.quotRequested)
            {
                sentWS.statusID = 2;
            }
            else
            {
                sentWS.statusID = 1;
            }

            SQLConnection.Execute.SaveDb();
            RefreshServiceList();
        }
コード例 #12
0
        void addWorksheetExecute()
        {
            if (_customerID != null && denomination != null && denomination != string.Empty)
            {
                ServiceWorksheets newWorksheet = new ServiceWorksheets();
                newWorksheet.customerID = _customerID;
                newWorksheet.serialID = serial;
                newWorksheet.deviceID = IDNumber;
                newWorksheet.deviceManufacturer = manufacturer;
                newWorksheet.deviceName = denomination;
                if (hasWarranty)
                {
                    newWorksheet.hasWarranty = true;
                    newWorksheet.warrantyNumber = warrantyID;
                }
                else
                {
                    newWorksheet.hasWarranty = false;
                    newWorksheet.warrantyNumber = string.Empty;
                }
                newWorksheet.errorTypeID = selectedErrorType.errorTypeID;
                newWorksheet.errorDescription = faultDescription;
                if (requestQuot)
                {
                    newWorksheet.statusID = 2;
                    newWorksheet.quotRequested = true;
                }
                else
                {
                    newWorksheet.statusID = 1;
                    newWorksheet.quotRequested = false;
                }
                newWorksheet.serviceStart = DateTime.Now;
                newWorksheet.isPaid = false;
                newWorksheet.comment = comment;
                newWorksheet.discount = discount / 100;
                newWorksheet.inQuotMode = false;
                newWorksheet.quotAccepted = false;
                newWorksheet.plusParts = plusParts;
                newWorksheet.buyDate = buyDate;
                newWorksheet.warrantyNumber = warrantyID;
                newWorksheet.maxCost = maxCost;
                GetWorksheetIDNumber();
                newWorksheet.yearCounter = yearCnt;

                //SQLConnection.Execute.ServiceWorksheetsTable.AddObject(newWorksheet);
                SQLConnection.Execute.SaveDb();

                new Print.printService(newWorksheet, Print.servicePrintType.bringIn);

                denomination = string.Empty;
                manufacturer = string.Empty;
                IDNumber = string.Empty;
                serial = string.Empty;
                requestQuot = false;
                hasWarranty = false;
                warrantyID = string.Empty;
                buyDate = null;
                faultDescription = string.Empty;
                maxCost = null;
                plusParts = string.Empty;
                comment = string.Empty;

                GetWorksheetIDNumber();
            }
        }
コード例 #13
0
        public NewWorksheetGroup_ViewModel(ref List<ServiceWorksheets> sw)
        {
            if (!this.IsInDesignMode)
            {
                //db = new dbGyorokEntities();
                groupWorksheets = new ObservableCollection<GroupWorksheets>();

                try
                {
                    newWorksheets = sw;

                    ServiceWorksheets swTemp = new ServiceWorksheets();
                    swTemp = sw[0];
                    //customerName = SQLConnection.Execute.CustomersTable.Single(c => c.customerID == swTemp.customerID).customerName;
                    serviceStart = (DateTime)swTemp.serviceStart;
                    foreach (ServiceWorksheets item in sw)
                    {
                        groupWorksheets.Add(new GroupWorksheets());
                        groupWorksheets[groupWorksheets.Count - 1].DeviceName = item.deviceName;
                        groupWorksheets[groupWorksheets.Count - 1].DeviceManufacturer = item.deviceManufacturer;
                        groupWorksheets[groupWorksheets.Count - 1].DeviceID = item.deviceID;
                        groupWorksheets[groupWorksheets.Count - 1].WorksheetIDNumber =  item.yearCounter;
                    }
                }
                catch (Exception)
                {
                }
            }
        }
コード例 #14
0
        void deleteWorksheetExecute()
        {
            ServiceWorksheets delWorksheet = new ServiceWorksheets();

            delWorksheet = newWorksheets.Find(nw => nw.yearCounter == selectedWorksheet.WorksheetIDNumber);
            newWorksheets.Remove(delWorksheet);
            AppMessages.NewWorksheetRemoved.Send(delWorksheet);
            groupWorksheets.Remove(selectedWorksheet);
        }
コード例 #15
0
ファイル: AppMessages.cs プロジェクト: sikisuti/gyorok
 public static void Send(ServiceWorksheets sw)
 {
     Messenger.Default.Send(sw, MessageTypes.newWorksheetRemoved);
 }
コード例 #16
0
        public static WorksheetRepresentation convertWorksheet(ServiceWorksheets worksheet)
        {
            WorksheetRepresentation convertedWorksheet = new WorksheetRepresentation()
            {
                buyDate = worksheet.buyDate,
                comment = worksheet.comment,
                customer = convertCustomer(worksheet.Customers),
                deviceID = worksheet.deviceID,
                deviceManufacturer = worksheet.deviceManufacturer,
                deviceName = worksheet.deviceName,
                discount = worksheet.discount,
                errorType = (ErrorTypeEnum)worksheet.errorTypeID,
                errorDescription = worksheet.errorDescription,
                hasWarranty = worksheet.hasWarranty,
                id = worksheet.worksheetID,
                inQuotMode = worksheet.inQuotMode,
                isPaid = worksheet.isPaid,
                maxCost = worksheet.maxCost,
                parts = new List<PartRepresentation>(),
                plusParts = worksheet.plusParts,
                quotAccepted = worksheet.quotAccepted,
                quotRequested = worksheet.quotRequested,
                serialID = worksheet.serialID,
                serviceCost = worksheet.serviceCost,
                serviceEnd = worksheet.serviceEnd,
                serviceStart = worksheet.serviceStart,
                status = (ServiceStatusEnum)worksheet.statusID,
                warrantyNumber = worksheet.warrantyNumber,
                yearCounter = worksheet.yearCounter
            };

            foreach (Parts part in worksheet.Parts)
            {
                convertedWorksheet.parts.Add(convertPart(part));
            }

            return convertedWorksheet;
        }