public static void WriteReceipt(MetroFramework.Forms.MetroForm form) { try { technovisionDataSetTableAdapters.receiptTableAdapter t = new technovisionDataSetTableAdapters.receiptTableAdapter(); t.Insert(Receipt.ReceiptNumber, DateTime.Parse(Receipt.receiptDate), Receipt.orderNumber, Receipt.paymentAmount, Receipt.branch, Receipt.OrderType, DateTime.Now.ToString("yyyy"), Receipt.custId); CommonFunctions.WriteUserLog(Session.Username, "New Payment Receipt for " + Receipt.OrderType + " Order Number " + Receipt.orderNumber + " Added to the System."); } catch (Exception ex) { CommonFunctions.WriteToErrorLog(ex.Message); CommonFunctions.ShowError(form, "show " + Receipt.ReceiptNumber + "," + Receipt.receiptDate + "," + Receipt.orderNumber + "," + Receipt.paymentAmount + "," + Receipt.branch + "," + Receipt.OrderType + "," + Receipt.custId + ""); CommonFunctions.ShowError(form, ex.Message); } }
private void showReceiptNumber() { technovisionDataSetTableAdapters.receiptTableAdapter t = new technovisionDataSetTableAdapters.receiptTableAdapter(); string rno; string newRno; try { t.GetMaxReceipt(Session.BranchId, DateTime.Now.ToString("yyyy"), out rno); Console.WriteLine(rno); string BranchCharacter = rno.Substring(0, 1); newRno = BranchCharacter + (int.Parse(rno.Remove(0, 1)) + 1).ToString(); } catch (NullReferenceException ex) { newRno = Session.BranchName[0] + "1"; CommonFunctions.WriteToErrorLog(ex.Message.ToString()); } LblReceiptNo.Text = newRno; TechnoVision.model.Receipt.ReceiptNumber = newRno; }