public IHttpActionResult DeleteCurrencyMaster(CurrencyMaster _CurrencyMaster) { string status = string.Empty; try { CurrencyMaster obj_CurrencyMasterDetails = _commonList.GetCurrencyMasterById(_CurrencyMaster.Id); obj_CurrencyMasterDetails.Deactivate = "Y"; obj_CurrencyMasterDetails.DeactivateBy = _CurrencyMaster.EnteredBy; obj_CurrencyMasterDetails.DeactivateDate = DateTime.Now; _commonList.UpdateCurrencyMaster(obj_CurrencyMasterDetails); status = _localizationService.GetResource("Master.API.Success.Message"); } catch (ACSException ex) { _ILog.LogException("", Severity.ProcessingError, "MasterController.cs", "DeleteCurrencyMaster", ex); status = ex.InnerException.Message; } catch (Exception ex) { _ILog.LogException("", Severity.ProcessingError, "MasterController.cs", "DeleteCurrencyMaster", ex); status = ex.InnerException.Message; } return(Json(status)); }
public CurrencyMaster Update(CurrencyMaster CR, string userid) { var sqlQuery = string.Format(@"UPDATE CURRENCYMASTER SET IDCURRENCY = '{0}', CURRENCYNAME = '{1}', UPDATEBY = {2}, UPDATEDATE = '{3}' WHERE SID = {4}", CR.IDCURRENCY, CR.CURRENCYNAME, Convert.ToInt32(userid), DateTime.Now, CR.SID); this._db.Execute(sqlQuery, CR); return(CR); }
// // GET: /CurrencyMaster/Delete/5 //public ActionResult Delete(int id = 0) //{ // CurrencyMaster currencymaster = db.CurrencyMasters.Find(id); // if (currencymaster == null) // { // return HttpNotFound(); // } // return View(currencymaster); //} // // POST: /CurrencyMaster/Delete/5 //[HttpPost, ActionName("Delete")] public ActionResult DeleteConfirmed(int id) { CurrencyMaster currencymaster = db.CurrencyMasters.Find(id); db.CurrencyMasters.Remove(currencymaster); db.SaveChanges(); ViewBag.SuccessMsg = "You have successfully deleted Currency."; return(View("Index", db.CurrencyMasters.ToList())); }
public CurrencyMaster Add(CurrencyMaster CR, string userid) { var sqlQuery = @"INSERT INTO CurrencyMaster (IDCURRENCY, CURRENCYNAME, INPUTBY, INPUTDATE, UPDATEBY, UPDATEDATE) VALUES ('" + CR.IDCURRENCY + @"', '" + CR.CURRENCYNAME + "', " + Convert.ToInt32(userid) + ", '" + DateTime.Now + @"', " + Convert.ToInt32(userid) + ", '" + DateTime.Now + @"'); " + "SELECT CAST(SCOPE_IDENTITY() as int)"; var SID = _db.Query <int>(sqlQuery, CR).Single(); CR.SID = SID; return(CR); }
public void InsertCurrencyMaster(CurrencyMaster _CurrencyMaster) { _CurrencyMaster.Deactivate = "N"; _CurrencyMaster.EntryDate = DateTime.Now; _CurrencyMaster.ModifiedBy = null; _CurrencyMaster.ModifiedDate = null; _CurrencyMaster.DeactivateBy = null; _CurrencyMaster.DeactivateDate = null; _CurrencyRepository.Insert(_CurrencyMaster); }
// // GET: /Currency/Details/5 public ActionResult Details(int id = 0) { CurrencyMaster currencymaster = db.CurrencyMasters.Find(id); if (currencymaster == null) { return(HttpNotFound()); } return(View(currencymaster)); }
public IHttpActionResult WebGetaCUrrencyByDefault() { CurrencyMaster _currency = _CurrencyMaster.Table.Where(a => a.Symbol == "INR" && a.Deactivate == "N").FirstOrDefault(); var _currencyList = new { CurrencyCode = _currency.Id }; return(Json(SerializeObj.SerializeObject(new { _currencyList }))); }
public async Task Update(CurrencyMaster currencyMaster) { try { _context.Entry(currencyMaster).State = EntityState.Modified; await _context.SaveChangesAsync(); } catch (Exception ex) { throw ex; } }
public static string[] GetCompletionList(string prefixText, int count, string contextKey) { CurrencyMaster Curr = new CurrencyMaster(); DataTable dt = Curr.GetDistinctCurrencyName(prefixText); string[] str = new string[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { str[i] = dt.Rows[i]["Currency_Name"].ToString(); } return(str); }
public async Task <IActionResult> PostCurrency([FromBody] CurrencyMaster obj) { if (!ModelState.IsValid) { return(Ok(ModelState.ResponseValidation())); } obj.IsActive = true; await _ICurrency_Repository.Insert(obj); return(Ok(APIResponse.SetResponse(APIResponseStatus.Ok, "Currency save successfully.", APIOpStatus.Success, obj))); }
public IHttpActionResult getCurrencyMasterDetailsById(int Id) { CurrencyMaster obj_CurrencyMaster = _commonList.GetCurrencyMasterById(Id); var obj_Details = new { Id = obj_CurrencyMaster.Id, CurrencyName = obj_CurrencyMaster.CurrencyName, SymbolName = obj_CurrencyMaster.Symbol, }; return(Json(obj_Details)); }
public ActionResult Edit(CurrencyMaster currencymaster) { if (ModelState.IsValid) { db.Entry(currencymaster).State = EntityState.Modified; db.SaveChanges(); ViewBag.SuccessMsg = "You have successfully updated Currency."; return(View("Index", db.CurrencyMasters.ToList())); } return(View(currencymaster)); }
/// <summary> /// Method to Insert new CurrencyMasterData /// </summary> /// <param name="currencyMaster"></param> /// <returns></returns> public async Task <long> AddCurrencyMasterAsync(CurrencyMaster currencyMaster) { await currencyExchangeDBContext.CurrencyMasters.AddAsync(currencyMaster); if (await currencyExchangeDBContext.SaveChangesAsync() == 1) { return(currencyMaster.Id); } else { return(0); } }
public async Task Insert(CurrencyMaster currencyMaster) { try { await _context.CurrencyMaster.AddAsync(currencyMaster); await _context.SaveChangesAsync(); } catch (Exception ex) { throw ex; } }
// // GET: /CurrencyMaster/Edit/5 public ActionResult Edit(int id = 0) { CurrencyMaster currencymaster = db.CurrencyMasters.Find(id); if (currencymaster == null) { return(HttpNotFound()); } var data = db.CountryMasters.OrderBy(x => x.CountryName).ToList(); ViewBag.country = data; return(View(currencymaster)); }
public ActionResult DeleteConfirmed(int id) { try { CurrencyMaster currencymaster = db.CurrencyMasters.Find(id); db.CurrencyMasters.Remove(currencymaster); db.SaveChanges(); TempData["SuccessMsg"] = "You have successfully Deleted Currency."; } catch (Exception ex) { TempData["ErrorMsg"] = "Can Not Delete This Currency. Already in Use."; } return(RedirectToAction("Index")); }
//added on 04 Jan, 2018 public string CurrencyDuplicityCheck(CurrencyMaster _CurrencyMaster) { var dupes = _CurrencyRepository.Table.Where(x => x.CurrencyName.Trim().ToLower() == _CurrencyMaster.CurrencyName.Trim().ToLower() && x.Symbol.Trim().ToLower() == _CurrencyMaster.Symbol.Trim().ToLower() && x.Deactivate == "N" && (_CurrencyMaster.Id != 0 ? x.Id : 0) != (_CurrencyMaster.Id != 0 ? _CurrencyMaster.Id : 1)).FirstOrDefault(); if (dupes != null) { return("N"); } else { return("Y"); } }
/// <summary> /// This method is to retrieve CurrencyMasterData from APIResponse and insert to DB /// </summary> /// <param name="aPIResponse"></param> /// <returns></returns> public async Task <long> InsertCurrencyMaster(APIResponse aPIResponse) { try { CurrencyMaster currencyMaster = new CurrencyMaster(); DateTime? checkDate = _calculationHelper.CheckIfDatetime(aPIResponse.date); currencyMaster.ApplicableOn = (checkDate != null) ? Convert.ToDateTime(checkDate) : DateTime.Now; currencyMaster.UpdatedDate = DateTime.Now; return(await _exchangeRatesService.AddCurrencyMasterAsync(currencyMaster)); } catch (Exception ex) { _logger.LogError("Error while inserting data to database as: " + ex.Message); return(0); } }
public JsonResult Edit(CurrencyMaster currencymaster, string userid) { try { if (ModelState.IsValid) { ICM.Update(currencymaster, Session["userid"].ToString()); } } catch { return(Json("error")); } return(Json("success")); }
public JsonResult EditCurrency(CurrencyMaster currencyMaster) { try { if (ModelState.IsValid) { currencyMaster.UpdatedDate = DateTime.Now; _repository.Update(currencyMaster); return(Json(Functions.OutPutResponse(true, "Data Updated Succfully", currencyMaster))); } return(Json(Functions.OutPutResponse(false, "Invalid Data"))); } catch (Exception ex) { return(Json(Functions.OutPutResponse(false, ex.Message))); } }
public JsonResult SaveCurrency(CurrencyMaster currencyMaster) { try { if (ModelState.IsValid) { currencyMaster.CreatedDate = DateTime.Now; currencyMaster.UpdatedDate = DateTime.Now; currencyMaster.IsDeleted = false; _repository.Insert(currencyMaster); _repository.Save(); return(Json(Functions.OutPutResponse(true, "Data Inserted Succfully", currencyMaster))); } return(Json(Functions.OutPutResponse(false, "Invalid Data"))); } catch (Exception ex) { return(Json(Functions.OutPutResponse(false, ex.Message))); } }
public ActionResult Create(CurrencyMaster currencymaster) { var data = db.CountryMasters.OrderBy(x => x.CountryName).ToList(); ViewBag.country = data; var query = (from t in db.CurrencyMasters where t.CurrencyName == currencymaster.CurrencyName select t).ToList(); if (query.Count > 0) { ViewBag.SuccessMsg = "Currency name is already exist"; return(View()); } currencymaster.CurrencyID = obj.GetMaxNumberCurrency(); db.CurrencyMasters.Add(currencymaster); db.SaveChanges(); ViewBag.SuccessMsg = "You have successfully added Currency."; return(View("Index", db.CurrencyMasters.ToList())); }
public IHttpActionResult InsertCurrencyMaster(CurrencyMaster _CurrencyMaster) { string status = ""; try { status = _commonList.CurrencyDuplicityCheck(_CurrencyMaster); if (status == "Y") { if (_CurrencyMaster.Id == 0) { _commonList.InsertCurrencyMaster(_CurrencyMaster); status = _localizationService.GetResource("Master.API.Success.Message"); } else { CurrencyMaster obj_CurrencyMasterDetails = _commonList.GetCurrencyMasterById(_CurrencyMaster.Id); obj_CurrencyMasterDetails.CurrencyName = _CurrencyMaster.CurrencyName; obj_CurrencyMasterDetails.Symbol = _CurrencyMaster.Symbol; obj_CurrencyMasterDetails.ModifiedBy = _CurrencyMaster.EnteredBy; obj_CurrencyMasterDetails.ModifiedDate = DateTime.Now; _commonList.UpdateCurrencyMaster(obj_CurrencyMasterDetails); status = _localizationService.GetResource("Master.API.Success.Message"); } } else { status = "Duplicate"; } } catch (ACSException ex) { _ILog.LogException("", Severity.ProcessingError, "MasterController.cs", "InsertCurrencyMaster", ex); status = ex.InnerException.Message; } catch (Exception ex) { _ILog.LogException("", Severity.ProcessingError, "MasterController.cs", "InsertCurrencyMaster", ex); status = ex.InnerException.Message; } return(Json(status)); }
public ActionResult Edit(CurrencyVM v) { CurrencyMaster c = new CurrencyMaster(); c.CurrencyID = v.CurrencyID; c.CurrencyName = v.CurrencyName; c.Symbol = v.Symbol; c.NoOfDecimals = v.NoOfDecimals; c.CountryID = v.CountryID; c.StatusBaseCurrency = v.StatusBaseCurrency; c.MonetaryUnit = v.MonetaryUnit; if (ModelState.IsValid) { db.Entry(c).State = EntityState.Modified; db.SaveChanges(); TempData["SuccessMsg"] = "You have successfully Updated Currency."; return(RedirectToAction("Index")); } return(View()); }
public ActionResult Create(CurrencyVM v) { if (ModelState.IsValid) { CurrencyMaster ob = new CurrencyMaster(); int max = (from d in db.CurrencyMasters orderby d.CurrencyID descending select d.CurrencyID).FirstOrDefault(); if (max == null) { ob.CurrencyID = 1; ob.CurrencyName = v.CurrencyName; ob.Symbol = v.Symbol; ob.NoOfDecimals = v.NoOfDecimals; ob.CountryID = v.CountryID; ob.StatusBaseCurrency = v.StatusBaseCurrency; ob.MonetaryUnit = v.MonetaryUnit; } else { ob.CurrencyID = max + 1; ob.CurrencyName = v.CurrencyName; ob.Symbol = v.Symbol; ob.NoOfDecimals = v.NoOfDecimals; ob.CountryID = v.CountryID; ob.StatusBaseCurrency = v.StatusBaseCurrency; ob.MonetaryUnit = v.MonetaryUnit; } db.CurrencyMasters.Add(ob); db.SaveChanges(); TempData["SuccessMsg"] = "You have successfully added Currency."; return(RedirectToAction("Index")); } return(View()); }
public async Task <IActionResult> PutCurrency([FromRoute] int id, [FromBody] CurrencyMaster obj) { obj.CurrencyId = id; if (!ModelState.IsValid) { return(Ok(ModelState.ResponseValidation())); } if (id != obj.CurrencyId) { return(BadRequest()); } try { obj.IsActive = true; await _ICurrency_Repository.Update(obj); } catch (Exception ex) { return(Ok(APIResponse.SetResponse(APIResponseStatus.Error, ex.Message, APIOpStatus.Error, null))); } return(Ok(APIResponse.SetResponse(APIResponseStatus.Ok, "Currency updated successfully.", APIOpStatus.Success, obj))); }
public IHttpActionResult UpdateNewCurrencyMaster(CurrencyMaster currencyMaster) { return(Ok(this._rfqBusenessAcess.UpdateNewCurrencyMaster(currencyMaster))); }
public void UpdateCurrencyMaster(CurrencyMaster _CurrencyMaster) { _CurrencyRepository.Update(_CurrencyMaster); }
protected void Page_Load(object sender, EventArgs e) { int recpayid = 32998; recpayid = Convert.ToInt32(Request.QueryString["recpayid"].ToString()); int?currencyId = 0; ////int JobID = 2; //int JobID = 6764; //JobID = Convert.ToInt32(JobID); //int acid = 0; //if (jobid == "") //{ // acid = 0; //} //else //{ // acid = Convert.ToInt32(jobid); //} decimal?totalamt = 0; SHIPPING_FinalEntities entity = new SHIPPING_FinalEntities(); ReportViewer1.SizeToReportContent = true; ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Reports/SupplierPayment.rdlc"); ReportViewer1.LocalReport.DataSources.Clear(); DataTable dtcompany = new DataTable(); dtcompany.Columns.Add("CompanyName"); dtcompany.Columns.Add("Address1"); dtcompany.Columns.Add("Address2"); dtcompany.Columns.Add("Address3"); dtcompany.Columns.Add("Phone"); dtcompany.Columns.Add("AcHead"); dtcompany.Columns.Add("Todate"); var company = entity.AcCompanies.FirstOrDefault(); string imagePath = new Uri(Server.MapPath("~/Content/Logo/" + company.logo)).AbsoluteUri; DataRow dr = dtcompany.NewRow(); dr[0] = company.AcCompany1; dr[1] = company.Address1; dr[2] = company.Address2; dr[3] = company.Address3; dr[4] = company.Phone; dr[5] = imagePath; dr[6] = DateTime.Now; dtcompany.Rows.Add(dr); var receipt = (from d in entity.RecPays where d.RecPayID == recpayid select d).FirstOrDefault(); totalamt = receipt.FMoney; if (receipt.IsTradingReceipt == true) { var recpaydetails = (from d in entity.RecPayDetails where d.RecPayID == recpayid where d.InvoiceID > 0 select d).ToList(); var cust = entity.Suppliers.Where(d => d.SupplierID == receipt.SupplierID).FirstOrDefault(); var listofdet = new List <ReportCustomerReceipt_Result>(); foreach (var item in recpaydetails) { var sinvoicedet = (from d in entity.PurchaseInvoiceDetails where d.PurchaseInvoiceDetailID == item.InvoiceID select d).FirstOrDefault(); var currency = recpaydetails.Where(d => d.CurrencyID > 0).FirstOrDefault(); if (currency != null) { currencyId = currency.CurrencyID; } var sinvoice = (from d in entity.PurchaseInvoices where d.PurchaseInvoiceID == sinvoicedet.PurchaseInvoiceID select d).FirstOrDefault(); var customerrecpay = new ReportCustomerReceipt_Result(); customerrecpay.Date = receipt.RecPayDate.Value.ToString("dd-MMM-yyyy"); customerrecpay.ReceivedFrom = cust.SupplierName; customerrecpay.DocumentNo = receipt.DocumentNo; customerrecpay.Amount = Convert.ToDecimal(receipt.FMoney); customerrecpay.Remarks = receipt.Remarks; customerrecpay.Account = receipt.BankName; if (receipt.ChequeDate != null) { customerrecpay.ChequeDate = receipt.ChequeDate.Value.ToString("dd-MMM-yyyy"); } else { customerrecpay.ChequeDate = ""; } if (!string.IsNullOrEmpty(receipt.ChequeNo)) { customerrecpay.ChequeNo = Convert.ToDecimal(receipt.ChequeNo); } customerrecpay.CustomerBank = ""; customerrecpay.DetailDocNo = sinvoice.PurchaseInvoiceNo; customerrecpay.DocDate = sinvoice.PurchaseInvoiceDate.Value.ToString("dd-MMM-yyyy"); customerrecpay.DocAmount = Convert.ToDecimal(sinvoicedet.NetValue); if (item.Amount > 0) { customerrecpay.SettledAmount = Convert.ToDecimal(item.Amount); customerrecpay.AdjustmentAmount = Convert.ToInt32(item.AdjustmentAmount); } else { customerrecpay.SettledAmount = Convert.ToDecimal(item.Amount); customerrecpay.AdjustmentAmount = Convert.ToInt32(item.AdjustmentAmount); } listofdet.Add(customerrecpay); } ReportDataSource _rsource; //var dd = entity.ReportCustomerReceipt(recpayid).ToList(); _rsource = new ReportDataSource("ReceiptVoucher", listofdet); ReportViewer1.LocalReport.DataSources.Add(_rsource); } else { var recpaydetails = (from d in entity.RecPayDetails where d.RecPayID == recpayid where d.InvoiceID > 0 select d).ToList(); var currency = recpaydetails.Where(d => d.CurrencyID > 0).FirstOrDefault(); if (currency != null) { currencyId = currency.CurrencyID; } var cust = entity.Suppliers.Where(d => d.SupplierID == receipt.SupplierID).FirstOrDefault(); var listofdet = new List <ReportCustomerReceipt_Result>(); foreach (var item in recpaydetails) { var sinvoicedet = (from d in entity.JInvoices where d.InvoiceID == item.InvoiceID select d).FirstOrDefault(); var sinvoice = (from d in entity.JobGenerations where d.JobID == sinvoicedet.JobID select d).FirstOrDefault(); var customerrecpay = new ReportCustomerReceipt_Result(); customerrecpay.Date = receipt.RecPayDate.Value.ToString("dd-MMM-yyyy"); customerrecpay.ReceivedFrom = cust.SupplierName; customerrecpay.DocumentNo = receipt.DocumentNo; customerrecpay.Amount = Convert.ToDecimal(receipt.FMoney); customerrecpay.Remarks = receipt.Remarks; customerrecpay.Account = receipt.BankName; if (receipt.ChequeDate != null) { customerrecpay.ChequeDate = receipt.ChequeDate.Value.ToString("dd-MMM-yyyy"); } else { customerrecpay.ChequeDate = ""; } if (!string.IsNullOrEmpty(receipt.ChequeNo)) { customerrecpay.ChequeNo = Convert.ToDecimal(receipt.ChequeNo); } customerrecpay.CustomerBank = ""; customerrecpay.DetailDocNo = sinvoice.InvoiceNo.ToString(); customerrecpay.DocDate = sinvoice.InvoiceDate.Value.ToString("dd-MMM-yyyy"); customerrecpay.DocAmount = Convert.ToDecimal(sinvoicedet.SalesHome); if (item.Amount > 0) { customerrecpay.SettledAmount = Convert.ToDecimal(item.Amount); customerrecpay.AdjustmentAmount = Convert.ToInt32(item.AdjustmentAmount); } else { customerrecpay.SettledAmount = Convert.ToDecimal(item.Amount) * -1; customerrecpay.AdjustmentAmount = Convert.ToInt32(item.AdjustmentAmount); } listofdet.Add(customerrecpay); } ReportDataSource _rsource; //var dd = entity.ReportCustomerReceipt(recpayid).ToList(); _rsource = new ReportDataSource("ReceiptVoucher", listofdet); ReportViewer1.LocalReport.DataSources.Add(_rsource); } ReportDataSource _rsource1 = new ReportDataSource("Company", dtcompany); ReportViewer1.LocalReport.DataSources.Add(_rsource1); //foreach (var item in dd) //{ // totalamt = 5000; //} //totalamt = 5000; //DataTable dtuser = new DataTable(); //dtuser.Columns.Add("UserName"); //DataRow dr1 = dtuser.NewRow(); //int uid = Convert.ToInt32(Session["UserID"].ToString()); //dr1[0] = (from c in entity.UserRegistrations where c.UserID == uid select c.UserName).FirstOrDefault(); //dtuser.Rows.Add(dr1); //ReportDataSource _rsource2 = new ReportDataSource("User", dtuser); //ReportViewer1.LocalReport.DataSources.Add(_rsource2); DataTable dtcurrency = new DataTable(); dtcurrency.Columns.Add("SalesCurrency"); dtcurrency.Columns.Add("ForeignCurrency"); dtcurrency.Columns.Add("SalesCurrencySymbol"); dtcurrency.Columns.Add("ForeignCurrencySymbol"); dtcurrency.Columns.Add("InWords"); var currencyName = (from d in entity.CurrencyMasters where d.CurrencyID == currencyId select d).FirstOrDefault(); if (currencyName == null) { currencyName = new CurrencyMaster(); } DataRow r = dtcurrency.NewRow(); r[0] = currencyName.CurrencyName; r[1] = ""; r[2] = ""; r[3] = ""; r[4] = currencyName.CurrencyName + ", " + NumberToWords(Convert.ToInt32(totalamt)) + " /00 baisa."; dtcurrency.Rows.Add(r); ReportDataSource _rsource3 = new ReportDataSource("Currency", dtcurrency); ReportViewer1.LocalReport.DataSources.Add(_rsource3); ReportViewer1.LocalReport.EnableExternalImages = true; ReportViewer1.LocalReport.Refresh(); }
public List <CurrencyMaster> UpdateNewCurrencyMaster(CurrencyMaster model) { return(_rfqDataAcess.UpdateNewCurrencyMaster(model)); }