Пример #1
0
        /// <summary>
        /// Creates a new instance of the sol_Messages class and populates it with data from the specified SqlDataReader.
        /// </summary>
        protected virtual Sol_Message MakeSol_Message(SqlDataReader dataReader)
        {
            Sol_Message sol_Message = new Sol_Message();

            sol_Message.MessageID   = SqlClientUtility.GetInt32(dataReader, "MessageID", 0);
            sol_Message.Name        = SqlClientUtility.GetString(dataReader, "Name", String.Empty);
            sol_Message.Description = SqlClientUtility.GetString(dataReader, "Description", String.Empty);

            return(sol_Message);
        }
Пример #2
0
        /// <summary>
        /// Saves a record to the sol_Messages table.
        /// </summary>
        public virtual void Insert(Sol_Message sol_Message)
        {
            ValidationUtility.ValidateArgument("sol_Message", sol_Message);

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@Name", sol_Message.Name),
                new SqlParameter("@Description", sol_Message.Description)
            };

            sol_Message.MessageID = (int)SqlClientUtility.ExecuteScalar(connectionStringName, CommandType.StoredProcedure, "sol_Messages_Insert", parameters);
        }
Пример #3
0
        /// <summary>
        /// Updates a record in the sol_Messages table.
        /// </summary>
        public virtual void Update(Sol_Message sol_Message)
        {
            ValidationUtility.ValidateArgument("sol_Message", sol_Message);

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@MessageID", sol_Message.MessageID),
                new SqlParameter("@Name", sol_Message.Name),
                new SqlParameter("@Description", sol_Message.Description)
            };

            SqlClientUtility.ExecuteNonQuery(connectionStringName, CommandType.StoredProcedure, "sol_Messages_Update", parameters);
        }
Пример #4
0
        /// <summary>
        /// Selects all records from the sol_Messages table.
        /// </summary>
        public virtual List <Sol_Message> SelectAll()
        {
            using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader(connectionStringName, CommandType.StoredProcedure, "sol_Messages_SelectAll"))
            {
                List <Sol_Message> sol_MessageList = new List <Sol_Message>();
                while (dataReader.Read())
                {
                    Sol_Message sol_Message = MakeSol_Message(dataReader);
                    sol_MessageList.Add(sol_Message);
                }

                return(sol_MessageList);
            }
        }
Пример #5
0
        public static bool PrintReceipt(
            ListView listView1
            , string printParam
            , ref string errorMessage
            , int barcodeEncoding
            , string buttonSource
            , string securityCode
            , decimal totalSelectedOrders
            )
        {
            errorMessage = string.Empty;
            try
            {
                //query
                string query =
                    " SELECT " +
                    " sol_OrdersDetail.CategoryID, sol_OrdersDetail.Description, " +
                    " sol_Orders.OrderID, sol_Orders.OrderType, sol_Orders.ComputerName, sol_Orders.Date, ISNULL(c.Name, '') as Name,  sol_Orders.TotalAmount,  sol_Orders.FeeAmount, " +
                    " sol_Fees.FeeDescription, " +
                    "SUM(sol_OrdersDetail.Quantity) AS TotalQuantity, sol_OrdersDetail.Price, SUM(sol_OrdersDetail.Amount) as TotalAmountDetail, " +
                    //"ISNULL(c.Name, '') as Name, " +
                    " u.UserName, " +
                    "sol_Orders.Comments " +
                    "FROM    " +
                    " sol_Orders sol_Orders  " +
                    "LEFT JOIN  sol_Customers as c ON c.[CustomerID] = sol_Orders.[CustomerID] " +
                    "AND sol_Orders.[CustomerID] != 0 " +
                    " INNER JOIN sol_OrdersDetail sol_OrdersDetail  ON (sol_Orders.OrderID = sol_OrdersDetail.OrderID)  " +
                    " INNER JOIN sol_Fees sol_Fees ON (sol_Orders.FeeID = sol_Fees.FeeID) " +
                    " INNER JOIN Sol_Categories Sol_Categories ON (sol_OrdersDetail.CategoryID = Sol_Categories.CategoryID) " +
                    " INNER JOIN Solum.Dbo.aspnet_Users u ON (sol_Orders.UserId = u.UserId) " +
                    "WHERE  ";

                string strBarCode = String.Empty;

                //select orders
                bool flagFirstTime = true;
                ListView.ListViewItemCollection Items = listView1.Items;
                foreach (ListViewItem item in Items)
                {
                    string c       = item.SubItems[0].Text.Trim();
                    int    orderId = 0;
                    try
                    {
                        orderId = Int32.Parse(c);
                    }
                    catch
                    {
                        continue;
                    }

                    c = " OR (sol_Orders.OrderType = '" + item.SubItems[4].Text.Trim() + "' AND  " +
                        "sol_Orders.OrderID =  " + orderId.ToString() + ") ";

                    //if(string.IsNullOrEmpty(strBarCode))
                    strBarCode = orderId.ToString("0000000");
                    //else
                    //    strBarCode = strBarCode + orderId.ToString("0000000") + " ";

                    if (flagFirstTime)
                    {
                        c             = c.Replace("OR", "");
                        flagFirstTime = false;
                    }
                    query += c;
                }

                query +=
                    "GROUP by sol_OrdersDetail.CategoryID, sol_OrdersDetail.Description,  " +
                    "sol_Orders.OrderID, sol_Orders.OrderType, sol_Orders.ComputerName, sol_Orders.Date, c.Name,  sol_Orders.TotalAmount,  sol_Orders.FeeAmount, " +
                    "sol_Fees.FeeDescription, " +
                    "sol_OrdersDetail.Price, u.UserName, " +
                    "sol_Orders.Comments " +
                    "ORDER BY sol_OrdersDetail.Description ";

                //query 2
                string query2         = "";
                string subReportName2 = "";

                //query 3
                string query3         = "";
                string subReportName3 = "";


                //receipt message
                Sol_Message    sol_Message    = new Sol_Message();
                Sol_Message_Sp sol_Message_Sp = new Sol_Message_Sp(Properties.Settings.Default.WsirDbConnectionString);
                sol_Message = sol_Message_Sp.Select(Main.Sol_ControlInfo.ReceiptMessageID);

                CrystalDecisions.CrystalReports.Engine.ReportDocument rp = new Solum.Reports.Receipt2();

                string imagePath     = String.Empty;
                string imagePath2    = String.Empty;
                bool   printComplete = false;

                //0 = Quick Cash Out 1 = Print Chit
                if (printParam.ToLower() == "paynow")
                {
                    printComplete = true;
                }
                else if (Main.Sol_ControlInfo.ReturnButtonExtra == 0 || buttonSource == "Cashier")
                {
                    printComplete = true;
                }
                else
                {
                    //0 = complete 1 = order number only
                    if (Main.Sol_ControlInfo.ChitTicketComplete == 0)
                    {
                        printComplete = true;
                    }

                    if (Main.Sol_ControlInfo.ChitTicketIncludeBarcode)
                    {
                        if (Main.Sol_ControlInfo.IncludeSecurityCode)
                        {
                            strBarCode = strBarCode + Main.SecurityCodeSeparator + securityCode;
                        }

                        //MessageBox.Show(string.Format("barcode = {0} length = {1}", strBarCode, strBarCode.Length));
                        //try
                        //{
                        //    System.IO.File.Delete(Main.temFolder + "\\barCode.bmp");
                        //}
                        //catch { }

                        //generate barcode
                        imagePath    = Main.temFolder + "\\barCode.bmp"; //Barcodes\\
                        errorMessage = string.Empty;
                        SolFunctions.GenerateBarcode(
                            Properties.Settings.Default.BarcodeEncoding
                            , Properties.Settings.Default.BarcodeWidth
                            , Properties.Settings.Default.BarcodeHeight
                            , BarcodeLib.AlignmentPositions.LEFT
                            , System.Drawing.RotateFlipType.RotateNoneFlipNone
                            , BarcodeLib.LabelPositions.BOTTOMLEFT
                            , strBarCode
                            , imagePath
                            , BarcodeLib.SaveTypes.BMP
                            , null
                            , ref errorMessage
                            );
                    }
                }

                if (Main.Sol_ControlInfo.ReceiptAmountBarcode)
                {
                    //generate barcode
                    imagePath2   = Main.temFolder + "\\barCodeAmount.bmp"; //Barcodes\\
                    errorMessage = string.Empty;
                    SolFunctions.GenerateBarcode(
                        Properties.Settings.Default.BarcodeEncoding
                        , Properties.Settings.Default.BarcodeWidth
                        , Properties.Settings.Default.BarcodeHeight
                        , BarcodeLib.AlignmentPositions.LEFT
                        , System.Drawing.RotateFlipType.RotateNoneFlipNone
                        , BarcodeLib.LabelPositions.BOTTOMLEFT
                        , totalSelectedOrders.ToString()
                        , imagePath2
                        , BarcodeLib.SaveTypes.BMP
                        , null
                        , ref errorMessage
                        );
                }

                object[,] parametros = new object[, ] {
                    { "1_BusinessName", Main.Sol_ControlInfo.BusinessName },
                    { "2_StoreNumber", Main.Sol_ControlInfo.StoreNumber.ToString() },
                    { "3_Address", Main.Sol_ControlInfo.Address },
                    { "4_City", Main.Sol_ControlInfo.City },
                    { "5_State", Main.Sol_ControlInfo.State },
                    { "6_PhoneNumber", Main.Sol_ControlInfo.PhoneNumber },
                    { "7_Message", sol_Message.Description },
                    { "8_Print", printParam },
                    { "9_PrintComplete", printComplete },
                    { "imagenPath", imagePath },
                    { "email", Main.Sol_ControlInfo.EmailAccount },
                    { "imagenPath2", imagePath2 },
                    { "", "" }
                };

                bool  imprimirReporte = false;
                bool  exportarReporte = false;
                short fileFormat      = 0;          // 0 = rtf 1 = pdf 2 = word 3 = excel
                bool  preverReporte   = false;
                short numeroDeCopias  = 1;
                if (Properties.Settings.Default.SettingsWsReceiptPrintPreview)
                {
                    preverReporte = true;
                }
                else
                {
                    imprimirReporte = true;
                }

                ReportesPrevista f1 = new ReportesPrevista(
                    Properties.Settings.Default.WsirDbConnectionString,
                    Properties.Settings.Default.SQLServidorNombre,
                    Properties.Settings.Default.SQLBaseDeDatos,
                    Properties.Settings.Default.SQLAutentificacion,
                    Properties.Settings.Default.SQLUsuarioNombre,
                    Properties.Settings.Default.SQLUsuarioClave,
                    rp,
                    query,
                    query2,
                    query3,
                    parametros,
                    subReportName2,
                    subReportName3,
                    Properties.Settings.Default.SettingsWsReceiptPrinter.Trim(),
                    fileFormat,
                    String.Empty,
                    numeroDeCopias,
                    exportarReporte,
                    imprimirReporte,
                    preverReporte,
                    null,
                    String.Empty,
                    true,
                    true
                    );

                f1.ShowDialog();
                f1.Dispose();
                f1 = null;
            }
            catch (Exception ex)
            {
                errorMessage = ex.Message;
                return(false);
            }

            return(true);
        }