public ActionResult ViewChallanDetails(ChallanModel obj) { try { if (Login.HasLogin == false) { return(RedirectToAction("Signin", "Admin")); } else { if (Request.Form["DCNumberSelect"] != null) { return(RedirectToAction("SelectChallan", "Role2")); } else { //ModelState.Clear(); string DCId = TempData["DCNumber"].ToString(); ViewBag.RegisterItems = NewMethod(DCId); return(View()); } } } catch (Exception ex) { //throw ex; } return(View()); }
public int InsertChallanTran(ChallanModel model) { Mapper.CreateMap <ChallanModel, ChallanTran>(); ChallanTran objTran = Mapper.Map <ChallanTran>(model); Dbcontext.ChallanTrans.Add(objTran); return(Dbcontext.SaveChanges()); }
public ChallanModel challanTranById(int id) { Mapper.CreateMap <ChallanTran, ChallanModel>(); ChallanTran objComp = Dbcontext.ChallanTrans.SingleOrDefault(m => m.CTID == id); ChallanModel objCItem = Mapper.Map <ChallanModel>(objComp); return(objCItem); }
public int Update(ChallanModel model) { Mapper.CreateMap <ChallanModel, ChallanMaster>(); ChallanMaster objComp = Dbcontext.ChallanMasters.SingleOrDefault(m => m.CID == model.CID); objComp = Mapper.Map(model, objComp); return(Dbcontext.SaveChanges()); }
public ActionResult AddGR(ChallanModel model, string cmd) { ChallanService objService = new ChallanService(); int id = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString()); model.CID = id; if (cmd == "Add") { objService.InsertChallanTran(model); } else { objService.Update(model); } int uid = 0; int cid = 0; int rid = 0; if (Session["UserId"] != null) { uid = Convert.ToInt32(Session["UserId"].ToString()); cid = Convert.ToInt32(Session["CompID"].ToString()); rid = Convert.ToInt32(Session["CompID"].ToString()); } ChallanModel objModel = new ChallanModel(); List <ChallanModel> lstChallan = new List <ChallanModel>(); objModel = objService.GetById(id); List <ConsignmentModel> lstGrNo = new List <ConsignmentModel>(); lstGrNo = objService.getGRNo(rid, cid); objModel.ListGrNo = new List <ConsignmentModel>(); objModel.ListGrNo.AddRange(lstGrNo); List <VehicleItem> lstVehicle = new List <VehicleItem>(); lstVehicle = objService.getVehicle(rid, cid); objModel.ListVehicle = new List <VehicleItem>(); objModel.ListVehicle.AddRange(lstVehicle); List <EmployeeItem> lstEmp = new List <EmployeeItem>(); lstEmp = objService.GetEmp(cid); objModel.ListEmp = new List <EmployeeItem>(); objModel.ListEmp.AddRange(lstEmp); lstChallan = objService.getChallanTran(id); objModel.ListChallan = new List <ChallanModel>(); objModel.ListChallan.AddRange(lstChallan); ViewBag.Menuid = Request.QueryString["menuId"]; return(View(objModel)); }
public ActionResult PrintChallan(string id) { ChallanService objService = new ChallanService(); ChallanModel objModel = new ChallanModel(); List <ChallanModel> lstChallan = new List <ChallanModel>(); EncDec objEnDec = new EncDec(); string cid = objEnDec.Decrypt(id); objModel = objService.GetById(Convert.ToInt32(cid)); lstChallan = objService.getChallanTran(Convert.ToInt32(cid)); objModel.ListChallanTran = new List <ChallanModel>(); objModel.ListChallanTran.AddRange(lstChallan); return(View(objModel)); }
public ActionResult Index() { ChallanService objService = new ChallanService(); ChallanModel objModel = new ChallanModel(); List <ChallanModel> lstChallan = new List <ChallanModel>(); int uid = 0; int cid = 0; int rid = 0; if (Session["UserId"] != null) { uid = Convert.ToInt32(Session["UserId"].ToString()); cid = Convert.ToInt32(Session["CompID"].ToString()); rid = Convert.ToInt32(Session["CompID"].ToString()); } List <VehicleItem> lstVehicle = new List <VehicleItem>(); lstVehicle = objService.getVehicle(rid, cid); objModel.ListVehicle = new List <VehicleItem>(); objModel.ListVehicle.AddRange(lstVehicle); List <EmployeeItem> lstEmp = new List <EmployeeItem>(); lstEmp = objService.GetEmp(cid); objModel.ListEmp = new List <EmployeeItem>(); objModel.ListEmp.AddRange(lstEmp); List <ConsignmentModel> lstGrNo = new List <ConsignmentModel>(); lstGrNo = objService.getGRNo(rid, cid); objModel.ListGrNo = new List <ConsignmentModel>(); objModel.ListGrNo.AddRange(lstGrNo); lstChallan = objService.getAllChallan(rid, cid); objModel.ListChallan = new List <ChallanModel>(); objModel.ListChallan.AddRange(lstChallan); lstChallan = objService.getAllChallanTran(); objModel.ListChallanTran = new List <ChallanModel>(); objModel.ListChallanTran.AddRange(lstChallan); ViewBag.Menuid = Request.QueryString["menuId"]; return(View(objModel)); }
public int Insert(ChallanModel model) { Mapper.CreateMap <ChallanModel, ChallanMaster>(); ChallanMaster objCompany = Mapper.Map <ChallanMaster>(model); Dbcontext.ChallanMasters.Add(objCompany); //Dbcontext.SaveChanges(); //int id = Dbcontext.ChallanMasters.Max(m => m.CID); //if (id != null && id != 0) //{ // model.CID = id; // Mapper.CreateMap<ChallanModel, ChallanTran>(); // ChallanTran objTran = Mapper.Map<ChallanTran>(model); // Dbcontext.ChallanTrans.Add(objTran); //} return(Dbcontext.SaveChanges()); }
public ActionResult Index(ChallanModel model) { ChallanService objService = new ChallanService(); int uid = 0; int cid = 0; int rid = 0; if (Session["UserId"] != null) { uid = Convert.ToInt32(Session["UserId"].ToString()); cid = Convert.ToInt32(Session["CompID"].ToString()); rid = Convert.ToInt32(Session["CompID"].ToString()); } model.CompID = cid; model.ChallanNo = "CHLN"; model.Status = true; objService.Insert(model); return(RedirectToAction("Index", new { @menuId = model.Viewbagidformenu })); }
public ActionResult SelectChallan(ChallanModel obj) { try { if (Login.HasLogin == false) { return(RedirectToAction("Signin", "Admin")); } else { TempData["DCNumber"] = obj.DC_Number; return(RedirectToAction("ViewChallanDetails", "Role2")); } } catch (Exception ex) { //throw ex; } return(View()); }
public ActionResult getChallanOneStudent(string rollnumber, int?month, bool Annual, bool Admissionfee) { int mon; Student s = db.Students.Find(rollnumber); int monthlyfee = s.Class.MonthlyFee; int ACharges = s.Class.AnnualCharges; //bool annualCharges = false; if (month == null) { mon = DateTime.Now.Month; } else { mon = month.Value; } //if (mon == 4) //{ // annualCharges = true; //} ChallanModel chm = new ChallanModel(rollnumber, Admissionfee, Annual); return(PartialView(chm)); }
public ActionResult Challan(ChallanModel Dc) { if (Login.HasLogin == false) { return(RedirectToAction("Signin", "Admin")); } else { Error = ""; ViewBag.Error = null; int count = 0; if ((Dc.Description8 != null) && (Dc.Quantity8 != null)) { count = 7; } else if ((Dc.Description7 != null) && (Dc.Quantity7 != null)) { count = 6; } else if ((Dc.Description6 != null) && (Dc.Quantity6 != null)) { count = 5; } else if ((Dc.Description5 != null) && (Dc.Quantity5 != null)) { count = 4; } else if ((Dc.Description4 != null) && (Dc.Quantity4 != null)) { count = 3; } else if ((Dc.Description3 != null) && (Dc.Quantity3 != null)) { count = 2; } else if ((Dc.Description2 != null) && (Dc.Quantity2 != null)) { count = 1; } string DCNumber = ""; string EmployeeId = ""; if (Session["UserId"] != null) { EmployeeId = Session["UserId"].ToString(); } if (Mid.AddDC(Dc, EmployeeId, ref Error, ref DCNumber)) { ViewBag.message = ""; } if (Error == "Sucess") { for (int k = 0; k <= count; k++) { Error = ""; Mid.AddDCDescreption(Dc, DCNumber, k, ref Error); } if (Error == "Sucess") { ViewBag.Error = "DC data inserted sucessfully"; } } else { ViewBag.Error = "Failed to insert DC data"; ViewBag.Error = Error; } if (Error == "Sucess") { ModelState.Clear(); } UpdateDCData(); return(View()); } }