public JsonResult AddUpdate(MRNVM_Property objMRN) { try { bool flag = false; objMRNProperty = new LP_MRN_Master_Property(); objMRNProperty.idx = objMRN.idx; objMRNProperty.mrNumber = objMRN.mrNumber; //objMRNProperty.vendorIdx = objMRN.vendorIdx; //objMRNProperty.MRNTypeIdx = objMRN.MRNTypeIdx; objMRNProperty.mrnDate = DateTime.Parse(objMRN.mrnDate); if (objMRN.description != null) { objMRNProperty.description = objMRN.description; } else { objMRNProperty.description = ""; } // objMRNProperty.description = objMRN.description.Length>0? objMRN.description : ""; // objMRNProperty.paidDate = ;// objMRN.paidDate; objMRNProperty.DetailData = Helper.ToDataTable <mrnDetails_Property>(objMRN.MrnDetailsLST); if (objMRN.idx > 0) { //objMRNProperty.creationDate = DateTime.Now; //objMRNProperty.visible = 1; //// objMRNProperty.status = "0"; //objMRNProperty.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString()); objMRNProperty.creationDate = DateTime.Now; objMRNProperty.lastModificationDate = DateTime.Now; objMRNProperty.lastModifiedByUserIdx = Convert.ToInt16(Session["UID"].ToString()); // objMRNVM_Property.createdByUserIdx = DateTime.Now; ; objMRNProperty.TableName = "MRNDetails"; objMRNBll = new LP_MRN_BLL(objMRNProperty); flag = objMRNBll.Insert(); //update } else { //add objMRNProperty.creationDate = DateTime.Now; objMRNProperty.visible = 1; objMRNProperty.status = "0"; objMRNProperty.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString()); objMRNProperty.TableName = "MRNDetails"; objMRNBll = new LP_MRN_BLL(objMRNProperty); flag = objMRNBll.Insert(); } return(Json(new { data = "", success = flag, msg = flag == true ? "Successfull" : "Failed", statuscode = flag == true ? 200 : 401 }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { data = ex.Message, success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet)); } }
public JsonResult AddUpdate(MRNVM_Property objMRN) { try { bool flag = false; objMRNProperty = new LP_MRN_Master_Property(); objMRNProperty.idx = objMRN.idx; objMRNProperty.mrNumber = objMRN.mrNumber; objMRNProperty.WarerHouseID = objMRN.WarerHouseID; //objMRNProperty.vendorIdx = objMRN.vendorIdx; //objMRNProperty.MRNTypeIdx = objMRN.MRNTypeIdx; objMRNProperty.mrnDate = DateTime.Parse(objMRN.mrnDate); if (objMRN.description != null) { objMRNProperty.description = objMRN.description; } else { objMRNProperty.description = ""; } // objMRNProperty.description = objMRN.description.Length>0? objMRN.description : ""; // objMRNProperty.paidDate = ;// objMRN.paidDate; objMRNProperty.DetailData = Helper.ToDataTable <mrnDetails_Property>(objMRN.MrnDetailsLST); if (objMRN.idx > 0) { //objMRNProperty.creationDate = DateTime.Now; //objMRNProperty.visible = 1; //// objMRNProperty.status = "0"; //objMRNProperty.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString()); objMRNProperty.creationDate = DateTime.Now; objMRNProperty.lastModificationDate = DateTime.Now; objMRNProperty.lastModifiedByUserIdx = Convert.ToInt16(Session["UID"].ToString()); // objMRNVM_Property.createdByUserIdx = DateTime.Now; ; objMRNProperty.TableName = "MRNDetails"; objMRNBll = new LP_MRN_BLL(objMRNProperty); flag = objMRNBll.Insert(); //update } else { //add objMRNProperty.creationDate = DateTime.Now; objMRNProperty.visible = 1; objMRNProperty.status = "0"; objMRNProperty.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString()); objMRNProperty.TableName = "MRNDetails"; objMRNBll = new LP_MRN_BLL(objMRNProperty); flag = objMRNBll.Insert(); } return(GenerateReport(objMRNProperty.idx, 3, "MRNReport")); //DataTable dt = GetRecieptData(objMRNProperty.idx, 3); ////List<Customer> allCustomer = new List<Customer>(); ////allCustomer = context.Customers.ToList(); //ReportDocument rd = new ReportDocument(); //rd.Load(Path.Combine(Server.MapPath("~/Reports"), "MRNReport.rpt")); //rd.SetDataSource(dt); //Response.Buffer = false; //Response.ClearContent(); //Response.ClearHeaders(); //rd.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Path.Combine(Server.MapPath("~/Reports"), "MRNReport.Pdf")); ////stream.Seek(0, SeekOrigin.Begin); ////return File(stream, "application/pdf", "CustomerList.pdf"); //return Json(new { data = "/Reports/MRNReport.Pdf", success = flag, msg = flag == true ? "Successfull" : "Failed", statuscode = flag == true ? 200 : 401 }, JsonRequestBehavior.AllowGet); // return Json(new { data = JsonConvert.SerializeObject(objMRNProperty), success = flag, msg = flag == true ? "Successfull" : "Failed", statuscode = flag == true ? 200 : 401 }, JsonRequestBehavior.AllowGet); } catch (Exception ex) { return(Json(new { data = ex.Message, success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet)); } }