Undo the total amount round / A/R invoice - document total, field cannot be updated (odbc -1029) SAP B1 - sapb1

I am trying to undo the automatic total amount round in A/R RESERVEI NVOICE b1 on an add on extension.
The error throws after:
txtDocTotalAfterDiscountFreightCharge.Active = true;
txtDocTotalAfterDiscountFreightCharge.String = total.ToString();
with this error: Only if I undo the round on A/R RESERVEI NVOICE.
A/R invoice - document total, field cannot be updated (odbc -1029)
for A/R INVOICE it is working well.
[BasicSapForm(Consts.FORM_RESERVE_INVOICE)]
[BasicSapForm(Consts.FORM_INVOICE)]
class OinvListener : SapDocumentsForm
{
public OinvListener(string uniqueId, object extraInfo)
: base(uniqueId, extraInfo)
{
}
public override void Init()
{
}
[BasicSapEvent(SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE, "", true)]
[BasicSapEvent(SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD, "", true)]
private bool BeforeFormAdd(SAPbouiCOM.BusinessObjectInfo pVal)
{
if (MO_ModuleManager.Common.B1Starter.userModules.ContainsKey(ModuleInfo.Code))
{
if (MO_ModuleManager.Common.B1Starter.userModules.ContainsKey(ModuleInfo.SubCode2))
{
di.BusinessPartners diBp = SapUtils.GetDiObjectByFormTypeAndKey (Consts.FORM_BP, txtCardCode.String) as di.BusinessPartners;
if (diBp.UserFields.Fields.Item("U_RoundAum").Value.ToString() == "N")
{
double total = TypeUtils.ExtractDouble
(txtDocTotalAfterDiscountFreightCharge.String);
ui.EditText txtDisc = mForm.Items.Item("42").Specific as ui.EditText;
if (false == string.IsNullOrEmpty(txtDisc.String))
total += TypeUtils.ExtractDouble(txtDisc.String);
try
{
txtDocTotalAfterDiscountFreightCharge.Active = true;
txtDocTotalAfterDiscountFreightCharge.String = total.ToString();
}
catch { }
}
}
}
return true;
}
}

Related

Catch StatusCode from execution value in Xunit

I want to compare the return value from controller execution whether that fulfill the condition or not. From debugging I noticed the 'StatusCode' but not got an way to catch that value for comparing. My Code for testing is
public void PostAmount_Withdraw_Returns_Null()
{
// Arrange
Amount amount = new Amount() { Id = 0, PaymentDate = DateTime.Today,
PaymentTypeId = 3, PaymentAmount = 500, ClientId = 1, Balance = 0 };
_accountServiceMock.Setup(s => s.Withdraw(amount)).Throws(new Exception());
var target = SetupAmountsController();
//Act
var actual = target.PostAmount(amount);
//Assert
actual.ShouldNotBeNull();
//actual.Value.ShouldBe(response);
}
What call controller methods below : -
public ActionResult<Amount> PostAmount(Amount amount)
{
try
{
if (amount.PaymentTypeId == 1)
{
_accountService.Deposit(amount);
}
else if (amount.PaymentTypeId == 2)
{
_accountService.Withdraw(amount);
}
else
{
return Problem("Model 'Amounts' is null.");
}
return new OkObjectResult(new { Message = "Payment Success!" });
}
catch (DbUpdateConcurrencyException)
{
return Problem("There was error for updating model Payment");
}
}
And, returned the value after execution from Unit Test
I want to give condition likes below: -
actual.Result.StatusCode = HttpStatusCode.BadRequest or
actual.Result.StatusCode = 500
Just got the answer. It will be likes below: -
(actual.Result as ObjectResult).StatusCode.ShouldBe((int)HttpStatusCode.InternalServerError);
you need to define here 'status code' what want to compare. In my case it was 500.

Compare value stored in query to user's input

How do I get two input values compared to my query records?
For example, I enter 500 Double, and I want everyone who has over 500 Double on my list.
if I enter 300 Doubles and 150 Triples. Only display everybody who has more than 300 Doubles and more than 150 Triples. Right now, displays the doubles that are more than the input value.
namespace SQLiteIntegration
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
}
private void Button_Click(object sender, RoutedEventArgs e)
{
if (HasValidInput())
{
int doubles = int.Parse(DoublesTextBox.Text);
int triples = int.Parse(TriplesTextBox.Text);
//MARKER - Probably an error here
DataTable dt = new DataTable();
string datasource = #"Data Source=../../lahman2016.sqlite;";
//Batting.'2B' is the number of doubles a player hit in a season
//Batting.'3B' is the number of triples a player hit in a season
string sql = $"SELECT namefirst, namelast, sum(Batting.'2B'), sum(Batting.'3B') from Master JOIN Batting on Master.playerID = Batting.playerID GROUP BY Master.playerid HAVING SUM(Batting.'2B') AND SUM(Batting.'3B') > {doubles};";
using (SQLiteConnection conn = new SQLiteConnection(datasource))
{
conn.Open();
SQLiteDataAdapter da = new SQLiteDataAdapter(sql, conn);
da.Fill(dt);
conn.Close();
}
playerList.Clear();
foreach (DataRow row in dt.Rows)
{
// MARKER: Making something different show up
string playerRow = $"{row​[0].ToString()} {row​[1].ToString()} - 2B = {row​[2].ToString()}, 3B = {row​[3].ToString()}";
playerList.Add(playerRow);
}
populateList();
}
}
private List<string> playerList = new List<string>();
private void populateList()
{
ListView.Items.Clear();
foreach (string s in playerList)
{
ListView.Items.Add(s);
}
}
private string ValidateTextBox(TextBox box, string name)
{
string message = "";
string text = box.Text;
int amount = 0;
if (text == "")
box.Text = "0";
else
{
bool isNumber = int.TryParse(text, out amount);
if (!isNumber)
{
message += $"Invalid Input - {name} is not a number! ";
}
if (amount < 0)
{
message += $"Invalid Input - {name} is negative! ";
}
}
return message;
}
private bool HasValidInput()
{
string message = ValidateTextBox(DoublesTextBox, "Doubles") +
ValidateTextBox(TriplesTextBox, "Triples");
if (message == "")
{
return true;
}
else
{
MessageBox.Show(message);
return false;
}
}
}
}
I am expecting if I enter 300 Doubles and 150 Triples. Only display everybody who has more than 300 Doubles and more than 150 Triples. Right now, displays the doubles that are more than the input value.

Acumatica How to get the Cash Account Begin or Ending Balance?

When I select a Cash Account in the "Founds Transfers" (CA301000), GL Balance and Avaliable Balance Entries are updated.
Where these amounts come from? I mean, I need to query these field via GI but I cannot figure out the Table's name.
Any Clues?
GL Balance and Available Balance fields are part of the CATransfer DAC.
You won't find them in the CATransfer database table because they are calculated at runtime in CATransfer DAC as unbound fields using the FieldSelecting events of GLBalanceAttribute and CashBalanceAttribute.
You can find out the DAC and Data Field of a UI element by holding Ctl+Alt and clicking on that field.
For reference, here are the GLBalance attributes inCATransfer Dac:
#region InGLBalance
public abstract class inGLBalance : PX.Data.IBqlField
{
}
protected Decimal? _InGLBalance;
[PXDefault(TypeCode.Decimal, "0.0", PersistingCheck = PXPersistingCheck.Nothing)]
[PXCury(typeof(CATransfer.inCuryID))]
[PXUIField(DisplayName = "GL Balance", Enabled = false)]
[GLBalance(typeof(CATransfer.inAccountID), null, typeof(CATransfer.inDate))]
public virtual Decimal? InGLBalance
{
get
{
return this._InGLBalance;
}
set
{
this._InGLBalance = value;
}
}
#endregion
#region OutGLBalance
public abstract class outGLBalance : PX.Data.IBqlField
{
}
protected Decimal? _OutGLBalance;
[PXDefault(TypeCode.Decimal, "0.0", PersistingCheck = PXPersistingCheck.Nothing)]
[PXCury(typeof(CATransfer.outCuryID))]
[PXUIField(DisplayName = "GL Balance", Enabled = false)]
[GLBalance(typeof(CATransfer.outAccountID), null, typeof(CATransfer.outDate))]
public virtual Decimal? OutGLBalance
{
get
{
return this._OutGLBalance;
}
set
{
this._OutGLBalance = value;
}
}
#endregion
Here is the GLBalanceAttribute class FieldSelecting event where the value is calculated:
public virtual void FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)
{
GLSetup gLSetup = PXSelect<GLSetup>.Select(sender.Graph);
decimal? result = 0m;
object CashAccountID = sender.GetValue(e.Row, _CashAccount);
object FinPeriodID = null;
if (string.IsNullOrEmpty(_FinPeriodID))
{
object FinDate = sender.GetValue(e.Row, _FinDate);
FinPeriod finPeriod = PXSelect<FinPeriod, Where<FinPeriod.startDate, LessEqual<Required<FinPeriod.startDate>>,
And<FinPeriod.endDate, Greater<Required<FinPeriod.endDate>>>>>.Select(sender.Graph, FinDate, FinDate);
if (finPeriod != null)
{
FinPeriodID = finPeriod.FinPeriodID;
}
}
else
{
FinPeriodID = sender.GetValue(e.Row, _FinPeriodID);
}
if (CashAccountID != null && FinPeriodID != null)
{
// clear glhistory cache for ReleasePayments longrun
sender.Graph.Caches<GLHistory>().ClearQueryCache();
sender.Graph.Caches<GLHistory>().Clear();
GLHistory gLHistory = PXSelectJoin<GLHistory,
InnerJoin<GLHistoryByPeriod,
On<GLHistoryByPeriod.accountID, Equal<GLHistory.accountID>,
And<GLHistoryByPeriod.branchID, Equal<GLHistory.branchID>,
And<GLHistoryByPeriod.ledgerID, Equal<GLHistory.ledgerID>,
And<GLHistoryByPeriod.subID, Equal<GLHistory.subID>,
And<GLHistoryByPeriod.lastActivityPeriod, Equal<GLHistory.finPeriodID>>>>>>,
InnerJoin<Branch,
On<Branch.branchID, Equal<GLHistory.branchID>,
And<Branch.ledgerID, Equal<GLHistory.ledgerID>>>,
InnerJoin<CashAccount,
On<GLHistoryByPeriod.branchID, Equal<CashAccount.branchID>,
And<GLHistoryByPeriod.accountID, Equal<CashAccount.accountID>,
And<GLHistoryByPeriod.subID, Equal<CashAccount.subID>>>>,
InnerJoin<Account,
On<GLHistoryByPeriod.accountID, Equal<Account.accountID>,
And<Match<Account, Current<AccessInfo.userName>>>>,
InnerJoin<Sub,
On<GLHistoryByPeriod.subID, Equal<Sub.subID>, And<Match<Sub, Current<AccessInfo.userName>>>>>>>>>,
Where<CashAccount.cashAccountID, Equal<Required<CashAccount.cashAccountID>>,
And<GLHistoryByPeriod.finPeriodID, Equal<Required<GLHistoryByPeriod.finPeriodID>>>
>>.Select(sender.Graph, CashAccountID, FinPeriodID);
if (gLHistory != null)
{
result = gLHistory.CuryFinYtdBalance;
}
}
e.ReturnValue = result;
e.Cancel = true;
}
}
Here are the CashBalance attributes of CATransfer Dac:
#region CashBalanceIn
public abstract class cashBalanceIn : PX.Data.IBqlField
{
}
protected Decimal? _CashBalanceIn;
[PXDefault(TypeCode.Decimal, "0.0", PersistingCheck = PXPersistingCheck.Nothing)]
[PXCury(typeof(CATransfer.inCuryID))]
[PXUIField(DisplayName = "Available Balance", Enabled = false)]
[CashBalance(typeof(CATransfer.inAccountID))]
public virtual Decimal? CashBalanceIn
{
get
{
return this._CashBalanceIn;
}
set
{
this._CashBalanceIn = value;
}
}
#endregion
#region CashBalanceOut
public abstract class cashBalanceOut : PX.Data.IBqlField
{
}
protected Decimal? _CashBalanceOut;
[PXDefault(TypeCode.Decimal, "0.0", PersistingCheck = PXPersistingCheck.Nothing)]
[PXCury(typeof(CATransfer.outCuryID))]
[PXUIField(DisplayName = "Available Balance", Enabled = false)]
[CashBalance(typeof(CATransfer.outAccountID))]
public virtual Decimal? CashBalanceOut
{
get
{
return this._CashBalanceOut;
}
set
{
this._CashBalanceOut = value;
}
}
#endregion
And the CashBalanceAttribute class FieldSelecting event where the value is calculated:
public virtual void FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)
{
CASetup caSetup = PXSelect<CASetup>.Select(sender.Graph);
decimal? result = 0m;
object CashAccountID = sender.GetValue(e.Row, _CashAccount);
CADailySummary caBalance = PXSelectGroupBy<CADailySummary,
Where<CADailySummary.cashAccountID, Equal<Required<CADailySummary.cashAccountID>>>,
Aggregate<Sum<CADailySummary.amtReleasedClearedCr,
Sum<CADailySummary.amtReleasedClearedDr,
Sum<CADailySummary.amtReleasedUnclearedCr,
Sum<CADailySummary.amtReleasedUnclearedDr,
Sum<CADailySummary.amtUnreleasedClearedCr,
Sum<CADailySummary.amtUnreleasedClearedDr,
Sum<CADailySummary.amtUnreleasedUnclearedCr,
Sum<CADailySummary.amtUnreleasedUnclearedDr>>>>>>>>>>.
Select(sender.Graph, CashAccountID);
if ((caBalance != null) && (caBalance.CashAccountID != null))
{
result = caBalance.AmtReleasedClearedDr - caBalance.AmtReleasedClearedCr;
if ((bool)caSetup.CalcBalDebitClearedUnreleased)
result += caBalance.AmtUnreleasedClearedDr;
if ((bool)caSetup.CalcBalCreditClearedUnreleased)
result -= caBalance.AmtUnreleasedClearedCr;
if ((bool)caSetup.CalcBalDebitUnclearedReleased)
result += caBalance.AmtReleasedUnclearedDr;
if ((bool)caSetup.CalcBalCreditUnclearedReleased)
result -= caBalance.AmtReleasedUnclearedCr;
if ((bool)caSetup.CalcBalDebitUnclearedUnreleased)
result += caBalance.AmtUnreleasedUnclearedDr;
if ((bool)caSetup.CalcBalCreditUnclearedUnreleased)
result -= caBalance.AmtUnreleasedUnclearedCr;
}
e.ReturnValue = result;
e.Cancel = true;
}
}

Java.lang.String errors & not printing to error file

For this project the end result was for there to be 2 error reports sent to an error file at as well as a listing of account summary information printed out. While i can get a majority of the account information printed out such as Balance before transaction and transaction to the account or if there were insufficient funds for the transaction, that's all that will print out as it should be. I'm receiving no errors or exceptions so i'm in all honesty not too sure where the issue at hand may be. I was hoping a second pair of eyes on my code could possibly point out where my issue may be, below is my code of the Account.java, CheckingAccount.java CreditCard.java and lastly D4.java which contains the main method.
Account.java
public class Account {
protected String accountNo, institution, name;
protected double balance;
public Account (String accountNo, String name, String institution, double balance) {
this.name = name;
this.accountNo = accountNo;
this.balance = balance;
this.institution = institution;
}
public String getAccount() {
return accountNo;
}
public boolean debitAccount(double amt) {
return false;
}
public boolean creditAccount(double amt) {
return false;
}
}
CheckingAccount.java
public class CheckingAccount extends Account {
public CheckingAccount(String acctNo, String name, String inst, double balance) {
super(acctNo, name, inst, balance);
this.name = name;
this.accountNo = acctNo;
this.balance = balance;
this.institution = institution;
}
public double getBalance()
{
return balance;
}
public boolean debitAccount(double amt) {
balance += amt;
return false;
}
public boolean creditAccount(double amt) {
balance -= amt;
return false;
}
}
CreditCard.java
public class CreditCard extends Account {
private double creditLimit;
private double availableCredit;
public CreditCard(String acctNo, String name, String inst, double limit, double balance) {
super(acctNo, name, inst, 0);
this.creditLimit = creditLimit;
this.availableCredit = availableCredit;
this.balance = balance;
}
public boolean debitAccount(double amt) {
balance -= amt;
return false;
}
public double getCreditLimit(){
return creditLimit;
}
public double getBalance()
{
return balance;
}
public boolean creditAccount(double amt) {
balance += amt;
return false;
}
}
D4.java
import java.io.*;
import java.util.*;
public class D4 {
public static void main(String[] args) throws FileNotFoundException
{
Boolean valid;
String transactionFile = args[0];
String theaccount, transaction;
File transactions = new File(transactionFile);
Scanner infile = new Scanner(transactions);
File errorFile = new File(args[1]);
PrintWriter error = new PrintWriter(errorFile);
Vector<Account> account = new Vector<Account>();
while(infile.hasNext())
{
transaction = infile.nextLine();
valid = performTrans(account, transaction, error, errorFile);
}
}
private static Account findAccount(Vector<Account> a, String acctNo) {
for(int index = 0; index < a.size(); index ++)
{
if (a.elementAt(index).getAccount().equals(acctNo))
{
return a.elementAt(index);
}
}
return null;
}
private static boolean Checkingacct(Account a)
{
if(a instanceof CheckingAccount)
{
return true;
}
else
{
return false;
}
}
private static boolean Creditcrd(Account a)
{
if(a instanceof CreditCard)
{
return true;
}
else
{
return false;
}
}
private static String errorLog(Vector<Account> a, String transaction)
{
String[] trans = transaction.split(":");
String error;
if(findAccount(a, trans[1])==null)
{
error = ("Invalid account: " + transaction);
System.out.println(error);
return error;
}
else
{
Account acc = findAccount(a, trans[1]);
if( trans[0] == "debit")
{
error = ("Transaction denied: " + transaction);
System.out.println(error);
return error;
}
else
{
return null;
}
}
}
private static boolean performTrans(Vector<Account> account, String transaction, PrintWriter log, File errorFile)
{
String[] pieces = transaction.split(":");
String trans = pieces[0];
System.out.println(pieces);
if(trans.equals("create"))
{
if( pieces[1].equals("checking"))
{
CheckingAccount checking = new CheckingAccount(pieces[2], pieces[3], pieces[4], Double.parseDouble(pieces[5]));
account.add(checking);
return true;
}
else if (pieces[1].equals("credit"))
{
CreditCard creditCard = new CreditCard(pieces[2], pieces[3], pieces[4], 0, Double.parseDouble(pieces[5]));
account.add(creditCard);
return true;
}
else
{
System.out.println("not sure what to put here");
return false;
}
}
else if(trans.equals("debit"))
{
if(findAccount(account, pieces[1]) == null)
{
return false;
}
else
{
Account a = findAccount(account, pieces[1]);
double amount = Double.parseDouble(pieces[2]);
if(Checkingacct(a) == true)
{
CheckingAccount checking = (CheckingAccount) a;
System.out.println("Balance before transaction: " + checking.getBalance());
checking.creditAccount(amount);
System.out.println("Transaction to account: " + amount);
System.out.println("Balance after transaction: " + checking.getBalance() + "\n");
return true;
}
else if(Creditcrd(a) == true)
{
CreditCard creditCard = (CreditCard) a;
System.out.println("Balance before transaction: " + creditCard.getBalance());
System.out.println("Transaction to account: " + amount);
if(amount + creditCard.getBalance() > creditCard.getCreditLimit())
{
System.out.println("Insufficient funds for transaction");
return false;
}
else
{
creditCard.creditAccount(amount);
return true;
}
}
}
}
else if(trans.equals("credit"))
{
if(findAccount(account, pieces[1]) == null)
{
System.out.println("Print Error Message");
return false;
}
else
{
Account a = findAccount(account, pieces[1]);
double amount = Double.parseDouble(pieces[2]);
if(Creditcrd(a) == true)
{
CheckingAccount checking = (CheckingAccount) a;
System.out.println("Balance before transaction: " + checking.getBalance());
checking.debitAccount(amount);
System.out.println("Transaction to account: " + amount);
System.out.println("Balance after transaction: " + checking.getBalance() + "\n");
return true;
}
else if(Creditcrd(a) == true)
{
CreditCard creditCard = (CreditCard) a;
System.out.println(creditCard.getBalance());
return true;
}
}
}
else if(trans.equals("report"))
{
return true;
}
return false;
}
}
The text file im attempting to read from is called D4.txt and the information inside of it is
create:checking:10-3784665:Chase:Joe Holder:2000
create:credit:1234567898765432:First Card:Bob Badger:4000
create:checking:11-3478645:Dime:Melissa Martin:1000
report
debit:10-3784665:523.67
debit:1234567898765432:3500
credit:10-3784665:50
credit:11-3478645:30
debit:10-839723:200
debit:1234567898765432:600
report
The two errors im supposed to be able to print out and see in the errorFile.txt or whatever you choose to call it is and is where the main problem is as this information for some reason is not being processed and printed onto the outputfle.
Invalid account: debit:10839723:200
Transaction denied: debit:1234567898765432:600
The information printed to the console is supposed to look like
Account Summary:
Checking account #103784665
Bank: Chase
Name on account: Joe Holder
Balance: 1526.33
Credit Account #1234567898765432
Bank: First Card
Issued to: Bob Badger
Credit Limit: 4000
Balance: 3500.00
Available credit: 500.00
Checking account #113478645
Bank: Dime
Name on account: Melissa Martin
Balance: 1030.00
End account summary.
But this is also a part of the issue as currently when i run the code whats being printed out to the console is
run D4 d4.txt errorFile.txt
[Ljava.lang.String;#1d540a51
[Ljava.lang.String;#b31c562
[Ljava.lang.String;#3db12bab
[Ljava.lang.String;#4ff0c6b8
[Ljava.lang.String;#4d40d320
Balance before transaction: 2000.0
Transaction to account: 523.67
Balance after transaction: 1476.33
[Ljava.lang.String;#2c9cc42e
Balance before transaction: 4000.0
Transaction to account: 3500.0
Insufficient funds for transaction
[Ljava.lang.String;#2bb07c61
[Ljava.lang.String;#483b594b
[Ljava.lang.String;#31470572
[Ljava.lang.String;#20aedee
Balance before transaction: 4000.0
Transaction to account: 600.0
Insufficient funds for transaction
[Ljava.lang.String;#2ea4aa4d
I know this is a lot of information to sort through and i just want to thank anyone and everyone in advance for your help and hope its something simple that im just overlooking!

How to rollback a transaction in EntityFramework?

I have two database tables named Courses and Transactions.Courses stores the details of a particular course and Transactions table stores the details of the transactions performed by a particular user.
My question is how can I make sure that entry in the CourseTable is saved only when transactions(add,edit,delete) regarding that particular course is saved into the TransactionTable
CourseTable is
TransactionTable is
Controller is
POST: /Course/Add
[HttpPost]
public ActionResult Add(CourseVM _mdlCourseVM)
{
string actionName=this.ControllerContext.RouteData.Values["action"].ToString();
string controllerName=this.ControllerContext.RouteData.Values["controller"].ToString();
Course _course = new Course();
_course.Duration = _mdlCourseVM.Course.Duration;
_course.DurationMode = _mdlCourseVM.DurationModeId;
_course.InstalmentFee = _mdlCourseVM.Course.InstalmentFee;
_course.Name = _mdlCourseVM.Course.Name;
_course.SingleFee = _mdlCourseVM.Course.SingleFee;
_db.Courses.Add(_course);
int i = _db.SaveChanges();
if (i > 0)
{
Common _cmn=new Common();
//Add the transaction details
int k=_cmn.AddTransactions(actionName,controllerName,"");
//Want to commit changes to the coursetable here
if(k>0){
_db.commitTransaction()
}
//Want to rollback the committed transaction
else{
_db.rollbackTransaction();
}
}
}
I solved the above scenario by using System.Transactions.Hope anyone with same scenario find it useful.
using (TransactionScope _ts = new TransactionScope())
{
string actionName = this.ControllerContext.RouteData.Values["action"].ToString();
string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
Course _course = new Course();
_course.Duration = _mdlCourseVM.Course.Duration;
_course.DurationMode = _mdlCourseVM.DurationModeId;
_course.InstalmentFee = _mdlCourseVM.Course.InstalmentFee;
_course.Name = _mdlCourseVM.Course.Name;
_course.SingleFee = _mdlCourseVM.Course.SingleFee;
_db.Courses.Add(_course);
int i = _db.SaveChanges();
if (i > 0)
{
Common _cmn = new Common();
int k = _cmn.AddTransactions(actionName, controllerName, "",Session["UserId"].ToString());
if (k > 0)
{
_ts.Complete();
return Json(new { message = "success" }, JsonRequestBehavior.AllowGet);
}
else
{
return Json(new { message = "error" }, JsonRequestBehavior.AllowGet);
}
}
else
{
return Json(new { message = "error" }, JsonRequestBehavior.AllowGet);
}
}
}