public void Billing(BillingDTO billingInfo) { Customer c = Repo.GetWithID(((DareyaIdentity)HttpContext.Current.User.Identity).CustomerID); c.BillingID = billingInfo.BillingID; c.BillingType = billingInfo.BillingType; Repo.Update(c); }
public JsonResult Sell(BillingDTO billingDto) { billingDto.LastUpdatedUser = User.Identity.GetUserName(); long res = 0; if (billingDto.TransactionId == 0) { res = SellFromShopBLL.SellProduct(billingDto); } return(Json(Url.Action("Index", "Billing", new { transactionId = res }))); //return Json(res, JsonRequestBehavior.AllowGet); }
public RedirectToRouteResult SellProduct(BillingDTO billingDto) { billingDto.LastUpdatedUser = User.Identity.GetUserName(); long res = 0; if (billingDto.TransactionId == 0) { res = SellFromShopBLL.SellProduct(billingDto); } if (res > 0) { return(RedirectToAction("Index", "Billing", new { transactionId = res })); } return(null); }
public static BillingDTO GetBillingDetailsByTransationId(long transactionId) { string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; BillingDTO res = null; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); string cmdText = DBConstants.usp_getBillingDetailsbyTrxId; var sqlCommand = new SqlCommand(cmdText, connection); sqlCommand.Parameters.AddWithValue("@transactionId", transactionId); sqlCommand.CommandType = CommandType.StoredProcedure; SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(); var dataHelper = new DataHelper(); res = dataHelper.GetData(sqlDataReader, BillingDTO.Create).FirstOrDefault(); if (res != null) { res.Products = new List <Product>(); res.Products.AddRange(GetProductDetailsByTransationId(res.TransactionId)); } } return(res); }
public static long SellProduct(BillingDTO billingDto) { return(SellFromShopDAL.SellProduct(billingDto)); }
internal static long SellProduct(BillingDTO billingDto) { var transactionId = billingDto.TransactionId; if (billingDto != null) { string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); string cmdText = DBConstants.usp_saveBillingDetails; SqlCommand sqlCommand = new SqlCommand(cmdText, connection); sqlCommand.Parameters.AddWithValue("@overallDiscountRate", billingDto.OverallDiscountRate); sqlCommand.Parameters.AddWithValue("@overallDiscountAmount", billingDto.OverallDiscountAmount); sqlCommand.Parameters.AddWithValue("@CGSTRate", billingDto.CGSTRate); sqlCommand.Parameters.AddWithValue("@CGSTAmount", billingDto.CGSTAmount); sqlCommand.Parameters.AddWithValue("@SGSTRate", billingDto.SGSTRate); sqlCommand.Parameters.AddWithValue("@SGSTAmount", billingDto.SGSTAmount); sqlCommand.Parameters.AddWithValue("@IGSTRate", billingDto.IGSTRate); sqlCommand.Parameters.AddWithValue("@IGSTAmount", billingDto.IGSTAmount); sqlCommand.Parameters.AddWithValue("@AdditionalCharges", billingDto.AdditionalCharges); sqlCommand.Parameters.AddWithValue("@totalAmount", billingDto.TotalAmount); sqlCommand.Parameters.AddWithValue("@grandAmount", billingDto.GrandTotal); sqlCommand.Parameters.AddWithValue("@lastUpdatedUser", billingDto.LastUpdatedUser); sqlCommand.Parameters.AddWithValue("@transactionId", 0); sqlCommand.Parameters.AddWithValue("@customerMobile", billingDto.CustomerMobile); sqlCommand.Parameters.AddWithValue("@PaymentMethod", billingDto.PaymentMethod); sqlCommand.Parameters.AddWithValue("@uniqueIdentifier", billingDto.UniqueIdentifier); sqlCommand.Parameters.AddWithValue("@totalCount", billingDto.TotalCount); sqlCommand.CommandType = CommandType.StoredProcedure; SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(); if (sqlDataReader.Read()) { var res = sqlDataReader["TransactionId"].ToString(); long.TryParse(res, out transactionId); } } if (transactionId > 0) { foreach (var product in billingDto.Products) { using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); string cmdText = DBConstants.usp_saveProductsSoldAtShop; SqlCommand sqlCommand = new SqlCommand(cmdText, connection); sqlCommand.Parameters.AddWithValue("@barCode", product.BarCode); sqlCommand.Parameters.AddWithValue("@itemName", product.ItemName); sqlCommand.Parameters.AddWithValue("@quantity", product.Quantity); sqlCommand.Parameters.AddWithValue("@unitPrice", product.UnitPrice.ToString(CultureInfo.InvariantCulture)); sqlCommand.Parameters.AddWithValue("@value", product.Value.ToString(CultureInfo.InvariantCulture)); sqlCommand.Parameters.AddWithValue("@itemDiscountPercentage", product.ItemDiscountPercentage); sqlCommand.Parameters.AddWithValue("@itemDiscountAmount", product.ItemDiscountAmount.ToString(CultureInfo.InvariantCulture)); sqlCommand.Parameters.AddWithValue("@taxableValue", product.TaxableValue.ToString(CultureInfo.InvariantCulture)); sqlCommand.Parameters.AddWithValue("@billingTrxId", transactionId); sqlCommand.CommandType = CommandType.StoredProcedure; SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(); if (sqlDataReader.Read()) { var productId = Convert.ToInt32(sqlDataReader["ProductId"].ToString()); } } } } return(transactionId); } return(0); }