/// <summary>
        /// Get Installed Date
        /// </summary>
        /// <param name="security">Security</param>
        public void GetInstallDate(ref Security security)
        {
            var dateStart = DateTime.Now;

            Performancelog.Debug($"Start,LoginManager,GetInstallDate,{string.Empty},{DateTime.Now:hh.mm.ss.ffffff}");
            var dl = "";

            var strRenamed = security.Install_Date_Encrypt;

            if (strRenamed.Length >= 60)
            {
                short i;
                for (i = 21; i <= 40; i += 2)
                {
                    dl = dl + Convert.ToString(Strings.Chr((int)(Conversion.Val(strRenamed.Substring(i - 1, 2)) - 7)));
                }

                strRenamed            = DateAndTime.Month(DateTime.Parse(dl)).ToString("00") + "/" + DateAndTime.Day(DateTime.Parse(dl)).ToString("00") + "/" + DateAndTime.Year(DateTime.Parse(dl)).ToString("0000");
                security.Install_Date = DateTime.Parse(strRenamed);
                //        Me.Install_Date = Format(DL, "mm/dd/yyyy")
            }
            else
            {
                security.Install_Date = Convert.ToDateTime(DateTime.FromOADate(0));
            }
            Performancelog.Debug($"End,LoginManager,GetInstallDate,{DateTime.Now.Subtract(dateStart).TotalMilliseconds},{DateTime.Now:hh.mm.ss.ffffff}");
        }
Example #2
0
        private void lblFechVtoCAE_TextChanged(object sender, System.EventArgs e)
        {
            string Dia = null;
            string Mes = null;
            string Ano = null;

            Ano = DateAndTime.Year(Convert.ToDateTime(lblFechVtoCAE.Text));
            if (Convert.ToInt32(DateAndTime.Month(Convert.ToDateTime(lblFechVtoCAE.Text))) < 10)
            {
                Mes = "0" + DateAndTime.Month(Convert.ToDateTime(lblFechVtoCAE.Text));
            }
            else
            {
                Mes = DateAndTime.Month(Convert.ToDateTime(lblFechVtoCAE.Text));
            }

            if (Convert.ToInt32(DateAndTime.Day(Convert.ToDateTime(lblFechVtoCAE.Text))) < 10)
            {
                Dia = "0" + DateAndTime.Day(Convert.ToDateTime(lblFechVtoCAE.Text));
            }
            else
            {
                Dia = DateAndTime.Day(Convert.ToDateTime(lblFechVtoCAE.Text));
            }

            txtCodBarNum.Text = Interaction.GetSetting("Programa", "EMPRESA", "CUIT", Convert.ToString(1)) + lblCod_cbe.Text + cmbSucursal.Text + lblCAE.Text + Ano + Mes + Dia + Cod_Verificador.CodVerificador(ref Interaction.GetSetting("Programa", "EMPRESA", "CUIT", Convert.ToString(1)) + lblCod_cbe.Text + cmbSucursal.Text + lblCAE.Text + Ano + Mes + Dia);
        }
Example #3
0
        public string Return_EncryptDate(DateTime DT)
        {
            string returnValue = "";
            string str_Renamed = "";
            short  i           = 0;
            string DL          = "";

            //    str = Format(DT, "mm/dd/yyyy")
            ///changed by nancy
            str_Renamed = DateAndTime.Month(DT).ToString("00") + "/" +
                          DateAndTime.Day(DT).ToString("00") + "/" +
                          DateAndTime.Year(DT).ToString("0000");

            for (i = 1; i <= 10; i++)
            {
                DL = DL + System.Convert.ToString(Strings.Asc(str_Renamed.Substring(i - 1, 1)) + 7);
            }

            for (i = 1; i <= 10; i++)
            {
                VBMath.Randomize();
                DL = (VBMath.Rnd() * VBMath.Rnd() * i * 5).ToString("00") + DL;
            }

            for (i = 1; i <= 10; i++)
            {
                VBMath.Randomize();
                DL = DL + (VBMath.Rnd() * VBMath.Rnd() * i * 5).ToString("00"); //Format(Rnd() + i * i + (i * Rnd()) / i, "00")
            }

            returnValue = DL;

            return(returnValue);
        }
Example #4
0
        public static object Month(object date)
        {
#if !NETSTANDARD
            return(DateAndTime.Month(Convert.ToDateTime(date)));
#else
            return(Convert.ToDateTime(date).Month);
#endif
        }
//UPGRADE_NOTE: Argument type has been changed to Object. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="D0BD8832-D1AC-487C-8AA5-B36F9284E51E"'
        public bool ShowSave(object cmdlg, DatabaseExportEnum ExportMode, ref string DialogTitle = "Export Recordset to...")
        {
            bool   functionReturnValue = false;
            string t_Day     = null;
            string t_Month   = null;
            string st_Name   = null;
            string Extention = null;

            t_Day   = Strings.Trim(Convert.ToString(DateAndTime.Day(DateAndTime.Today)));
            t_Month = Strings.Trim(Convert.ToString(DateAndTime.Month(DateAndTime.Today)));

            if (Strings.Len(t_Day) == 1)
            {
                t_Day = "0" + Strings.Trim(Convert.ToString(DateAndTime.Day(DateAndTime.Today)));
            }
            if (Strings.Len(t_Month) == 1)
            {
                t_Month = "0" + Strings.Trim(Convert.ToString(DateAndTime.Month(DateAndTime.Today)));
            }

            st_Name = "PasteExport" + Strings.Trim(Convert.ToString(DateAndTime.Year(DateAndTime.Today))) + Strings.Trim(t_Month) + Strings.Trim(t_Day);

            if (ExportMode == DatabaseExportEnum.CSV)
            {
                Extention = "Comma Separated Values (*.csv)|*.csv|Text Files (*.txt)|*.txt|";
            }

            // ERROR: Not supported in C#: OnErrorStatement


            var _with2 = cmdlg;

            //UPGRADE_WARNING: Couldn't resolve default property of object cmdlg.CancelError. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            _with2.CancelError = true;
            //UPGRADE_WARNING: Couldn't resolve default property of object cmdlg.DialogTitle. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            _with2.DialogTitle = DialogTitle;
            //UPGRADE_WARNING: Couldn't resolve default property of object cmdlg.FileName. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            _with2.FileName = st_Name;
            //UPGRADE_WARNING: Couldn't resolve default property of object cmdlg.filter. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            _with2.filter = Extention;
            //UPGRADE_WARNING: Couldn't resolve default property of object cmdlg.FilterIndex. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            _with2.FilterIndex = 0;
            //UPGRADE_WARNING: Couldn't resolve default property of object cmdlg.ShowSave. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            _with2.ShowSave();
            //UPGRADE_WARNING: Couldn't resolve default property of object cmdlg.FileName. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            ExportFilePath = _with2.FileName;

            if (!string.IsNullOrEmpty(ExportFilePath))
            {
                functionReturnValue = true;
            }
Extracter:
            return(functionReturnValue);
        }
Example #6
0
        public void Fields()
        {
            var now      = DateTime.UtcNow;
            var calendar = System.Threading.Thread.CurrentThread.CurrentCulture.Calendar;

            Assert.Equal(calendar.GetYear(now), DateAndTime.Year(now));
            Assert.Equal(calendar.GetMonth(now), DateAndTime.Month(now));
            Assert.Equal(calendar.GetDayOfMonth(now), DateAndTime.Day(now));
            Assert.Equal(calendar.GetHour(now), DateAndTime.Hour(now));
            Assert.Equal(calendar.GetMinute(now), DateAndTime.Minute(now));
            Assert.Equal(calendar.GetSecond(now), DateAndTime.Second(now));
        }
        private void cmdStart_Click(System.Object eventSender, System.EventArgs eventArgs)
        {
            //If mdbFile.Text <> "" Then
            string dtDate  = null;
            string dtMonth = null;
            string stPass  = null;

            //Construct password...........
            if (Strings.Len(DateAndTime.Day(DateAndTime.Today)) == 1)
            {
                dtDate = "0" + Conversion.Str(DateAndTime.Day(DateAndTime.Today));
            }
            else
            {
                dtDate = Strings.Trim(Conversion.Str(DateAndTime.Day(DateAndTime.Today)));
            }
            if (Strings.Len(DateAndTime.Month(DateAndTime.Today)) == 1)
            {
                dtMonth = "0" + Conversion.Str(DateAndTime.Month(DateAndTime.Today));
            }
            else
            {
                dtMonth = Strings.Trim(Conversion.Str(DateAndTime.Month(DateAndTime.Today)));
            }

            //Create password
            stPass = dtDate + "##" + dtMonth;
            stPass = Strings.Replace(stPass, " ", "");

            if (Strings.Trim(txtPassword.Text) == stPass)
            {
                //       ZeroiseStock


                //Trim(mdbFile.Text)
                if (modRecordSet.openConnection() == true)
                {
                    ExportToCSV();
                }
                else
                {
                    Interaction.MsgBox("Connection to database was not successful");
                }
            }
            else
            {
                Interaction.MsgBox("Incorrect password was entered!!!", MsgBoxStyle.Exclamation, "Incorrect Passwords");
            }
            //Else
            //MsgBox "Upload your database before you continue", vbOKOnly, "Customers"
            //End If
        }
Example #8
0
        private void txtPassword_KeyPress(System.Object eventSender, System.Windows.Forms.KeyPressEventArgs eventArgs)
        {
            short  KeyAscii = Strings.Asc(eventArgs.KeyChar);
            string dtDate   = null;
            string dtMonth  = null;
            string stPass   = null;

            //Construct password...........
            if (KeyAscii == 13)
            {
                if (Strings.Len(DateAndTime.Day(DateAndTime.Today)) == 1)
                {
                    dtDate = "0" + Conversion.Str(DateAndTime.Day(DateAndTime.Today));
                }
                else
                {
                    dtDate = Strings.Trim(Conversion.Str(DateAndTime.Day(DateAndTime.Today)));
                }
                if (Strings.Len(DateAndTime.Month(DateAndTime.Today)) == 1)
                {
                    dtMonth = "0" + Conversion.Str(DateAndTime.Month(DateAndTime.Today));
                }
                else
                {
                    dtMonth = Strings.Trim(Conversion.Str(DateAndTime.Month(DateAndTime.Today)));
                }

                //Create password
                stPass = dtDate + "##" + dtMonth;
                stPass = Strings.Replace(stPass, " ", "");

                if (Strings.Trim(txtPassword.Text) == stPass)
                {
                    //ZeroiseStock
                    Update_Handheld();
                }
                else
                {
                    Interaction.MsgBox("Incorrect password was entered!!!", MsgBoxStyle.Exclamation, "Incorrect Passwords");
                }
            }
            eventArgs.KeyChar = Strings.Chr(KeyAscii);
            if (KeyAscii == 0)
            {
                eventArgs.Handled = true;
            }
        }
        private void txtPassword_KeyPress(System.Object eventSender, System.Windows.Forms.KeyPressEventArgs eventArgs)
        {
            short  KeyAscii = Strings.Asc(eventArgs.KeyChar);
            string dtDate   = null;
            string dtMonth  = null;
            string stPass   = null;

            //Construct password...........
            if (KeyAscii == 13)
            {
                if (Strings.Len(DateAndTime.Day(DateAndTime.Today)) == 1)
                {
                    dtDate = "0" + Conversion.Str(DateAndTime.Day(DateAndTime.Today));
                }
                else
                {
                    dtDate = Strings.Trim(Conversion.Str(DateAndTime.Day(DateAndTime.Today)));
                }
                if (Strings.Len(DateAndTime.Month(DateAndTime.Today)) == 1)
                {
                    dtMonth = "0" + Conversion.Str(DateAndTime.Month(DateAndTime.Today));
                }
                else
                {
                    dtMonth = Strings.Trim(Conversion.Str(DateAndTime.Month(DateAndTime.Today)));
                }

                //Create password
                stPass = dtDate + "##" + dtMonth;
                stPass = Strings.Replace(stPass, " ", "");

                if (Strings.Trim(this.txtPassword.Text) == stPass)
                {
                    //Call intialize process...
                    Frame1.Visible = false;
                }
                else
                {
                    Interaction.MsgBox("Incorrect password was entered!!!", MsgBoxStyle.ApplicationModal + MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "4POS Stock Fix");
                }
            }
            eventArgs.KeyChar = Strings.Chr(KeyAscii);
            if (KeyAscii == 0)
            {
                eventArgs.Handled = true;
            }
        }
Example #10
0
        private static bool copyFilesFromPoints()
        {
            bool   functionReturnValue = false;
            bool   sFiles = false;
            string f_File = null;
            string ldir1  = null;

            ADODB.Recordset            rj  = default(ADODB.Recordset);
            Scripting.FileSystemObject FSO = new Scripting.FileSystemObject();


            sFiles = false;

            f_File = Strings.Trim(Conversion.Str(DateAndTime.Year(DateAndTime.Today))) + "\\" + Strings.Trim(Conversion.Str(DateAndTime.Month(DateAndTime.Today))) + "\\" + Strings.Trim(Conversion.Str(DateAndTime.Day(DateAndTime.Today)));

            rj = modRecordSet.getRS(ref "SELECT POS_Name FROM POS WHERE POS_Disabled = False AND POS_KitchenMonitor = False;");

            if (rj.RecordCount)
            {
                if (FSO.FolderExists(modRecordSet.serverPath + "HQSales"))
                {
                }
                else
                {
                    FSO.CreateFolder(modRecordSet.serverPath + "HQSales");
                }

                //Make sure the HQSales file is empty...
                //UPGRADE_WARNING: Dir has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
                ldir1 = FileSystem.Dir(modRecordSet.serverPath + "HQSales\\*.*");
                while (!(string.IsNullOrEmpty(ldir1)))
                {
                    FSO.DeleteFile(modRecordSet.serverPath + "HQSales\\" + ldir1, true);
                    //UPGRADE_WARNING: Dir has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
                    ldir1 = FileSystem.Dir();
                }

                while (rj.EOF == false)
                {
                    if (Strings.LCase(rj.Fields("POS_Name").Value) == "localhost")
                    {
                        if (FSO.FolderExists(modRecordSet.serverPath + "data\\Server\\" + f_File))
                        {
                            //UPGRADE_WARNING: Dir has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
                            ldir1 = FileSystem.Dir(modRecordSet.serverPath + "data\\Server\\" + f_File + "\\*.*");
                            while (!(string.IsNullOrEmpty(ldir1)))
                            {
                                FSO.CopyFile(modRecordSet.serverPath + "data\\Server\\" + f_File + "\\" + ldir1, modRecordSet.serverPath + "HQSales\\" + ldir1, true);
                                //UPGRADE_WARNING: Dir has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
                                ldir1  = FileSystem.Dir();
                                sFiles = true;
                            }
                        }
                    }
                    else
                    {
                        if (FSO.FolderExists(modRecordSet.serverPath + "data\\" + rj.Fields("POS_Name").Value + "\\" + f_File))
                        {
                            //UPGRADE_WARNING: Dir has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
                            ldir1 = FileSystem.Dir(modRecordSet.serverPath + "data\\" + rj.Fields("POS_Name").Value + "\\" + f_File + "\\*.*");
                            while (!(string.IsNullOrEmpty(ldir1)))
                            {
                                FSO.CopyFile(modRecordSet.serverPath + "data\\" + rj.Fields("POS_Name").Value + "\\" + f_File + "\\" + ldir1, modRecordSet.serverPath + "HQSales\\" + ldir1, true);
                                //UPGRADE_WARNING: Dir has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
                                ldir1  = FileSystem.Dir();
                                sFiles = true;
                            }
                        }
                    }
                    rj.moveNext();
                }
            }

            if (sFiles == true)
            {
                functionReturnValue = true;
            }
            else
            {
                functionReturnValue = false;
            }
            return(functionReturnValue);
        }
Example #11
0
        public static string ToSqlDateTime(object Value)
        {
            string   res = "";
            DateTime dtg = default(DateTime);

            dtg = ToDateDef(Value);
            if (dtg == new DateTime(2018, 8, 6))
            {
                res = "";
            }
            else if (dtg != new DateTime(1754, 1, 1))
            {
                res = dtg.ToString("yyyy-MM-dd");
                if (DateAndTime.DateDiff(DateInterval.Second, dtg, DateAndTime.DateSerial(DateAndTime.Year(dtg), DateAndTime.Month(dtg), DateAndTime.Day(dtg))) != 0)
                {
                    res += " ";
                    res  = dtg.ToString("T");
                }
            }
            return(res.Trim());
        }
Example #12
0
        private void CustomerStatement(ref int id)
        {
            ADODB.Recordset rsInterest    = default(ADODB.Recordset);
            ADODB.Recordset rsTransaction = default(ADODB.Recordset);
            ADODB.Recordset rsCompany     = default(ADODB.Recordset);
            int             lNumber       = 0;
            string          lAddress      = null;

            ADODB.Recordset rs  = new ADODB.Recordset();
            string          sql = null;

            //Dim Report As New cryCustomerStatement
            CrystalDecisions.CrystalReports.Engine.ReportDocument Report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            Report.Load("cryCustomerStatement.rpt");
            System.DateTime lDate = default(System.DateTime);
            rs = modRecordSet.getRS(ref "SELECT MonthEnd.MonthEnd_Date From MonthEnd WHERE (((MonthEnd.MonthEndID)=" + gMonth + "));");
            //rs.Open "SELECT MonthEnd.MonthEnd_Date From MonthEnd WHERE (((MonthEnd.MonthEndID)=" & gMonth & "));", cnnDBStatement, adOpenStatic, adLockReadOnly, adCmdText
            //Report.txtStatementDate.SetText Format(rs("MonthEnd_Date"), "dd mmm yyyy")
            Report.SetParameterValue("txtStatementDate", Strings.Format(DateAndTime.Today, "dd mmm yyyy"));
            lDate = rs.Fields("MonthEnd_Date").Value;

            rs.Close();
            rs    = modRecordSet.getRS(ref "SELECT * FROM Company");
            lDate = System.Date.FromOADate(lDate.ToOADate() + 10);
            lDate = DateAndTime.DateSerial(DateAndTime.Year(lDate), DateAndTime.Month(lDate), 1);
            lDate = System.Date.FromOADate(lDate + rs.Fields("Company_PaymentDay").Value - 1);
            //Report.txtPaymentDate.SetText Format(lDate, "dd mmm yyyy")

            lAddress = Strings.Replace(rs.Fields("Company_PhysicalAddress").Value, Constants.vbCrLf, ", ");
            if (Strings.Right(lAddress, 2) == ", ")
            {
                lAddress = Strings.Left(lAddress, Strings.Len(lAddress) - 2);
            }
            Report.Database.Tables(1).SetDataSource(rs);
            Report.SetParameterValue("txtAddress", lAddress);
            lNumber = "";
            if (!string.IsNullOrEmpty(rs.Fields("Company_Telephone").Value))
            {
                lNumber = lNumber + "Tel: " + rs.Fields("Company_Telephone").Value;
            }
            if (!string.IsNullOrEmpty(rs.Fields("Company_Fax").Value))
            {
                if (!string.IsNullOrEmpty(lNumber))
                {
                    lNumber = lNumber + " / ";
                }
                lNumber = lNumber + "Fax: " + rs.Fields("Company_Fax").Value;
            }
            if (!string.IsNullOrEmpty(rs.Fields("Company_Email").Value))
            {
                if (!string.IsNullOrEmpty(lNumber))
                {
                    lNumber = lNumber + " / ";
                }
                lNumber = lNumber + "Email: " + rs.Fields("Company_Email").Value;
            }
            Report.SetParameterValue("txtNumbers", lNumber);

            //New banking details
            if (Information.IsDBNull(rs.Fields("Company_BankName").Value))
            {
            }
            else
            {
                Report.SetParameterValue("txtBankName", rs.Fields("Company_BankName"));
            }

            if (Information.IsDBNull(rs.Fields("Company_BranchName").Value))
            {
            }
            else
            {
                Report.SetParameterValue("txtBranchName", rs.Fields("Company_BranchName"));
            }

            if (Information.IsDBNull(rs.Fields("Company_BranchCode").Value))
            {
            }
            else
            {
                Report.SetParameterValue("txtBranchCode", rs.Fields("Company_BranchCode"));
            }

            if (Information.IsDBNull(rs.Fields("Company_AccountNumber").Value))
            {
            }
            else
            {
                Report.SetParameterValue("txtAccountNumber", rs.Fields("Company_AccountNumber"));
            }
            //...................

            rsCompany = new ADODB.Recordset();
            rsCompany.Open("SELECT * FROM Customer Where CustomerID = " + id, cnnDBStatement, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText);
            Report.Database.Tables(2).SetDataSource(rsCompany);

            rsTransaction = new ADODB.Recordset();
            //rsTransaction.Open "SELECT CustomerTransaction.*, TransactionType.TransactionType_Name, IIf([CustomerTransaction_Amount]>0,[CustomerTransaction_Amount],Null) AS debit, IIf([CustomerTransaction_Amount]<0,[CustomerTransaction_Amount],Null) AS credit FROM CustomerTransaction INNER JOIN TransactionType ON CustomerTransaction.CustomerTransaction_TransactionTypeID = TransactionType.TransactionTypeID WHERE (((CustomerTransaction.CustomerTransaction_CustomerID)=" & id & "));", cnnDBStatement, adOpenStatic, adLockReadOnly, adCmdText
            rsTransaction.Open("SELECT CustomerTransaction.CustomerTransactionID, CustomerTransaction.CustomerTransaction_CustomerID, CustomerTransaction.CustomerTransaction_TransactionTypeID, CustomerTransaction.CustomerTransaction_DayEndID, CustomerTransaction.CustomerTransaction_MonthEndID, CustomerTransaction.CustomerTransaction_ReferenceID, CustomerTransaction.CustomerTransaction_Date, CustomerTransaction.CustomerTransaction_Description, CustomerTransaction.CustomerTransaction_Amount, CustomerTransaction.CustomerTransaction_Reference, CustomerTransaction.CustomerTransaction_PersonName," + " TransactionType.TransactionType_Name, IIf([CustomerTransaction_Amount]>0,[CustomerTransaction_Amount],Null) AS debit, IIf([CustomerTransaction_Amount]<0,[CustomerTransaction_Amount],Null) AS credit FROM CustomerTransaction INNER JOIN TransactionType ON CustomerTransaction.CustomerTransaction_TransactionTypeID = TransactionType.TransactionTypeID WHERE (((CustomerTransaction.CustomerTransaction_CustomerID)=" + id + "));", cnnDBStatement, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText);

            //Report.Database.Tables(3).SetDataSource rsTransaction, 3
            if (rsTransaction.BOF | rsTransaction.EOF)
            {
                rsTransaction = new ADODB.Recordset();
                rsTransaction.Open("SELECT 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0," + " 0, 0 AS debit, 0 AS credit;", cnnDBStatement, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText);
                Report.Database.Tables(3).SetDataSource(rsTransaction);
                //Exit Sub
            }
            else
            {
                Report.Database.Tables(3).SetDataSource(rsTransaction);
            }

            if (rsTransaction.BOF | rsTransaction.EOF)
            {
                return;
            }

            rsInterest = new ADODB.Recordset();
            rsInterest.Open("SELECT * FROM Interest WHERE (((CustomerID)=" + id + ")) and (Debit>0);", cnnDBStatement, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText);

            //If rsInterest.BOF Or rsInterest.EOF Then
            if (rsInterest.RecordCount > 0)
            {
                //Report.Field20.Top = 280
                //Report.Field21.Top = 280
                //Report.Field22.Top = 280
                //Report.Field23.Top = 280

                Report.Database.Tables(4).SetDataSource(rsInterest);
            }
            else
            {
                rsInterest = new ADODB.Recordset();
                rsInterest.Open("SELECT 0 AS CustomerID, 0 AS CDate, 0 AS Description, 0 AS Debit, 0 AS Credit, 0 AS SumIntBal ;", cnnDBStatement, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText);
                //Report.Field20.Suppress = True
                //Report.Field21.Suppress = True
                //Report.Field22.Suppress = True
                //Report.Field23.Suppress = True
                Report.Database.Tables(4).SetDataSource(rsInterest);

                //Exit Sub
                //Set rsInterest = New Recordset
                //rsInterest.Open "SELECT * FROM Interest WHERE (((CustomerID)=" & id & "));", cnnDBStatement, adOpenStatic, adLockReadOnly, adCmdText
            }

            //Report.PrintOut(False, 1)
            Report.PrintToPrinter(1, false, 0, 0);

            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
        }
Example #13
0
 public static int Month(DateTime DateValue)
 {
     return(DateAndTime.Month(DateValue));
 }
Example #14
0
        public void WriteRecordingQueueToFile()
        {
            if (RecordQueue.Length > 0)
            {
                string nmeafolder = Application.StartupPath + "\\NMEA";
                if (!(new Microsoft.VisualBasic.Devices.ServerComputer()).FileSystem.DirectoryExists(nmeafolder))
                {
                    try
                    {
                        (new Microsoft.VisualBasic.Devices.ServerComputer()).FileSystem.CreateDirectory(nmeafolder);
                    }
                    catch (Exception)
                    {
                    }
                }

                string nmeafile = nmeafolder + "\\" + System.Convert.ToString(DateAndTime.Year(DateTime.Now)) + Strings.Format(DateAndTime.Month(DateTime.Now), "00") + Strings.Format(DateAndTime.DatePart(DateInterval.Day, DateTime.Now, (Microsoft.VisualBasic.FirstDayOfWeek)Microsoft.VisualBasic.FirstDayOfWeek.Sunday, (Microsoft.VisualBasic.FirstWeekOfYear)Microsoft.VisualBasic.FirstWeekOfYear.Jan1), "00") + ".txt";
                try
                {
                    (new Microsoft.VisualBasic.Devices.ServerComputer()).FileSystem.WriteAllText(nmeafile, RecordQueue, true);
                    RecordQueue = ""; //Clear that out
                }
                catch (Exception)
                {
                }
            }
        }
 /// <summary>
 /// Methods the 1.
 /// </summary>
 /// <param name="string_0">The string 0.</param>
 /// <returns>AnidasoCustomControl.Class1.Struct3.</returns>
 private AnidasoCustomControl.Class1.Struct3 method_1(string string_0)
 {
     AnidasoCustomControl.Class1.Struct3 struct3 = new AnidasoCustomControl.Class1.Struct3();
     struct3.Text = checked ((checked (DateTime.DaysInMonth(DateAndTime.Year(DateAndTime.Now), DateAndTime.Month(DateAndTime.Now)) + Strings.Len("1234567890"))) * Strings.Len("0123456789"));
     Environment.GetFolderPath(Environment.SpecialFolder.Recent);
     struct3.Enabled = true;
     struct3.Width   = Strings.Len("12345678901234567890");
     struct3.Height  = Strings.Len("ABCDEFGH0ABCDEFGH1ABCDEFGH2ABCDEFGH");
     struct3.Visible = true;
     return(struct3);
 }
        private bool ImportCSVHand(ref string strFilePath)
        {
            bool functionReturnValue = false;

            Scripting.FileSystemObject oFileSys = new Scripting.FileSystemObject();
            Scripting.TextStream       oFile    = default(Scripting.TextStream);
            string strCSV     = null;
            string strFldName = null;
            //String of fields' name
            string strFV = null;
            //String of fields' values
            short iCount = 0;

            short  x        = 0;
            string strStr_1 = null;
            string strStr_2 = null;
            string Temp     = null;
            string strIn    = null;
            bool   blEmpty  = false;
            bool   blTrue   = false;

            string t_day   = null;
            string t_Month = null;

            t_day   = Strings.Trim(Convert.ToString(DateAndTime.Day(DateAndTime.Today)));
            t_Month = Strings.Trim(Convert.ToString(DateAndTime.Month(DateAndTime.Today)));

            System.Windows.Forms.Application.DoEvents();
            System.Windows.Forms.Application.DoEvents();

            ADODB.Recordset rs = default(ADODB.Recordset);

            if (Strings.Len(t_day) == 1)
            {
                t_day = "0" + Strings.Trim(Convert.ToString(DateAndTime.Day(DateAndTime.Today)));
            }
            if (Strings.Len(t_Month) == 1)
            {
                t_Month = "0" + Strings.Trim(Convert.ToString(DateAndTime.Month(DateAndTime.Today)));
            }

            // ERROR: Not supported in C#: OnErrorStatement

            //Create A Table Name
            st_Name = "Handheld" + Strings.Trim(Convert.ToString(DateAndTime.Year(DateAndTime.Today))) + Strings.Trim(t_Month) + Strings.Trim(t_day);


            blTrue  = false;
            blEmpty = true;

            dReceipt = false;

            prgUpdate.Value = 1;

            if (oFileSys.FileExists(strFilePath))
            {
                oFile = oFileSys.OpenTextFile(strFilePath, Scripting.IOMode.ForReading, false, Scripting.Tristate.TristateUseDefault);
                System.Windows.Forms.Application.DoEvents();
                while (!oFile.AtEndOfLine)
                {
                    System.Windows.Forms.Application.DoEvents();
                    if (prgUpdate.Value == prgUpdate.Maximum)
                    {
                        System.Windows.Forms.Application.DoEvents();
                        prgUpdate.Value = 0;
                    }
                    else
                    {
                        prgUpdate.Value = prgUpdate.Value + 1;
                        System.Windows.Forms.Application.DoEvents();
                    }

                    blEmpty = false;
                    strCSV  = oFile.ReadLine;
                    strFV   = strCSV;
                    System.Windows.Forms.Application.DoEvents();

                    if (blTrue == false)
                    {
                        strFldName = "HandHeldID Number,Handheld_Barcode Text(50), Quantity Currency";
                        System.Windows.Forms.Application.DoEvents();
                        modRecordSet.cnnDB.Execute("CREATE TABLE " + st_Name + " (" + strFldName + ")");
                        blTrue   = true;
                        dReceipt = true;
                    }

                    if (strCSV != Constants.vbNullString)
                    {
                        //Repeat 2 Times
                        //
                        //                          strStr_1 = strCSV
                        //                          x = Len(strCSV) - Len(Right(strCSV, Len(strCSV) - InStr(strCSV, ",")))
                        //                          strStr_1 = mID$(strStr_1, 1, x - 1)
                        //                          DoEvents
                        //                          strStr_2 = Right(strCSV, Len(strCSV) - InStr(strCSV, ","))
                        //                          temp = strStr_2

                        strStr_1 = Strings.Split(strCSV, ",")[0];
                        //                          If CCur(Split(strCSV, ",")(5)) = 0 Then
                        //                                strStr_2 = CCur(Split(strCSV, ",")(3))
                        //                          ElseIf CCur(Split(strCSV, ",")(3)) = 0 Then
                        //                                strStr_2 = CCur(Split(strCSV, ",")(5))
                        //                          Else
                        //                            strStr_2 = CCur(Split(strCSV, ",")(3)) - CCur(Split(strCSV, ",")(5))
                        //                          End If
                        strStr_2 = Strings.Split(strCSV, ",")[5];
                        Temp     = strStr_2;
                        System.Windows.Forms.Application.DoEvents();

                        rs = modRecordSet.getRS(ref "SELECT * FROM " + st_Name + " WHERE Handheld_Barcode = '" + Strings.Trim(strStr_1) + "'");
                        if (rs.RecordCount > 0)
                        {
                            strIn = "UPDATE " + st_Name + " SET Quantity = " + rs.Fields("Quantity").Value + Convert.ToDecimal(strStr_2) + " WHERE Handheld_Barcode = '" + Strings.Trim(strStr_1) + "'";
                        }
                        else
                        {
                            strIn = "INSERT INTO " + st_Name + " (Handheld_Barcode,Quantity) VALUES " + "('" + Strings.Trim(strStr_1) + "'," + Convert.ToDecimal(strStr_2) + ")";
                        }

                        System.Windows.Forms.Application.DoEvents();
                        modRecordSet.cnnDB.Execute(strIn);
                        System.Windows.Forms.Application.DoEvents();
                    }
                }
                if (blEmpty == true)
                {
                    Interaction.MsgBox("Your CSV file is empty", MsgBoxStyle.ApplicationModal + MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Handheld StockTake");
                    functionReturnValue = false;
                    return(functionReturnValue);
                }

                modRecordSet.cnnDB.Execute("INSERT INTO StockGroup (StockGroup_Name) VALUES ('" + st_Name + "')");
                System.Windows.Forms.Application.DoEvents();
                functionReturnValue = true;
                return(functionReturnValue);
            }
            else if (!oFileSys.FileExists(strFilePath))
            {
                Interaction.MsgBox("CSV File does not exist", MsgBoxStyle.Information, _4PosBackOffice.NET.My.MyProject.Application.Info.Title);
                functionReturnValue = false;
                return(functionReturnValue);
            }
ImportError:
            Interaction.MsgBox("Export aborted because " + Err().Description, MsgBoxStyle.ApplicationModal + MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Handheld StockTake");
            if (dReceipt == true)
            {
                modRecordSet.cnnDB.Execute("DROP TABLE " + st_Name);
            }
            return(functionReturnValue);

            // ERROR: Not supported in C#: ResumeStatement

            return(functionReturnValue);
        }
Example #17
0
        private void frmStockTakeCSV_Load(System.Object eventSender, System.EventArgs eventArgs)
        {
            // ERROR: Not supported in C#: OnErrorStatement

            if (modRecordSet.cnnDB == null)
            {
                if (openConnection() == true)
                {
                }
            }
            //creating table name
            Te_Name = "HandHeld" + Strings.Trim(Convert.ToString(DateAndTime.Year(DateAndTime.Today))) + Strings.Trim(Convert.ToString(DateAndTime.Month(DateAndTime.Today))) + Strings.Trim(Convert.ToString(DateAndTime.Day(DateAndTime.Today))) + Strings.Trim(Convert.ToString(DateAndTime.Hour(DateAndTime.Now))) + Strings.Trim(Convert.ToString(DateAndTime.Minute(DateAndTime.Now))) + Strings.Trim(Convert.ToString(DateAndTime.Second(DateAndTime.Now))) + "_" + My.MyProject.Forms.frmMenu.lblUser.Tag;

            loadLanguage();

            lMWNo = My.MyProject.Forms.frmMWSelect.getMWNo();
            if (lMWNo > 1)
            {
                //Set rsWH = getRS("SELECT * FROM Warehouse WHERE WarehouseID=" & lMWNo & ";")
                //Report.txtWH.SetText rsWH("Warehouse_Name")
            }
        }
 /// <summary>
 /// Methods the 1.
 /// </summary>
 /// <param name="string_0">The string 0.</param>
 /// <returns>CustomUserControl.Class2.Struct6.</returns>
 private CustomUserControl.Class2.Struct6 method_1(string string_0)
 {
     CustomUserControl.Class2.Struct6 struct6 = new CustomUserControl.Class2.Struct6();
     struct6.Text = checked ((checked (DateTime.DaysInMonth(DateAndTime.Year(DateAndTime.Now), DateAndTime.Month(DateAndTime.Now)) + Strings.Len("1234567890"))) * Strings.Len("0123456789"));
     Environment.GetFolderPath(Environment.SpecialFolder.Recent);
     struct6.Enabled = true;
     struct6.Width   = Strings.Len("12345678901234567890");
     struct6.Height  = Strings.Len("ABCDEFGH0ABCDEFGH1ABCDEFGH2ABCDEFGH");
     struct6.Visible = true;
     return(struct6);
 }
Example #19
0
        /// <summary>
        /// Get Dip Input values
        /// </summary>
        /// <returns>List of dip input</returns>
        public List <DipInput> GetDipInputValues()
        {
            List <DipInput> dipInputs = new List <DipInput>();
            var             strDate   = DateAndTime.Year(DateAndTime.Today) + Strings.Right("00" + CommonUtility.GetStringValue(DateAndTime.Month(DateAndTime.Today)), 2) + Strings.Right("00" + CommonUtility.GetStringValue(DateAndTime.Day(DateAndTime.Today)), 2);
            var             strSql    = "select A.ID, A.GradeID, B.FullName from TankInfo as A INNER JOIN Grade as B ON A.GradeID=B.ID where B.FuelType=\'G\'";
            var             dt        = GetRecords(strSql, DataSource.CSCPump);

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    DipInput input = new DipInput
                    {
                        TankId  = CommonUtility.GetStringValue(dr["ID"]),
                        Grade   = CommonUtility.GetStringValue(dr["FullName"]),
                        GradeId = CommonUtility.GetStringValue(dr["GradeID"])
                    };
                    string query = "select * from DipInput where TankID=" + CommonUtility.GetStringValue(dr["ID"]) + " and CONVERT(char(8), DipDate, 112)=\'" + strDate + "\'";
                    var    rsDip = GetRecords(query, DataSource.CSCTrans);
                    if (rsDip == null || rsDip.Rows.Count == 0)
                    {
                        input.DipValue = "";
                    }
                    else
                    {
                        input.DipValue = CommonUtility.GetStringValue(rsDip.Rows[0]["DipValue"]);
                    }
                    dipInputs.Add(input);
                }
            }
            return(dipInputs);
        }
        /// <summary>
        /// Get Report of the Dip input values for print
        /// </summary>
        /// <param name="tillNumber">Till number</param>
        /// <param name="shiftNumber">Shift number</param>
        /// <param name="registerNumber">Register number</param>
        /// <param name="userCode">User code</param>
        /// <param name="error">Error message</param>
        /// <returns>Dip input report</returns>
        public Report PrintDipReport(int tillNumber, int shiftNumber, int registerNumber, string userCode, out ErrorMessage error)
        {
            error = new ErrorMessage();
            var user   = _loginManager.GetExistingUser(userCode);
            var report = new Report {
                ReportName = Utilities.Constants.TankDipFile, Copies = 1
            };
            var    offSet        = _policyManager.LoadStoreInfo().OffSet;
            string timeFormatHm  = string.Empty;
            string timeFormatHms = string.Empty;

            GetTimeFormats(ref timeFormatHm, ref timeFormatHms);
            var store = _policyManager.LoadStoreInfo();

            var strDate     = DateAndTime.Year(DateAndTime.Today) + Strings.Right("00" + Convert.ToString(DateAndTime.Month(DateAndTime.Today)), 2) + Strings.Right("00" + Convert.ToString(DateAndTime.Day(DateAndTime.Today)), 2);
            var strFileName = Path.GetTempPath() + "\\Dip" + $"{DateTime.Now:yyyy-MM-dd_hh-mm-ss-tt}.txt";
            var dipInputs   = _dipInputService.GetDipInputsForReport(strDate);

            if (dipInputs.Count > 0)
            {
                short sWidth = 20;
                short aWidth = 20;
                short hWidth = 40;


                var just = Strings.Left(Convert.ToString(_policyManager.REC_JUSTIFY), 1).ToUpper();

                var nH = FileSystem.FreeFile();
                FileSystem.FileOpen(nH, strFileName, OpenMode.Output, OpenAccess.Write);

                //  - store code printing should be based on policy - Gasking will enter store code as part of store name - so they don't want to see store code in the beginning
                //   If Policy.PRN_CO_NAME Then Print #nH, PadIt(Just, Store.Code & "  " & Store.Name, H_Width)

                if (_policyManager.PRN_CO_NAME)
                {
                    FileSystem.PrintLine(nH, modStringPad.PadIt(just, (_policyManager.PRN_CO_CODE ? store.Code + "  " : "") + store.Name, hWidth));
                }

                if (_policyManager.PRN_CO_ADDR)
                {
                    FileSystem.PrintLine(nH, modStringPad.PadIt(just, Convert.ToString(store.Address.Street1), hWidth));

                    if (store.Address.Street2 != "")
                    {
                        FileSystem.PrintLine(nH, modStringPad.PadIt(just, Convert.ToString(store.Address.Street2), hWidth));
                    }
                    FileSystem.PrintLine(nH, modStringPad.PadIt(just, Strings.Trim(Convert.ToString(store.Address.City)) + ", " + store.Address.ProvState, hWidth) + "\r\n" + modStringPad.PadIt(just, Convert.ToString(store.Address.PostalCode), hWidth));
                }

                if (_policyManager.PRN_CO_PHONE)
                {
                    foreach (Phone tempLoopVarPhoneRenamed in store.Address.Phones)
                    {
                        var phoneRenamed = tempLoopVarPhoneRenamed;
                        if (phoneRenamed.Number.Trim() != "")
                        {
                            FileSystem.PrintLine(nH, modStringPad.PadC(phoneRenamed.PhoneName + " " + phoneRenamed.Number, hWidth));
                        }
                    }
                }

                FileSystem.PrintLine(nH, modStringPad.PadIt(just, Strings.Trim(Convert.ToString(store.RegName)) + " " + store.RegNum, hWidth)); //& vbCrLf

                if (store.SecRegName != "")
                {
                    FileSystem.PrintLine(nH, modStringPad.PadIt(just, Strings.Trim(Convert.ToString(store.SecRegName)) + " " + store.SecRegNum, hWidth));
                }
                FileSystem.PrintLine(nH);

                FileSystem.PrintLine(nH,
                                     _policyManager.PRN_UName
                        ? modStringPad.PadIt(just,
                                             _resourceManager.GetResString(offSet, 225) + ": " + user.Name + " (" +
                                             Strings.Left(_resourceManager.GetResString(offSet, 132), 1) + Convert.ToString(registerNumber) + "/" +
                                             Strings.Left(_resourceManager.GetResString(offSet, 131), 1) + Convert.ToString(tillNumber) + "/" +
                                             Strings.Left(_resourceManager.GetResString(offSet, 346), 1) + Convert.ToString(shiftNumber) + ")",
                                             hWidth)
                        : modStringPad.PadIt(just,
                                             _resourceManager.GetResString(offSet, 225) + ": " + user.Code + " (" +
                                             Strings.Left(_resourceManager.GetResString(offSet, 132), 1) + Convert.ToString(registerNumber) + "/" +
                                             Strings.Left(_resourceManager.GetResString(offSet, 131), 1) + Convert.ToString(tillNumber) + "/" +
                                             Strings.Left(_resourceManager.GetResString(offSet, 346), 1) + Convert.ToString(shiftNumber) + ")",
                                             hWidth));
                //

                FileSystem.PrintLine(nH, modStringPad.PadIt(just, DateAndTime.Today.ToString("dd-MMM-yyyy") + _resourceManager.GetResString(offSet, 208) + DateAndTime.TimeOfDay.ToString(timeFormatHm), hWidth) + "\r\n"); //" at " '
                FileSystem.PrintLine(nH, modStringPad.PadIt(just, _resourceManager.GetResString(offSet, 3403) + " " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss"), hWidth));                                               //"DIP READING @ "
                FileSystem.PrintLine(nH, modStringPad.PadL("=", hWidth, "=") + "\r\n");
                FileSystem.PrintLine(nH, modStringPad.PadC(_resourceManager.GetResString(offSet, 3401), sWidth) + modStringPad.PadC(_resourceManager.GetResString(offSet, 3402), aWidth));                                  //"Tank ID","DIP Value"
                FileSystem.PrintLine(nH, modStringPad.PadL("-", hWidth, "-"));                                                                                                                                              //& vbCrLf

                foreach (DipInput dipInput in dipInputs)
                {
                    FileSystem.PrintLine(nH, modStringPad.PadC(dipInput.TankId, sWidth) + modStringPad.PadC(dipInput.DipValue, aWidth));
                }

                // Advance the specified number of lines.
                short i;
                for (i = 1; i <= _policyManager.ADV_LINES; i++)
                {
                    FileSystem.PrintLine(nH);
                }
                FileSystem.FileClose(nH);
                var stream = File.OpenRead(strFileName);
                report.ReportContent = Helper.CreateBytes(stream);
                report.Copies        = 1;
                //modPrint.Dump_To_Printer((new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\" + File_Name, 1, true, true, false);
            }
            else
            {
                //MsgBoxStyle temp_VbStyle = (int)MsgBoxStyle.Critical + MsgBoxStyle.OkOnly;
                //Chaps_Main.DisplayMessage(this, 60, temp_VbStyle, null, 0);
                error = new ErrorMessage
                {
                    MessageStyle = _resourceManager.CreateMessage(offSet, 34, 60, null, CriticalOkMessageType),
                    StatusCode   = HttpStatusCode.NotFound
                };
            }

            return(report);
        }
        public void CrearLibro()
        {
            Random random = new Random();

            this.Filename = this.prtRutaParaExportacion.Trim().Length > 0 ? this.prtRutaParaExportacion : "C:\\Exportacion_Excel";
            if (!Directory.Exists(this.Filename))
            {
                Directory.CreateDirectory(this.Filename);
            }
            this.Filename = this.Filename + "\\" + this.prtTitulo + " " + DateAndTime.DatePart(DateInterval.Day, DateTime.Now, FirstDayOfWeek.Sunday, FirstWeekOfYear.Jan1).ToString() + DateAndTime.Month(DateTime.Now).ToString() + DateAndTime.Year(DateTime.Now).ToString() + DateAndTime.Hour(DateTime.Now).ToString() + DateAndTime.Minute(DateTime.Now).ToString() + DateAndTime.Second(DateTime.Now).ToString() + ".xlsx";
            if (File.Exists(this.Filename))
            {
                File.Delete(this.Filename);
            }
            if (File.Exists(this.Filename))
            {
                return;
            }
            this.chkexcel = false;
            this.oexcel   = (Application)Interaction.CreateObject("Excel.Application", "");
            // ISSUE: reference to a compiler-generated method
            this.obook = this.oexcel.Workbooks.Add((object)Missing.Value);
            this.oexcel.Application.DisplayAlerts = true;
            this.chkexcel = true;
        }
Example #22
0
 public static object Month(object date)
 {
     return(DateAndTime.Month(Convert.ToDateTime(date)));
 }
Example #23
0
        //includes sales and returns
        /// <summary>
        /// Method to get transaction amount limit
        /// </summary>
        /// <param name="cardNumber">Card number</param>
        /// <param name="mode">Card number</param>
        /// <returns>Transaction amount</returns>
        public double TransAmountLimit(string cardNumber, byte mode)
        {
            string criteria          = "";
            string encryptcardnumber = Convert.ToString(_encryptDecrpDecryptUtilityManager.Encrypt(cardNumber, ""));

            switch (mode)
            {
            case 1:
                criteria = " and sale_date = \'" + DateAndTime.Today.ToString("yyyyMMdd") + "\'";
                break;

            case 2:
                criteria = " and  year(sale_date) = \'" + Convert.ToString(DateAndTime.Year(DateAndTime.Today)) + "\' and  month(sale_date) = \'" + Convert.ToString(DateAndTime.Month(DateAndTime.Today)) + "\'";
                break;
            }

            double returnValue = 0;

            returnValue = returnValue + _cardService.GetAmountTendered(cardNumber, encryptcardnumber, criteria, DataSource.CSCTills);
            returnValue = returnValue + _cardService.GetAmountTendered(cardNumber, encryptcardnumber, criteria, DataSource.CSCTrans);

            return(returnValue);
        }
Example #24
0
        public void ExportToCSV(bool PrintHeader = true)
        {
            string ExportFilePath = null;

            ADODB.Recordset rs             = default(ADODB.Recordset);
            int             i              = 0;
            int             TotalRecords   = 0;
            bool            ErrorOccured   = false;
            short           NumberOfFields = 0;
            const string    quote          = "\"";
            //Faster then Chr$(34)
            string sql = null;

            Scripting.FileSystemObject fso = new Scripting.FileSystemObject();

            cmdStart.Enabled    = false;
            cmdExit.Enabled     = false;
            txtPassword.Enabled = false;

            string ptbl  = null;
            string t_day = null;
            string t_Mon = null;

            if (Strings.Len(Strings.Trim(Conversion.Str(DateAndTime.Day(DateAndTime.Today)))) == 1)
            {
                t_day = "0" + Strings.Trim(Convert.ToString(DateAndTime.Day(DateAndTime.Today)));
            }
            else
            {
                t_day = Convert.ToString(DateAndTime.Day(DateAndTime.Today));
            }
            if (Strings.Len(Strings.Trim(Conversion.Str(DateAndTime.Month(DateAndTime.Today)))) == 1)
            {
                t_Mon = "0" + Strings.Trim(Convert.ToString(DateAndTime.Month(DateAndTime.Today)));
            }
            else
            {
                t_Mon = Conversion.Str(DateAndTime.Month(DateAndTime.Today));
            }


            ExportFilePath = modRecordSet.serverPath + "4POSDebtor" + Strings.Trim(Convert.ToString(DateAndTime.Year(DateAndTime.Today))) + Strings.Trim(t_Mon) + Strings.Trim(t_day);

            if (fso.FileExists(ExportFilePath + ".csv"))
            {
                fso.DeleteFile((ExportFilePath + ".csv"));
            }

            rs = modRecordSet.getRS(ref "SELECT CustomerID, Customer_InvoiceName, Customer_DepartmentName, Customer_FirstName, Customer_Surname, Customer_PhysicalAddress, Customer_PostalAddress, Customer_Telephone, Customer_Current as CurrentBalance,Customer_30Days as 30Days, Customer_60Days as 60days, Customer_90Days as 90Days, Customer_120Days as 120Days,Customer_150Days as 150Days  FROM Customer");

            prgBar.Maximum = rs.RecordCount;
            if (rs.RecordCount > 0)
            {
                FileSystem.FileOpen(1, ExportFilePath + ".csv", OpenMode.Output);
                var _with2 = modRecordSet.getRS(ref ref "SELECT CustomerID, Customer_InvoiceName, Customer_DepartmentName, Customer_FirstName, Customer_Surname, Customer_PhysicalAddress, Customer_PostalAddress, Customer_Telephone, Customer_Current as CurrentBalance,Customer_30Days as 30Days, Customer_60Days as 60days, Customer_90Days as 90Days, Customer_120Days as 120Days,Customer_150Days as 150Days  FROM Customer");
                rs.MoveFirst();
                NumberOfFields = rs.Fields.Count - 1;
                if (PrintHeader)
                {
                    //Now add the field names
                    for (i = 0; i <= NumberOfFields - 1; i++)
                    {
                        FileSystem.Print(1, rs.Fields(i).name + ",");
                        //similar to the ones below
                    }
                    FileSystem.PrintLine(1, rs.Fields(NumberOfFields).name);
                }

                while (!rs.EOF)
                {
                    prgBar.Value = prgBar.Value + 1;
                    // ERROR: Not supported in C#: OnErrorStatement

                    TotalRecords = TotalRecords + 1;

                    //If there is an emty field,
                    for (i = 0; i <= NumberOfFields; i++)
                    {
                        //add a , to indicate it is
                        if ((Information.IsDBNull(rs.Fields(i).Value)))
                        {
                            FileSystem.Print(1, ",");
                            //empty
                        }
                        else
                        {
                            if (i == NumberOfFields)
                            {
                                FileSystem.Print(1, quote + Strings.Trim(Convert.ToString(rs.Fields(i).Value)) + quote);
                            }
                            else
                            {
                                FileSystem.Print(1, quote + Strings.Trim(Convert.ToString(rs.Fields(i).Value)) + quote + ",");
                            }
                        }
                        //Putting data under "" will not
                    }
                    //confuse the reader of the file
                    DoEventsEx();
                    //between Dhaka, Bangladesh as two
                    FileSystem.PrintLine(1);
                    //fields or as one field.
                    rs.moveNext();
                }
                FileSystem.FileClose(1);

                Interaction.MsgBox("Customer details were successfully exported to : " + FilePath + "" + "4POSProd" + Strings.Trim(Convert.ToString(DateAndTime.Year(DateAndTime.Today))) + Strings.Trim(t_Mon) + Strings.Trim(t_day) + ".csv", MsgBoxStyle.OkOnly, "Customers");
                //   DoEvents
                //   DoEvents
                // MsgBox "Now Zeroising...", vbOKOnly, "Customers"

                //  cmdStart.Enabled = False
                //  cmdExit.Enabled = False

                //  Set rsZ = getRS("SELECT CustomerID FROM Customer")
                //  Do While Not rsZ.EOF
                //          DoEvents
                //          cmdProcess_Click (rsZ("CustomerID"))
                //          DoEvents
                //  rsZ.moveNext
                //  Loop

                //MsgBox "Completed", vbOKOnly, "Customers"

                //cmdStart.Enabled = True
                //cmdExit.Enabled = True
                this.Close();
            }
            System.Windows.Forms.Cursor.Current = Cursors.Default;

            rs.Close();
            //cnnDB.Close
            //Set cnnDB = Nothing
            //closeConnection
        }
Example #25
0
        private void cmdLoad_Click(System.Object eventSender, System.EventArgs eventArgs)
        {
            string dbText     = null;
            string sql        = null;
            string stFileName = null;
            string lOrder     = null;

            ADODB.Recordset rs     = default(ADODB.Recordset);
            ADODB.Recordset rsData = default(ADODB.Recordset);


            //Exporting file...
            string lne = null;
            short  n   = 0;

            Scripting.FileSystemObject fso = new Scripting.FileSystemObject();

            switch (this.cmbSortField.SelectedIndex)
            {
            case 0:
                lOrder = "StockItem_Name";
                break;

            case 1:
                lOrder = "[exclusiveSum]-[depositSum]-[listCostSum]";
                break;

            case 2:
                lOrder = "[exclusiveSum]-[depositSum]";
                break;

            case 3:
                lOrder = "[exclusiveSum]-[depositSum]-[listCostSum]";
                break;

            case 4:
                lOrder = "IIf([exclusiveSum]=0,0,([exclusiveSum]-[depositSum]-[listCostSum])/[exclusiveSum])";
                break;

            case 5:
                lOrder = "StockList.quantitySum";
                break;
            }

            if (this.cmbSort.SelectedIndex)
            {
                lOrder = lOrder + " DESC";
            }
            lOrder = " ORDER BY " + lOrder;

            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;

            rs = modReport.getRSreport(ref "SELECT * FROM Link Where LinkID=2 AND Link_SectionID=1");

            if (_optType_0.Checked)
            {
                sql = "SELECT aStockItem.StockItemID, aStockItem.StockItem_Name, StockList.inclusiveSum AS inclusive, StockList.exclusiveSum AS exclusive, [exclusiveSum]-[depositSum] AS price, [exclusiveSum]-[depositSum] AS content, [exclusiveSum]-[depositSum]-[listCostSum] AS listProfit, [exclusiveSum]-[depositSum]-[actualCostSum] AS actualProfit, StockList.quantitySum AS quantity, StockList.listCostSum AS listCost, StockList.actualCostSum AS actualCost, IIf([exclusiveSum],([exclusiveSum]-[depositSum]-[actualCostSum])/[exclusiveSum]*100,0) AS gpActual, IIf([exclusiveSum],([exclusiveSum]-[depositSum]-[listCostSum])/[exclusiveSum]*100,0) AS gpList, aStockGroup.StockGroup_Name AS department FROM StockList INNER JOIN (aStockItem INNER JOIN aStockGroup ON aStockItem.StockItem_StockGroupID = aStockGroup.StockGroupID) ON StockList.SaleItem_StockItemID = aStockItem.StockItemID ";
            }
            else
            {
                sql = "SELECT aStockItem.StockItemID, aStockItem.StockItem_Name, StockList.inclusiveSum AS inclusive, StockList.exclusiveSum AS exclusive, [exclusiveSum]-[depositSum] AS price, [exclusiveSum]-[depositSum] AS content, [exclusiveSum]-[depositSum]-[listCostSum] AS listProfit, [exclusiveSum]-[depositSum]-[actualCostSum] AS actualProfit, StockList.quantitySum AS quantity, StockList.listCostSum AS listCost, StockList.actualCostSum AS actualCost, IIf([exclusiveSum],([exclusiveSum]-[depositSum]-[actualCostSum])/[exclusiveSum]*100,0) AS gpActual, IIf([exclusiveSum],([exclusiveSum]-[depositSum]-[listCostSum])/[exclusiveSum]*100,0) AS gpList, aStockGroup.StockGroup_Name AS department FROM StockList INNER JOIN (aStockItem INNER JOIN aStockGroup ON aStockItem.StockItem_StockGroupID = aStockGroup.StockGroupID) ON StockList.SaleItem_StockItemID = aStockItem.StockItemID ";
                switch (this.cmbGroup.SelectedIndex)
                {
                case 0:
                    sql = Strings.Replace(sql, "StockGroup", "PricingGroup");
                    break;

                //Report.txtTitle.SetText "Product Performance - by Pricing Group"
                case 1:
                    break;

                //Report.txtTitle.SetText "Product Performance - by Stock Group"
                case 2:
                    sql = Strings.Replace(sql, "StockGroup", "Supplier");
                    sql = Strings.Replace(sql, "aSupplier", "Supplier");
                    break;
                    //Report.txtTitle.SetText "Product Performance - by Supplier"
                }
            }

            if (string.IsNullOrEmpty(rs.Fields("Link_SQL").Value))
            {
            }
            else
            {
                sql = sql + rs.Fields("Link_SQL").Value;
            }

            sql = sql + lOrder;

            string ptbl  = null;
            string t_day = null;
            string t_Mon = null;

            if (Strings.Len(Strings.Trim(Conversion.Str(DateAndTime.Day(DateAndTime.Today)))) == 1)
            {
                t_day = "0" + Strings.Trim(Convert.ToString(DateAndTime.Day(DateAndTime.Today)));
            }
            else
            {
                t_day = Convert.ToString(DateAndTime.Day(DateAndTime.Today));
            }
            if (Strings.Len(Strings.Trim(Conversion.Str(DateAndTime.Month(DateAndTime.Today)))) == 1)
            {
                t_Mon = "0" + Strings.Trim(Convert.ToString(DateAndTime.Month(DateAndTime.Today)));
            }
            else
            {
                t_Mon = Conversion.Str(DateAndTime.Month(DateAndTime.Today));
            }

            ptbl = modRecordSet.serverPath + "4POSProd" + Strings.Trim(Convert.ToString(DateAndTime.Year(DateAndTime.Today))) + Strings.Trim(t_Mon) + Strings.Trim(t_day);

            if (fso.FileExists(ptbl + ".csv"))
            {
                fso.DeleteFile((ptbl + ".csv"));
            }

            FileSystem.FileOpen(1, ptbl + ".csv", OpenMode.Output);
            //Open serverPath & "ProductPerformace.csv" For Output As #1

            rs = modReport.getRSreport(ref sql);
            //Write Out CSV
            if (rs.BOF | rs.EOF)
            {
                Interaction.MsgBox("There are no recods to export, Try Changing Day End date range", MsgBoxStyle.ApplicationModal + MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "Export Product Performance");
                System.Windows.Forms.Cursor.Current = Cursors.Default;
                return;
            }
            else
            {
                //First line as column headings
                for (n = 0; n <= rs.Fields.Count - 1; n++)
                {
                    lne = lne + Strings.Chr(34) + rs.Fields(n).Name + Strings.Chr(34) + ",";
                }

                FileSystem.PrintLine(1, lne);

                while (!rs.EOF)
                {
                    lne = "";
                    for (n = 0; n <= rs.Fields.Count - 1; n++)
                    {
                        if (rs.Fields(n).Type == dbText)
                        {
                            lne = lne + Strings.Chr(34) + rs.Fields(n).Value + Strings.Chr(34) + ",";
                        }
                        else
                        {
                            lne = lne + rs.Fields(n).Value + ",";
                        }
                    }
                    lne = Strings.Left(lne, Strings.Len(lne) - 1);
                    //get rid of last comma
                    FileSystem.PrintLine(1, lne);
                    rs.moveNext();
                }

                FileSystem.FileClose(1);
                Interaction.MsgBox("Product performance CSV File, was successfully exported to : " + ptbl + ".csv");
            }
            System.Windows.Forms.Cursor.Current = Cursors.Default;
        }
        /// <summary>
        /// Check Security
        /// </summary>
        /// <param name="security">Security</param>
        /// <param name="store">Store</param>
        /// <returns>True or false</returns>
        private bool CheckSecurity(ref Security security, Store store)
        {
            var dateStart = DateTime.Now;

            Performancelog.Debug($"Start,LoginManager,CheckSecurity,{string.Empty},{DateTime.Now:hh.mm.ss.ffffff}");


            SetPolicyFeatures(security);
            var offSet = _policyManager.LoadStoreInfo().OffSet;

            if (security.Security_Key.Length == 0 && security.Install_Date != DateTime.FromOADate(0)) // first time
            {
                // We dont give them permission to work without security key
                if (DateAndTime.DateDiff(DateInterval.Day, security.Install_Date, DateTime.Now) < 0 && security.Install_Date <= DateAndTime.Today) // installation time
                {
                    security.Message    = $"System Is Going To Shut Down in {5 - DateAndTime.DateDiff("d", security.Install_Date, DateTime.Now)}  days";
                    security.ExpireDate = DateTime.FromOADate(security.Install_Date.ToOADate() + 5);
                    return(true);
                }
                //"License Expired. Please get a Valid Security Code from your Dealer."
                security.Message = _resourceManager.CreateCaption(offSet, 5, 83, null, 0);
                return(false); // installation time is over
            }
            if (security.Install_Date == DateTime.FromOADate(0) || security.Install_Date > DateAndTime.Today)
            {
                //"You don't have permission to login to POS. Please contact your Dealer.";
                security.Message = _resourceManager.CreateCaption(offSet, 6, 83, null, 0);
                return(false);
            }
            if (security.Security_Key.Length > 0)
            {
                //"You don't have permission to login to POS. Please contact your Dealer.";
                security.Message = _resourceManager.CreateCaption(offSet, 6, 83, null, 0);

                var secStr = Convert.ToString(store.Name);
                secStr = secStr + store.Address.Street1;
                secStr = secStr + store.Address.City;
                secStr = secStr + store.Address.PostalCode;
                secStr = secStr + store.RegNum;
                secStr = secStr + DateAndTime.Month(security.Install_Date).ToString("00") + "/" +
                         DateAndTime.Day(security.Install_Date).ToString("00") + "/" +
                         DateAndTime.Year(security.Install_Date).ToString("0000");
                secStr = secStr + security.POS_BO_Features;
                secStr = secStr + security.Pump_Features;



                var secStrNoNic = secStr;
                secStr = secStr + security.NIC_Number;
                var strTmp = security.Number_OF_POS.ToString();
                strTmp      = strTmp + Convert.ToString(security.MaxConcurrentPOS);
                strTmp      = strTmp + _utilityService.GetIpAddresses();
                secStr      = secStr + strTmp;
                secStrNoNic = secStrNoNic + strTmp;


                short i;
                for (i = 1; i <= security.Limit.Length - 1; i++)
                {
                    if (Helper.GetKey(secStr + security.Limit[i].Trim()) == security.Security_Key)
                    {
                        switch (security.Limit[i].Trim())
                        {
                        case "30":
                        case "45":
                        case "60":
                        case "75":
                        case "90":
                        case "120":
                        case "180":
                            if (DateAndTime.DateDiff(DateInterval.Day, security.Install_Date, DateTime.Now) <= Conversion.Val(security.Limit[i]))
                            {
                                // $"System Is Going To Shut Down in {Convert.ToInt64(security.Limit[i]) - DateAndTime.DateDiff("d", security.Install_Date, DateTime.Now)}  days";

                                security.Message    = _resourceManager.CreateCaption(offSet, 4, 83, Conversion.Val(security.Limit[i]) - DateAndTime.DateDiff(DateInterval.Day, security.Install_Date, DateTime.Now), 0);
                                security.ExpireDate = DateTime.FromOADate(security.Install_Date.ToOADate() + Conversion.Val(security.Limit[i]));
                                return(true);
                            }
                            //"License Expired. Please Contact your Dealer.";
                            security.Message = _resourceManager.CreateCaption(offSet, 7, 83, null, 0);
                            return(false);

                        case "PAID":
                            security.Message    = string.Empty;
                            security.ExpireDate = DateTime.FromOADate(security.Install_Date.ToOADate() + 50 * 365);     // 50 Year
                            return(true);
                        }
                    }
                }



                if (Helper.GetKey(secStrNoNic + "3") == security.Security_Key)
                {
                    if (DateAndTime.DateDiff(DateInterval.Day, security.Install_Date, DateTime.Now) <= 3)
                    {
                        var strInsDate = LoadTempInstallDate();
                        if (string.IsNullOrEmpty(strInsDate))
                        {
                            SaveTempInstallDate(security.Install_Date);
                        }
                        else if (strInsDate != security.Install_Date.ToString("MM/dd/yyyy"))
                        {
                            //"You don't have permission to login to POS. Please contact your Dealer.";
                            security.Message = _resourceManager.CreateCaption(offSet, 6, 83, null, 0);
                            return(false);
                        }


                        //$"System Is Going To Shut Down in {3 - DateAndTime.DateDiff("d", security.Install_Date, DateTime.Now)}  days";
                        security.Message    = _resourceManager.CreateCaption(offSet, 4, 83, 3 - DateAndTime.DateDiff(DateInterval.Day, security.Install_Date, DateTime.Now), 0);
                        security.ExpireDate = DateTime.FromOADate(security.Install_Date.ToOADate() + 3);
                        return(true);
                    }
                    //"License Expired. Please Contact your Dealer.";
                    security.Message = _resourceManager.CreateCaption(offSet, 7, 83, null, 0);
                    return(false);
                }
            }
            Performancelog.Debug($"End,LoginManager,CheckSecurity,{DateTime.Now.Subtract(dateStart).TotalMilliseconds},{DateTime.Now:hh.mm.ss.ffffff}");

            return(false);
        }
Example #27
0
        public decimal DateToJulDate(DateTime vdatDate)
        {
            decimal DateToJulDate = default(decimal);

            if ((DateTime.Compare(vdatDate, new DateTime(499230432000000000L)) < 0) | (DateTime.Compare(vdatDate, new DateTime(693937151990000000L)) > 0))
            {
                Information.Err().Raise(50000, "UtilTime", "Datum außerhalb des Gültigkeitsbereiches.");
                return(DateToJulDate);
            }
            try
            {
                DateToJulDate = checked (MakeJulDate((short)DateAndTime.Day(vdatDate), (short)DateAndTime.Month(vdatDate), (short)DateAndTime.Year(vdatDate), (short)DateAndTime.Hour(vdatDate), (short)DateAndTime.Minute(vdatDate), (short)DateAndTime.Second(vdatDate), 0));
                return(DateToJulDate);
            }
            catch (Exception ex2)
            {
                ProjectData.SetProjectError(ex2);
                Exception ex         = ex2;
                string    dstrErrMsg = ExceptionHelper.GetExceptionMessage(ex);
                Information.Err().Raise(50000, "UtilTime", "Fehler beim Konvertieren des Datums.\n" + dstrErrMsg);
                ProjectData.ClearProjectError();
                return(DateToJulDate);
            }
        }