Beispiel #1
0
        private string GetInvoiceNumber()
        {
            string invNumber = "";

            DataRow row = _iField.GetInvoiceTitleDataRow();

            if (row != null)
            {
                invNumber = Convert.ToString(row["invoiceNo"]);
            }

            return(invNumber);
        }
Beispiel #2
0
        public override void CopyNotes(int myParentID, int newParentID, int myID, int newID)
        {
            //Build Note to customer

            var     iField = new InvoiceField(myID);
            DataRow row    = iField.GetInvoiceTitleDataRow();
            string  note   = "This Invoice supercedes invoice No. ";

            string invNo = Convert.ToString(row["invoiceNo"]);

            note += invNo;


            int rev = Convert.ToInt32(row["Revision"]) - 1;

            if (rev > 0)
            {
                string revStr = " Rev " + rev.ToString();
                note += revStr;
            }

            //Write the note to db

            using (var Connection = new SqlConnection(SalesCenterConfiguration.ConnectionString))
            {
                string UpdateString =
                    "UPDATE [Sales_JobMasterList_Invoice] SET [Note] = @Note WHERE [invoiceID] = @InvoiceID";
                var UPdateCommand = new SqlCommand(UpdateString, Connection);

                UPdateCommand.Parameters.Add("@InvoiceID", SqlDbType.Int).Value      = newID;
                UPdateCommand.Parameters.Add("@Note", SqlDbType.NVarChar, 500).Value = note;

                try
                {
                    Connection.Open();
                    UPdateCommand.ExecuteNonQuery();
                }
                catch (SqlException ex)
                {
                    string errorlog = ex.Message;
                }
                finally
                {
                    Connection.Close();
                }
            }
        }