Example #1
0
        public int SaveUpdateBillAccount(BillAccount obBillAcc, SqlConnection con, SqlTransaction trans)
        {
            int        ID  = 0;
            SqlCommand com = null;

            try
            {
                com             = new SqlCommand("", con, trans);
                com.CommandType = CommandType.StoredProcedure;
                com.Parameters.Add("@SlNo", SqlDbType.Int).Value      = obBillAcc.SlNo;
                com.Parameters.Add("@BillID", SqlDbType.Int).Value    = obBillAcc.BillID;
                com.Parameters.Add("@AccountID", SqlDbType.Int).Value = obBillAcc.AccountID;
                //com.Parameters.Add("@DrCr", SqlDbType.VarChar, 50).Value = obBillAcc.DrCr;
                com.Parameters.Add("@Particulars", SqlDbType.VarChar, 500).Value = obBillAcc.Particulars;
                //com.Parameters.Add("@Amount", SqlDbType.Money).Value = obBillAcc.Amount;
                com.ExecuteNonQuery();
                if (obBillAcc.SlNo == 0)
                {
                    SqlCommand cmd = new SqlCommand("SELECT ISNULL(MAX(SINo),0) FROM T_Export_Bill", con, trans);
                    ID = Convert.ToInt32(cmd.ExecuteScalar());
                }
                else
                {
                    ID = obBillAcc.SlNo;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(ID);
        }
        public int SaveUpdateBillAccount(BillAccount obBillAcc, SqlConnection con, SqlTransaction trans)
        {
            int        ID  = 0;
            SqlCommand com = null;

            try
            {
                com             = new SqlCommand("spSaveUpdateBillAccount", con, trans);
                com.CommandType = CommandType.StoredProcedure;
                com.Parameters.Add("@SlNo", SqlDbType.Int).Value                 = obBillAcc.SlNo;
                com.Parameters.Add("@BillID", SqlDbType.Int).Value               = obBillAcc.BillID;
                com.Parameters.Add("@AccountID", SqlDbType.Int).Value            = obBillAcc.AccountID;
                com.Parameters.Add("@Particulars", SqlDbType.VarChar, 500).Value = obBillAcc.Particulars;
                com.Parameters.Add("@DebitAmount", SqlDbType.Money).Value        = obBillAcc.DebitAmount;
                com.Parameters.Add("@CreditAmount", SqlDbType.Money).Value       = obBillAcc.CreditAmount;
                com.Parameters.Add("@posted", SqlDbType.Int).Value               = obBillAcc.Posted;
                com.Parameters.Add("@Ref", SqlDbType.VarChar, 50).Value          = obBillAcc.Reference;
                com.Parameters.Add("@VoucherType", SqlDbType.VarChar, 100).Value = obBillAcc.VoucherType;
                com.Parameters.Add("@VoucherSlNo", SqlDbType.Int).Value          = obBillAcc.VoucherSlNo;

                com.ExecuteNonQuery();
                //if (obBillAcc.SlNo == 0)
                //{
                //    SqlCommand cmd = new SqlCommand("SELECT ISNULL(MAX(SINo),0) FROM T_Bill_Accounts", con, trans);
                //    ID = Convert.ToInt32(cmd.ExecuteScalar());
                //}
                //else
                //    ID = obBillAcc.SlNo;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(ID);
        }
Example #3
0
 public int Save(BillAccount billaccount)
 {
     using (var db = GetDbContext())
     {
         db.BillAccounts.Add(billaccount);
         db.SaveChanges();
         return(billaccount.ID);
     }
 }
Example #4
0
 public BillAccountForm(BillAccount account)
 {
     InitializeComponent();
     this.BillAccount = account;
 }