public ActionResult SearchPIByPI(string beni) { var piInfo = repository.ExpLeatherPI.Get().Where(ob => ob.PINo.StartsWith(beni) || ob.PINo == beni); List <EXPLeatherPI> lstPI = new List <EXPLeatherPI>(); foreach (var item in piInfo) { EXPLeatherPI obPI = new EXPLeatherPI(); obPI.PIID = item.PIID; obPI.PINo = item.PINo; obPI.PIDate = Convert.ToDateTime(item.PIDate).ToString("dd/MM/yyyy"); obPI.BeneficiaryAddressID = item.BeneficiaryAddressID; obPI.PIBeneficiary = item.PIBeneficiary; lstPI.Add(obPI); } return(Json(lstPI, JsonRequestBehavior.AllowGet)); }
public ValidationMsg Save(EXPLeatherPI model, int userId, string pageUrl) { var transactionOption = new TransactionOptions { Timeout = new TimeSpan(0, 0, 99999) }; var vMsg = new ValidationMsg(); using (var transactionScope = new TransactionScope(TransactionScopeOption.RequiresNew, transactionOption)) { try { _dalExportPI = new DalExportPI(); PIID = _dalExportPI.Save(model, userId, pageUrl); //GetpurchaseID(purchaseID); if (PIID > 0) { transactionScope.Complete(); vMsg.Type = Enums.MessageType.Success; vMsg.Msg = "Saved successfully."; //vMsg.ReturnId = _dalChemicalForeignPurchaseOrder.GetOrderNo(OrderID); } else { vMsg.Type = Enums.MessageType.Error; vMsg.Msg = "Failed to save."; } } catch (Exception e) { vMsg.Type = Enums.MessageType.Error; vMsg.Msg = "Failed to save."; } } return(vMsg); }
public ValidationMsg Update(EXPLeatherPI model, int userId) { var transactionOption = new TransactionOptions { Timeout = new TimeSpan(0, 0, 9999) }; var vMsg = new ValidationMsg(); using (var transactionScope = new TransactionScope(TransactionScopeOption.RequiresNew, transactionOption)) { try { _dalExportPI = new DalExportPI(); var UpdateStatus = _dalExportPI.Update(model, userId); if (UpdateStatus > 0) { transactionScope.Complete(); vMsg.Type = Enums.MessageType.Update; vMsg.Msg = "Updated successfully."; } else { vMsg.Type = Enums.MessageType.Error; vMsg.Msg = "Failed to Update."; } } catch (Exception) { vMsg.Type = Enums.MessageType.Error; vMsg.Msg = "Failed to Update."; } } return(vMsg); }
public ActionResult ExportPI(EXPLeatherPI model) { if (model.PIID == 0) { var msg = objBLLPI.Save(model, Convert.ToInt32(Session["UserID"]), "ProformaInvoice/ProformaInvoice"); var PIID = objBLLPI.GetPIID(); var GrandTotalSFT = objDALExportPI.GetGrandTotalSFT(PIID); var GrandTotalSMT = objDALExportPI.GetGrandTotalSMT(PIID); var PIItemList = objDALExportPI.GetPIItemList(PIID); var OrderDeliveryList = objDALExportPI.BuyerOrderDeliveryListAfterSave(model.BuyerOrderID); return(Json(new { Msg = msg, PIID = PIID, GrandTotalSFT = GrandTotalSFT, GrandTotalSMT = GrandTotalSMT, PIItemList = PIItemList, OrderDeliveryList = OrderDeliveryList, }, JsonRequestBehavior.AllowGet)); } else { var msg = objBLLPI.Update(model, Convert.ToInt32(Session["UserID"])); var PIItemList = objDALExportPI.GetPIItemList(model.PIID); var GrandTotalSFT = objDALExportPI.GetGrandTotalSFT(model.PIID); var GrandTotalSMT = objDALExportPI.GetGrandTotalSMT(model.PIID); var OrderDeliveryList = objDALExportPI.BuyerOrderDeliveryListAfterSave(model.BuyerOrderID); return(Json(new { Msg = msg, GrandTotalSFT = GrandTotalSFT, GrandTotalSMT = GrandTotalSMT, PIItemList = PIItemList, OrderDeliveryList = OrderDeliveryList, }, JsonRequestBehavior.AllowGet)); } }