public int GetSerialsFromPartDest(string operatorCode, string destination, string part, decimal quantity)
        {
            var dt     = new ObjectParameter("TranDT", typeof(DateTime));
            var result = new ObjectParameter("Result", typeof(int));

            try
            {
                using (var context = new MONITOREntities())
                {
                    context.usp_CreateRma_GetSerialsFromPartDest(operatorCode, destination, part, quantity, dt, result);

                    var query = from s in context.SerialsQuantitiesToAutoRMA_RTV
                                select s;

                    foreach (var item in query)
                    {
                        _serialQuantityDataModel = new SerialQuantityDataModel
                        {
                            Serial   = item.Serial,
                            Quantity = Math.Round(item.Quantity, 2)
                        };
                        SerialsList.Add(_serialQuantityDataModel);
                    }
                }
            }
            catch (Exception ex)
            {
                string error = (ex.InnerException == null) ? ex.Message : ex.InnerException.Message;
                _messages.Message = String.Format("Failed to create serials for part {0}.  Error: {1}", part, error);
                _messages.ShowDialog();
                return(0);
            }
            return(1);
        }
        public void ProcessSerials(string operatorCode, string rmaNumber, int transactionType, string location, string notes, out string error)
        {
            var dt = new ObjectParameter("TranDT", typeof(DateTime));
            var result = new ObjectParameter("Result", typeof(int));
            var rmaRtv = new ObjectParameter("RmaRtvNumber", typeof(int)) {Value = rmaNumber};

            ReturnedRmaRtvNumber = "";
            NewShippersList.Clear();

            error = "";
            try
            {
                using (var context = new MONITOREntities())
                {
                    var query = context.usp_CreateRma_ProcessByDestGl2(operatorCode, rmaRtv, transactionType, location, notes, dt, result);

                    foreach (var item in query)
                    {
                        _newShippersDataModel = new NewShippersDataModel
                        {
                            RmaShipper = (item.RmaShipper == null) ? "" : item.RmaShipper.ToString(),
                            RtvShipper = (item.RtvShipper == null) ? "" : item.RtvShipper.ToString()
                        };
                        NewShippersList.Add(_newShippersDataModel);
                    }

                    ReturnedRmaRtvNumber = rmaRtv.Value.ToString();
                }
            }
            catch (Exception ex)
            {
                string errorMsg = (ex.InnerException == null) ? ex.Message : ex.InnerException.Message;
                error = String.Format("Failed to create RMA.  Error: {0}", errorMsg);
            }
        }
        public List <string> GetDestinations(out string error)
        {
            error = "";

            try
            {
                using (var context = new MONITOREntities())
                {
                    context.vw_CreateRma_Destinations.OrderBy(d => d.destination).Load();
                    if (!context.vw_CreateRma_Destinations.Any())
                    {
                        return(null);
                    }

                    var destsList = context.vw_CreateRma_Destinations.Local.Select(item => item.destination).ToList();
                    destsList.Insert(0, "");
                    return(destsList);
                }
            }
            catch (Exception)
            {
                //error = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message;
                error = "Failed to return destinations list.  Error at GetDestinations().";
            }
            return(null);
        }
        public int ShipRtvHondurasRma(string operatorCode, int rtvShipper, string location)
        {
            var dt     = new ObjectParameter("TranDT", typeof(DateTime));
            var result = new ObjectParameter("Result", typeof(int));

            try
            {
                using (var context = new MONITOREntities())
                {
                    context.usp_ShipRtv(operatorCode, rtvShipper, location, dt, result);
                    if (Convert.ToInt32(result.Value) == 100)
                    {
                        return(1);
                    }

                    _messages.Message = string.Format("Success.  Shipped out RTV {0}.", rtvShipper.ToString());
                    _messages.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                string error = (ex.InnerException == null) ? ex.Message : ex.InnerException.Message;
                _messages.Message = String.Format("Failed to ship out RTV {0}.  Error: {1}", rtvShipper.ToString(),
                                                  error);
                _messages.ShowDialog();
                return(0);
            }
            return(1);
        }
        public void GetRmaRtvDetails(string operatorCode, string rmaRtvNumber, out string error)
        {
            var dt     = new ObjectParameter("TranDT", typeof(DateTime));
            var result = new ObjectParameter("Result", typeof(int));

            error = "";
            try
            {
                ReviewList.Clear();

                using (var context = new MONITOREntities())
                {
                    var results = context.usp_CreatedRmaRtvSummary(operatorCode, rmaRtvNumber, dt, result).ToList();
                    foreach (var item in results)
                    {
                        _reviewRmaRtvDataModel = new ReviewRmaRtvDataModel
                        {
                            ShipperType   = item.ShipperType,
                            Shipper       = item.Shipper,
                            Part          = item.Part,
                            GlSegment     = item.GlSegment,
                            TotalSerials  = item.TotalSerials,
                            TotalQuantity = item.TotalQuantity
                        };
                        ReviewList.Add(_reviewRmaRtvDataModel);
                    }
                }
            }
            catch (Exception ex)
            {
                error = (ex.InnerException == null) ? ex.Message : ex.InnerException.Message;
            }
        }
Example #6
0
 public ApHeaderBarcodesModelView()
 {
     _context             = new MONITOREntities();
     ApHeaderBarcodesList = new List <ApHeaderBarcode>();
     VendorsList          = new List <String>();
     FlagsList            = new List <String>();
     InvoicesList         = new List <String>();
 }
Example #7
0
 private void RTVPackingSlip_Load(object sender, EventArgs e)
 {
     using (var context = new MONITOREntities())
     {
         var PackingSlip = context.RTV_PackingSlip.Where(rtv => rtv.RTVShipperID == RTVShipperID).ToList();
         createRmaRTVPackingSlipBindingSource.DataSource = PackingSlip;
     }
     reportViewer1.RefreshReport();
 }
Example #8
0
 public void InsertHistoricalSales(string forecastName, DateTime dateTimeStamp, DateTime startDate, DateTime endDate, out string error)
 {
     error = "";
     try
     {
         using (var context = new MONITOREntities())
         {
             context.acctg_sales_sp_insert_historical_sales(forecastName, dateTimeStamp, startDate, endDate);
         }
     }
     catch (Exception ex)
     {
         error = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message;
     }
 }
Example #9
0
        public void InsertOfficialForecast(string forecastName, DateTime dateTimeStamp, out string error)
        {
            error = "";
            try
            {
                using (var context = new MONITOREntities())
                {
                    ((IObjectContextAdapter)context).ObjectContext.CommandTimeout = 1200;

                    context.acctg_sales_sp_insert_official_forecast(forecastName, dateTimeStamp);
                }
            }
            catch (Exception ex)
            {
                error = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message;
            }
        }
        public void GetRmaRtvHistory(string operatorCode, string rmaRtvNumber, out string error)
        {
            var dt     = new ObjectParameter("TranDT", typeof(DateTime));
            var result = new ObjectParameter("Result", typeof(int));

            error = "";
            try
            {
                DetailsList.Clear();

                using (var context = new MONITOREntities())
                {
                    var query = context.usp_CreatedRmaRtvHistory(operatorCode, rmaRtvNumber, dt, result).ToList();

                    if (!query.Any())
                    {
                        error = string.Format("{0} was not found.", rmaRtvNumber);
                        return;
                    }

                    foreach (var item in query)
                    {
                        _rmaRtvHistoryDataModel = new RmaRtvHistoryDataModel
                        {
                            Type           = item.ShipperType,
                            Shipper        = item.Shipper,
                            Serial         = item.Serial,
                            Part           = item.Part,
                            GlSegment      = item.GlSegment,
                            Quantity       = item.Quantity,
                            AuditTrailDate = item.AuditTrailDate,
                            FromLocation   = item.FromLoc,
                            ToLocation     = item.ToLoc
                        };
                        DetailsList.Add(_rmaRtvHistoryDataModel);
                    }
                }
            }
            catch (Exception ex)
            {
                error = (ex.InnerException == null)
                    ? "Failed to return History.  Error: " + ex.Message
                    : "Failed to return History.  Error: " + ex.InnerException.Message;
            }
        }
        public void GetRmaRtvHistoryByDateRange(string operatorCode, DateTime startDate, DateTime endDate, out string error)
        {
            var dt     = new ObjectParameter("TranDT", typeof(DateTime));
            var result = new ObjectParameter("Result", typeof(int));

            error = "";
            try
            {
                DetailsByDatesList.Clear();

                using (var context = new MONITOREntities())
                {
                    var query = context.usp_CreatedRmaRtvHistoryByDates(operatorCode, startDate, endDate, dt, result).ToList();

                    if (!query.Any())
                    {
                        error = "No RMA / RTV records were found within this date range.";
                        return;
                    }

                    foreach (var item in query)
                    {
                        _rmaRtvHistoryByDatesDataModel = new RmaRtvHistoryByDatesDataModel
                        {
                            Type           = item.ShipperType,
                            Shipper        = item.Shipper,
                            Serial         = item.Serial,
                            Part           = item.Part,
                            GlSegment      = item.GlSegment,
                            Quantity       = item.Quantity,
                            AuditTrailDate = item.AuditTrailDate,
                            FromLocation   = item.FromLoc,
                            ToLocation     = item.ToLoc
                        };
                        DetailsByDatesList.Add(_rmaRtvHistoryByDatesDataModel);
                    }
                }
            }
            catch (Exception ex)
            {
                error = (ex.InnerException == null)
                    ? "Failed to return History.  Error: " + ex.Message
                    : "Failed to return History.  Error: " + ex.InnerException.Message;
            }
        }
        public string GetLabelCode(int serial, out string error)
        {
            var labelCode = new ObjectParameter("LabelCode", typeof(string));

            error = "";
            try
            {
                using (var context = new MONITOREntities())
                {
                    context.usp_GetLabelCode_RmaMaintenance(serial, labelCode);
                }
            }
            catch (Exception ex)
            {
                error = (ex.InnerException == null) ? ex.Message : ex.InnerException.Message;
            }
            return(labelCode.Value.ToString());
        }
        public void RecordHondurasRmaException(string opCode, string exception, out string error)
        {
            var dt     = new ObjectParameter("TranDT", typeof(DateTime));
            var result = new ObjectParameter("Result", typeof(int));

            error = "";
            try
            {
                using (var context = new MONITOREntities())
                {
                    context.usp_CreateRma_Honduras_RecordException(opCode, exception, dt, result);
                }
            }
            catch (Exception ex)
            {
                error = (ex.InnerException == null) ? ex.Message : ex.InnerException.Message;
            }
        }
        public void DeleteOldSerialsQuantities(string operatorCode, out string error)
        {
            var dt     = new ObjectParameter("TranDT", typeof(DateTime));
            var result = new ObjectParameter("Result", typeof(int));

            error = "";
            try
            {
                using (var context = new MONITOREntities())
                {
                    context.usp_CreateRma_DeleteSerialsQuantitiesByOperator(operatorCode, dt, result);
                }
            }
            catch (Exception ex)
            {
                error = (ex.InnerException == null) ? ex.Message : ex.InnerException.Message;
            }
        }
Example #15
0
        public void RollEmpireForecast(string priorRelease, string currentRelease, out string error)
        {
            var dt  = new ObjectParameter("TranDT", typeof(DateTime));
            var res = new ObjectParameter("Result", typeof(Int32));

            error = "";
            try
            {
                using (var context = new MONITOREntities())
                {
                    context.acctg_csm_sp_roll_forward_EmpireForecast_data_one_year_fall_off(priorRelease, currentRelease, dt, res);
                }
            }
            catch (Exception ex)
            {
                error = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message;
            }
        }
Example #16
0
        public void SendEmail(string opCode, string rmaRtvNumber, out string error)
        {
            var dt = new ObjectParameter("TranDT", typeof(DateTime));
            var result = new ObjectParameter("Result", typeof(int));

            error = "";
            try
            {
                using (var context = new MONITOREntities())
                {
                    context.usp_CreatedRmaEmail(opCode, rmaRtvNumber, dt, result);
                }
            }
            catch (Exception ex)
            {
                error = (ex.InnerException == null) ? ex.Message : ex.InnerException.Message;
            }
        }
        public void ImportDataIntoSql(string operatorCode, int serial, decimal quantity, out string error)
        {
            var dt     = new ObjectParameter("TranDT", typeof(DateTime));
            var result = new ObjectParameter("Result", typeof(int));

            error = "";
            try
            {
                using (var context = new MONITOREntities())
                {
                    context.usp_CreateRma_ImportSerialsQuantitiesByOperator(operatorCode, serial, quantity, dt, result);
                }
            }
            catch (Exception ex)
            {
                string errorMsg = (ex.InnerException == null) ? ex.Message : ex.InnerException.Message;
                error = String.Format("Nothing has been processed.  {0}", errorMsg);
            }
        }
        public void DeleteOldSerialsQuantities(string operatorCode, out string error)
        {
            var dt     = new ObjectParameter("TranDT", typeof(DateTime));
            var result = new ObjectParameter("Result", typeof(int));

            error = "";
            try
            {
                using (var context = new MONITOREntities())
                {
                    context.usp_CreateRma_DeleteSerialsQuantitiesByOperator(operatorCode, dt, result);
                }
            }
            catch (Exception ex)
            {
                string errorMsg = (ex.InnerException == null) ? ex.Message : ex.InnerException.Message;
                error = String.Format("Failed to delete old RMA serials.  Nothing was processed.  Error: {0}", errorMsg);
            }
        }
Example #19
0
        public void ImportNa(string currentRelease, out string error)
        {
            var dt  = new ObjectParameter("TranDT", typeof(DateTime));
            var res = new ObjectParameter("Result", typeof(Int32));

            error = "";

            try
            {
                using (var context = new MONITOREntities())
                {
                    ((IObjectContextAdapter)context).ObjectContext.CommandTimeout = 1200;
                    context.acctg_csm_sp_import_NA(_operatorCode, currentRelease, dt, res);
                }
            }
            catch (Exception ex)
            {
                error = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message;
            }
        }
Example #20
0
        public void Import(string currentRelease, out string error)
        {
            var          dt      = new ObjectParameter("TranDT", typeof(DateTime));
            var          res     = new ObjectParameter("Result", typeof(Int32));
            const string VERSION = "CSM";

            error = "";

            try
            {
                using (var context = new MONITOREntities())
                {
                    context.acctg_csm_sp_import_CSM_demand(currentRelease, VERSION, dt, res);
                }
            }
            catch (Exception ex)
            {
                error = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message;
            }
        }
        public int ImportDataIntoSql(int serial, decimal quantity)
        {
            var dt     = new ObjectParameter("TranDT", typeof(DateTime));
            var result = new ObjectParameter("Result", typeof(int));

            try
            {
                using (var context = new MONITOREntities())
                {
                    context.usp_CreateRma_ImportSerialsQuantities(serial, quantity, dt, result);
                }
            }
            catch (Exception ex)
            {
                string error = (ex.InnerException == null) ? ex.Message : ex.InnerException.Message;
                _messages.Message = String.Format("Failed to insert serial {0} into the database.  Nothing was processed.  Error: {1}", serial, error);
                _messages.ShowDialog();
                return(0);
            }
            return(1);
        }
Example #22
0
        public void ProcessSerialsRtvOnly(string operatorCode, out string error)
        {
            var dt = new ObjectParameter("TranDT", typeof(DateTime));
            var result = new ObjectParameter("Result", typeof(int));
            var rtv = new ObjectParameter("RtvNumber", typeof(int));
            var firstNewRtvShipper = new ObjectParameter("FirstNewRTVShipper", typeof (int));
            var rtvShipperCount = new ObjectParameter("RTVShipperCount", typeof (int));
            var rtvShipperList = new ObjectParameter("RtvShipperList", typeof(string));

            ReturnedRmaRtvNumber = "";
            NewShippersList.Clear();

            error = "";
            try
            {
                using (var context = new MONITOREntities())
                {
                    context.usp_CreateRTV_ImportSerials(operatorCode, firstNewRtvShipper, rtvShipperCount, rtvShipperList, rtv, dt, result);

                    List<string> stringList = rtvShipperList.Value.ToString().Split(',').ToList();

                    foreach (var item in stringList)
                    {
                        _newShippersDataModel = new NewShippersDataModel
                            {
                                RmaShipper = "",
                                RtvShipper = item
                            };
                        NewShippersList.Add(_newShippersDataModel);
                    }

                    ReturnedRmaRtvNumber = rtv.Value.ToString();
                }
            }
            catch (Exception ex)
            {
                string errorMsg = (ex.InnerException == null) ? ex.Message : ex.InnerException.Message;
                error = String.Format("Failed to create RTV.  Error: {0}", errorMsg);
            }
        }
        private int ProcessData()
        {
            var dt     = new ObjectParameter("TranDT", typeof(DateTime));
            var result = new ObjectParameter("Result", typeof(int));

            try
            {
                using (var context = new MONITOREntities())
                {
                    context.usp_Variance_InsertPfsFromRaw(_operatorCode, dt, result);
                }
            }
            catch (Exception ex)
            {
                string errorMsg = (ex.InnerException == null) ? ex.Message : ex.InnerException.Message;
                string error    = String.Format("Failed to process the imported raw data.  Exception at ProcessData().  Error: {0}", errorMsg);
                _messageBox.Message = error;
                _messageBox.ShowDialog();
                return(0);
            }
            return(1);
        }
        public int ProcessData(string operatorCode, string rmaNumber, int createRtvShipper, int placeSerialsOnHold, string note)
        {
            var dt     = new ObjectParameter("TranDT", typeof(DateTime));
            var result = new ObjectParameter("Result", typeof(int));

            try
            {
                using (var context = new MONITOREntities())
                {
                    var query = context.usp_CreateRma_ProcessByDestGl(operatorCode, rmaNumber, createRtvShipper, placeSerialsOnHold, note, dt, result);

                    foreach (var item in query)
                    {
                        _newShippersDataModel = new NewShippersDataModel
                        {
                            RmaShipper = (item.RmaShipper == null) ? "" : item.RmaShipper.ToString(),
                            RtvShipper = (item.RtvShipper == null) ? "" : item.RtvShipper.ToString()
                        };

                        NewShippersList.Add(_newShippersDataModel);
                    }

                    string resultMessage = (createRtvShipper == 1)
                                               ? "Success.  Highlight a row to ship a RTV or to transfer serials."
                                               : "Success.";

                    _messages.Message = resultMessage;
                    _messages.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                string error = (ex.InnerException == null) ? ex.Message : ex.InnerException.Message;
                _messages.Message = String.Format("Failed to create RMA.  Error: {0}", error);
                _messages.ShowDialog();
                return(0);
            }
            return(1);
        }
        public List <string> GetShipperSerials(int shipper, out string error)
        {
            List <string> serialsList = new List <string>();

            error = "";
            try
            {
                using (var context = new MONITOREntities())
                {
                    var query = context.usp_GetLabelCode_RmaMaintenance_Serials(shipper);
                    foreach (var item in query)
                    {
                        serialsList.Add(item.Serial.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                error = (ex.InnerException == null) ? ex.Message : ex.InnerException.Message;
            }
            return(serialsList);
        }
Example #26
0
        public void CheckDateColumns(string currentRelease, out string message, out string error)
        {
            var returnMessage = new ObjectParameter("Message", typeof(String));
            var dt            = new ObjectParameter("TranDT", typeof(DateTime));
            var res           = new ObjectParameter("Result", typeof(Int32));

            error = message = "";

            try
            {
                using (var context = new MONITOREntities())
                {
                    context.acctg_csm_sp_check_datecolumns(_operatorCode, currentRelease, returnMessage, dt, res);

                    message = returnMessage.Value.ToString();
                }
            }
            catch (Exception ex)
            {
                error = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message;
            }
        }
        public void GetSerialsFromPartDest(string operatorCode, string destination, string part, decimal quantity, out string error)
        {
            var dt     = new ObjectParameter("TranDT", typeof(DateTime));
            var result = new ObjectParameter("Result", typeof(int));

            error = "";
            try
            {
                using (var context = new MONITOREntities())
                {
                    context.usp_CreateRma_GetSerialsFromPartDest(operatorCode, destination, part, quantity, dt, result);

                    var query = from s in context.SerialsQuantitiesToAutoRMA_RTV
                                where s.OperatorCode == operatorCode
                                select s;

                    foreach (var item in query)
                    {
                        _serialQuantityDataModel = new SerialQuantityDataModel
                        {
                            Serial   = item.Serial,
                            Quantity = Math.Round(item.Quantity, 2)
                        };

                        // Querying the SerialsQuantitiesToAutoRMA_RTV table every time will duplicate List items,
                        //   so only add an item if it isn't already in the List.
                        if (!SerialsList.Any(x => x.Serial == item.Serial))
                        {
                            SerialsList.Add(_serialQuantityDataModel);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string errorMsg = (ex.InnerException == null) ? ex.Message : ex.InnerException.Message;
                error = String.Format("Failed to create serials for part {0}.  Error: {1}", part, errorMsg);
            }
        }
        public int TransferRmaSerials(string operatorCode, int rmaShipper, string location)
        {
            var    dt     = new ObjectParameter("TranDT", typeof(DateTime));
            var    result = new ObjectParameter("Result", typeof(int));
            string error  = "";

            try
            {
                using (var context = new MONITOREntities())
                {
                    context.usp_CreateRma_TransferOnHoldSerials(operatorCode, rmaShipper, location, dt, result);
                    _messages.Message = "Success.";
                    _messages.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                error             = (ex.InnerException == null) ? ex.Message : ex.InnerException.Message;
                _messages.Message = String.Format("Failed to transfer RMA serials.  Error: {0}", error);
                _messages.ShowDialog();
            }
            return((error == "") ? 1 : 0);
        }
Example #29
0
        private void ValidateOperator(string user, string password)
        {
            var dt     = new ObjectParameter("TranDT", typeof(DateTime));
            var result = new ObjectParameter("Result", typeof(int));

            try
            {
                using (var context = new MONITOREntities())
                {
                    context.usp_Variance_ValidateOperator(user, password, dt, result);
                }
            }
            catch (Exception ex)
            {
                lblErrorMessage.Text = (ex.InnerException == null) ? ex.Message : ex.InnerException.Message;;
                return;
            }

            _operatorCode             = user;
            lblErrorMessage.Text      = "";
            pnlLogin.Visible          = false;
            mesBtnFedExImport.Enabled = mesBtnImportChRobinson.Enabled = mesBtnPfSolutions.Enabled = mesBtnUpsImport.Enabled = true;
        }
Example #30
0
        public void ValidateOperator(string enteredOperatorCode, out string operatorName, out string error)
        {
            var returnName = new ObjectParameter("OperatorName", typeof(String));
            var dt         = new ObjectParameter("TranDT", typeof(DateTime));
            var res        = new ObjectParameter("Result", typeof(Int32));

            error = operatorName = "";

            try
            {
                using (var context = new MONITOREntities())
                {
                    context.acctg_csm_sp_validate_operator(enteredOperatorCode, returnName, dt, res);

                    operatorName  = returnName.Value.ToString();
                    _operatorCode = enteredOperatorCode;
                }
            }
            catch (Exception ex)
            {
                error = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message;
            }
        }