public ActionResult Create([Bind(Include = "JangadID,CompanyID,PartyID,Quantity,Weight,StatusID,UserID,Amount,RecivedAmount,PendingAmount,JangadNo,Created,Modified,Remarks,PricePerCarat,FinYearID,CGSTAmount,SGSTAmount,IGSTAmount,TDSAmount,IsActive,CGST,SGST,IGST,TDS,IsLocal,Casar,TotalAmount")] DIA_Jangad dIA_Jangad) { if (ModelState.IsValid) { dIA_Jangad.Created = DateTime.Now; dIA_Jangad.Modified = DateTime.Now; if (Session["UserID"] != null) { dIA_Jangad.UserID = Convert.ToInt16(Session["UserID"].ToString()); } db.DIA_Jangad.Add(dIA_Jangad); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CGST = new SelectList(db.ACC_Tax, "TaxID", "Tax", dIA_Jangad.CGST); ViewBag.IGST = new SelectList(db.ACC_Tax, "TaxID", "Tax", dIA_Jangad.IGST); ViewBag.SGST = new SelectList(db.ACC_Tax, "TaxID", "Tax", dIA_Jangad.SGST); ViewBag.TDS = new SelectList(db.ACC_Tax, "TaxID", "Tax", dIA_Jangad.TDS); ViewBag.CompanyID = new SelectList(db.SYS_Company, "CompanyID", "CompanyName", dIA_Jangad.CompanyID); ViewBag.FinYearID = new SelectList(db.SYS_FinYear, "FinYearID", "FinYear", dIA_Jangad.FinYearID); ViewBag.PartyID = new SelectList(db.MST_Party, "PartyID", "PartyName", dIA_Jangad.PartyID); ViewBag.StatusID = new SelectList(db.SYS_Status, "StatusID", "StatusName", dIA_Jangad.StatusID); ViewBag.UserID = new SelectList(db.SEC_User, "UserID", "UserName", dIA_Jangad.UserID); return(View(dIA_Jangad)); }
public ActionResult DeleteConfirmed(int id) { DIA_Jangad dIA_Jangad = db.DIA_Jangad.Find(id); db.DIA_Jangad.Remove(dIA_Jangad); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: DIA_Jangad/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DIA_Jangad dIA_Jangad = db.DIA_Jangad.Find(id); if (dIA_Jangad == null) { return(HttpNotFound()); } return(View(dIA_Jangad)); }
public ActionResult CreateNew() { //var _DIA_Jangad = db.DIA_Jangad.ToList(); DIA_Jangad modal = new DIA_Jangad(); ViewBag.PartyID = new SelectList(db.MST_Party, "PartyID", "PartyName", modal.PartyID); ViewBag.StatusID = new SelectList(db.SYS_Status, "StatusID", "StatusName", modal.StatusID); ViewBag.UserID = new SelectList(db.SEC_User, "UserID", "UserName", modal.UserID); ViewBag.CGST = new SelectList(db.ACC_Tax, "TaxID", "Tax", modal.CGST); ViewBag.SGST = new SelectList(db.ACC_Tax, "TaxID", "Tax", modal.SGST); ViewBag.IGST = new SelectList(db.ACC_Tax, "TaxID", "Tax", modal.IGST); //ViewData["DIA_Jangad_SelectListItem"] = _DIA_Jangad; modal.IsLocal = true; return(View(modal)); }
// GET: DIA_Jangad/Create public ActionResult Create() { ViewBag.CGST = new SelectList(db.ACC_Tax, "TaxID", "Tax"); ViewBag.IGST = new SelectList(db.ACC_Tax, "TaxID", "Tax"); ViewBag.SGST = new SelectList(db.ACC_Tax, "TaxID", "Tax"); ViewBag.TDS = new SelectList(db.ACC_Tax, "TaxID", "Tax"); ViewBag.CompanyID = new SelectList(db.SYS_Company, "CompanyID", "CompanyName"); ViewBag.FinYearID = new SelectList(db.SYS_FinYear, "FinYearID", "FinYear"); ViewBag.PartyID = new SelectList(db.MST_Party, "PartyID", "PartyName"); ViewBag.StatusID = new SelectList(db.SYS_Status, "StatusID", "StatusName"); ViewBag.UserID = new SelectList(db.SEC_User, "UserID", "UserName"); DIA_Jangad _dIA_Jangad = new DIA_Jangad(); return(View("Edit", _dIA_Jangad)); }
// GET: DIA_Jangad/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DIA_Jangad dIA_Jangad = db.DIA_Jangad.Find(id); if (dIA_Jangad == null) { return(HttpNotFound()); } ViewBag.CGST = new SelectList(db.ACC_Tax, "TaxID", "Tax", dIA_Jangad.CGST); ViewBag.IGST = new SelectList(db.ACC_Tax, "TaxID", "Tax", dIA_Jangad.IGST); ViewBag.SGST = new SelectList(db.ACC_Tax, "TaxID", "Tax", dIA_Jangad.SGST); ViewBag.TDS = new SelectList(db.ACC_Tax, "TaxID", "Tax", dIA_Jangad.TDS); ViewBag.CompanyID = new SelectList(db.SYS_Company, "CompanyID", "CompanyName", dIA_Jangad.CompanyID); ViewBag.FinYearID = new SelectList(db.SYS_FinYear, "FinYearID", "FinYear", dIA_Jangad.FinYearID); ViewBag.PartyID = new SelectList(db.MST_Party, "PartyID", "PartyName", dIA_Jangad.PartyID); ViewBag.StatusID = new SelectList(db.SYS_Status, "StatusID", "StatusName", dIA_Jangad.StatusID); ViewBag.UserID = new SelectList(db.SEC_User, "UserID", "UserName", dIA_Jangad.UserID); return(View(dIA_Jangad)); }
public JsonResult AddJangad(DIA_JangadViewModal dIA_JangadViewModal) { try { if (dIA_JangadViewModal == null) { //error meesage or expception handle } else if (dIA_JangadViewModal.DIA_JangadItems == null) { //error meesage or expception handle } else { if (Session["UserID"] != null) { dIA_JangadViewModal.UserID = Convert.ToInt16(Session["UserID"].ToString()); } //dIA_JangadViewModal; if (dIA_JangadViewModal.JangadID > 0) { //edit time logic } else { DIA_Jangad new_DIA_Jangad = new DIA_Jangad(); new_DIA_Jangad.CompanyID = CommonConfig.GetCompanyID(); new_DIA_Jangad.PartyID = dIA_JangadViewModal.PartyID; new_DIA_Jangad.Weight = dIA_JangadViewModal.Weight; new_DIA_Jangad.StatusID = 1; //ask to kamal new_DIA_Jangad.UserID = dIA_JangadViewModal.UserID; new_DIA_Jangad.Amount = 0; //dIA_JangadViewModal.Amount; new_DIA_Jangad.RecivedAmount = 0; //dIA_JangadViewModal.RecivedAmount; new_DIA_Jangad.JangadNo = dIA_JangadViewModal.JangadNo;; //ask to kamal new_DIA_Jangad.Created = DateTime.Now; new_DIA_Jangad.Modified = DateTime.Now; new_DIA_Jangad.Remarks = dIA_JangadViewModal.Remarks; new_DIA_Jangad.PricePerCarat = dIA_JangadViewModal.PricePerCarat; new_DIA_Jangad.FinYearID = CommonConfig.GetFinYearID(); new_DIA_Jangad.CGSTAmount = dIA_JangadViewModal.CGSTAmount; new_DIA_Jangad.SGSTAmount = dIA_JangadViewModal.SGSTAmount; new_DIA_Jangad.IGSTAmount = dIA_JangadViewModal.IGSTAmount; new_DIA_Jangad.TDSAmount = dIA_JangadViewModal.TDSAmount; new_DIA_Jangad.IsActive = true; if (dIA_JangadViewModal.CGST > 0) { new_DIA_Jangad.CGST = dIA_JangadViewModal.CGST; } else { new_DIA_Jangad.CGST = null; } if (dIA_JangadViewModal.SGST > 0) { new_DIA_Jangad.SGST = dIA_JangadViewModal.SGST; } else { new_DIA_Jangad.SGST = null; } if (dIA_JangadViewModal.IGST > 0) { new_DIA_Jangad.IGST = dIA_JangadViewModal.IGST; } else { new_DIA_Jangad.IGST = null; } if (dIA_JangadViewModal.TDS > 0) { new_DIA_Jangad.TDS = dIA_JangadViewModal.TDS; } else { new_DIA_Jangad.TDS = null; } new_DIA_Jangad.IsLocal = dIA_JangadViewModal.IsLocal; new_DIA_Jangad.Casar = 0;//ask to kamal //start default value set new_DIA_Jangad.Quantity = dIA_JangadViewModal.Quantity; new_DIA_Jangad.PricePerCarat = 0; new_DIA_Jangad.QTYByThan = 0; new_DIA_Jangad.Rate = 0; //end if (dIA_JangadViewModal.IsRatePerCarat == true) { new_DIA_Jangad.IsRatePerCarat = dIA_JangadViewModal.IsRatePerCarat; new_DIA_Jangad.Quantity = dIA_JangadViewModal.Quantity; //ask to kamal new_DIA_Jangad.PricePerCarat = dIA_JangadViewModal.PricePerCarat; //ask to kamal new_DIA_Jangad.TotalAmount = dIA_JangadViewModal.TotalAmount; new_DIA_Jangad.PendingAmount = Convert.ToInt32(dIA_JangadViewModal.TotalAmount); } if (dIA_JangadViewModal.IsRatePerThan == true) { new_DIA_Jangad.IsRatePerThan = dIA_JangadViewModal.IsRatePerThan; new_DIA_Jangad.QTYByThan = dIA_JangadViewModal.QTYByThan;//ask to kamal new_DIA_Jangad.Rate = dIA_JangadViewModal.Rate; new_DIA_Jangad.TotalAmount = dIA_JangadViewModal.TotalAmount; new_DIA_Jangad.PendingAmount = Convert.ToInt32(dIA_JangadViewModal.TotalAmount); } #region Generate InvoiceNo String _NewJangadCode = CommonConfig.GetNextNumber("JN"); #endregion Generate InvoiceNo new_DIA_Jangad.JangadCode = _NewJangadCode; db.DIA_Jangad.Add(new_DIA_Jangad); db.SaveChanges(); if (dIA_JangadViewModal.DIA_JangadItems.Count() > 0) { List <DIA_JangadItem> newList_DIA_JangadItems = new List <DIA_JangadItem>(); DIA_JangadItem new_DIA_JangadItem; foreach (var item in dIA_JangadViewModal.DIA_JangadItems) { new_DIA_JangadItem = new DIA_JangadItem(); new_DIA_JangadItem.JangadID = new_DIA_Jangad.JangadID; new_DIA_JangadItem.Weight = item.Weight; new_DIA_JangadItem.Dia = item.Dia; new_DIA_JangadItem.PavalionAngle = item.PavalionAngle; new_DIA_JangadItem.CrownAngle = item.CrownAngle; new_DIA_JangadItem.CrownHeight = item.CrownHeight; new_DIA_JangadItem.Girdle = item.Girdle; new_DIA_JangadItem.Para1 = item.Para1; new_DIA_JangadItem.Para2 = item.Para2; new_DIA_JangadItem.Para3 = item.Para3; new_DIA_JangadItem.PavalionORCrown = "1";//ask to kamal new_DIA_JangadItem.UserID = dIA_JangadViewModal.UserID; new_DIA_JangadItem.StatusID = CommonConfig.GetStatusPending(); new_DIA_JangadItem.Created = DateTime.Now; new_DIA_JangadItem.Remarks = item.Remarks; new_DIA_JangadItem.RWeight = item.RWeight; new_DIA_JangadItem.PWeight = item.PWeight; new_DIA_JangadItem.Culet = item.Culet; //ask to kamal new_DIA_JangadItem.ji_table = item.ji_table; //ask to kamal new_DIA_JangadItem.JangadItemCode = item.JangadItemCode; //ask to kamal new_DIA_JangadItem.PolishingStageID = 1; //Jangad Fresh newList_DIA_JangadItems.Add(new_DIA_JangadItem); } db.DIA_JangadItem.AddRange(newList_DIA_JangadItems); db.SaveChanges(); } } } return(Json("Sucess", JsonRequestBehavior.AllowGet)); } catch (Exception ex) { } return(Json("failure", JsonRequestBehavior.AllowGet)); }