public ActionResult SaveDebitMemoByVendorId(DebitMemoModel model) //, HttpPostedFileBase File { try { if (model.DebitMemoFile != null) { string AttachmentName = model.VendorId + "_" + DateTime.Now.Ticks.ToString() + "_" + model.DebitMemoFile.FileName.ToString(); CommonHelper.StaticUploadImage(model.DebitMemoFile, Server.MapPath(ConfigurationManager.AppSettings["DebitMemoDocuments"]), AttachmentName); model.UploadedDocumentName = AttachmentName; } if (model.DebitId > 0 && model.editNewDocument != null)//to delete old document if exists and replacing new one { string AttachmentName = model.DebitId + "_" + DateTime.Now.Ticks.ToString() + "_" + model.editNewDocument.FileName.ToString(); CommonHelper.StaticDeleteFIle(null, Server.MapPath(ConfigurationManager.AppSettings["DebitMemoDocuments"]), model.UploadedEditDocumentName); CommonHelper.StaticUploadImage(model.editNewDocument, Server.MapPath(ConfigurationManager.AppSettings["DebitMemoDocuments"]), AttachmentName); model.UploadedDocumentName = AttachmentName; model.DebitMemoStatus = model.DebitMemoStatusEdit; } //during edit if old document exists and no new file is provided--so persisting old document if (model.editNewDocument == null && model.UploadedEditDocumentName != null) { model.UploadedDocumentName = model.UploadedEditDocumentName; model.DebitMemoStatus = model.DebitMemoStatusEdit; } if (model.DebitId > 0) //for all edit case { model.DebitMemoStatus = model.DebitMemoStatusEdit; } var debitMemoList = _IDebitMemo.SaveNewDebitMemo(model); return(Json(debitMemoList, JsonRequestBehavior.AllowGet)); } catch (Exception) { throw; } }
// GET: DebitMemo /// <summary> /// Created By: Er.Ro.R /// Created Date : 8-OCT-2019 /// Created For : To get Debit Memo List as per Vendor /// </summary> public ActionResult Index() { var model = new DebitMemoModel(); try { eTracLoginModel ObjLoginModel = null; if (Session != null) { if (Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(Session["eTrac"]); if (Convert.ToInt64(Session["eTrac_SelectedDasboardLocationID"]) == 0)//eTrac_UserLocations { (Session["eTrac_SelectedDasboardLocationID"]) = ObjLoginModel.LocationID; } } } List <SelectListItem> listItems = new List <SelectListItem>(); listItems.Add(new SelectListItem { Text = "---Select Vendor---", Value = "0" }); ViewBag.VendorList = listItems;//sending locationId 0 for all data //ViewBag.VendorList = _IPOTypeDetails.GetCompany_VendorList(0, false);//sending locationId 0 for all data model.ActionModeI = "I"; ViewBag.ProductOrderList = _IPOTypeDetails.GetAllPOList(0, 0, "", 0, 0, 0, "", "");//companyFacilityList } catch (Exception ex) { } return(View(model)); }
public bool SaveNewDebitMemo(DebitMemoModel model) { try { string action = ""; DateTime?modifieddate; if (model.DebitId == 0) { action = "I"; modifieddate = null; } else { action = "U"; modifieddate = DateTime.Now; } bool IsSaved = false; var result = _workorderems.spSetDebitMemo(model.DebitId, action, model.Location, model.VendorId, model.PurchaseOrderId, model.DebitAmount, model.Note, (int)model.DebitMemoStatus, model.UploadedDocumentName, DateTime.Now, modifieddate, null, false, null, null); if (result == 1)//return coming in 1 after save { IsSaved = true; } else { IsSaved = false; } return(IsSaved); } catch (Exception ex) { throw; } }