public float yesterdayImmigration() { string franchid = help.Permission(); // DateTime today = System.DateTime.Now; if (franchid == "Admin") { ApplicationRecipt ee2 = db.ApplicationRecipts.FirstOrDefault(x => x.Date == yesterday); if (ee2 != null) { return((db.ApplicationRecipts.Where(x => x.Date == yesterday)).Sum(x => x.Amount)); } else { return(0); } } ApplicationRecipt ee = db.ApplicationRecipts.FirstOrDefault(x => x.Date == yesterday); if (ee != null) { return((db.ApplicationRecipts.Where(x => x.Date == yesterday)).Sum(x => x.Amount)); } else { return(0); } }
public ActionResult UpdateLetter(Offerletter Emp, ApplicationRecipt Recipt, Helper Help) // Record Insert { db.Entry(Emp).State = EntityState.Modified; db.SaveChanges(); var inquiry = db.Applications.FirstOrDefault(x => x.ApplicationNo == Emp.ApplicationNo).InquiryId; return(RedirectToAction("Create", "Application", new { id = inquiry })); }
//public ActionResult InsertOffer(Offerletter off,int country,int college,int course) //{ // off.Cid = country; // off.Oid = college; // off.CCid = course; // db.Offerletter.Add(off); // db.SaveChanges(); // TempData["Success"] = "Offerletter Detail Successfully"; // return View(); //} public JsonResult Payment(Helper Help, ApplicationRecipt Recipt, Leader ll, Helper help) { using (var transaction = db.Database.BeginTransaction()) { try { // Recipt.Date = System.DateTime.Now; var inquiryid = db.Applications.FirstOrDefault(x => x.ApplicationNo == Recipt.ApplicationNo).InquiryId; online onlines = db.onlines.FirstOrDefault(x => x.inquiryid == inquiryid); string franchise = Help.Consoller(); // Recipt.ApplicationNo = Emp.ApplicationNo; Recipt.Leadger = db.Ledgers.FirstOrDefault(x => x.ApplicationNo == Recipt.ApplicationNo && x.Franchid == franchise).LeaderNo; Recipt.ReciptNo = Help.recipt(); Recipt.RecivedBy = Help.Teacher(); Recipt.Date = System.DateTime.Now; db.ApplicationRecipts.Add(Recipt); db.SaveChanges(); ll = db.Ledgers.FirstOrDefault(x => x.ApplicationNo == Recipt.ApplicationNo); if (ll != null) { int recived = ll.Received; ll.Received = recived + Recipt.Amount; db.Entry(ll).State = EntityState.Modified; db.SaveChanges(); } Process pr = db.Process.FirstOrDefault(x => x.ApplicationNo == Recipt.ApplicationNo); if (pr.Offerletter == false) { var Process = db.Process.SingleOrDefault(x => x.ApplicationNo == Recipt.ApplicationNo); if (Process != null) { Process.Offerletter = true; db.SaveChanges(); } } if (Recipt.sms == true) { help.sendsms(onlines.Mobile, "Hello," + onlines.Name + " Thank you For Deposit "); } transaction.Commit(); return(Json(Recipt, JsonRequestBehavior.AllowGet)); } catch (Exception) { throw; } } }
public JsonResult InsertOffer(Offerletter Emp, ApplicationRecipt Recipt, Helper Help) // Record Insert { using (var transaction = db.Database.BeginTransaction()) { try { Emp.Show = true; db.Offerletter.Add(Emp); db.SaveChanges(); Recipt.Date = System.DateTime.Now; Recipt.ApplicationNo = Emp.ApplicationNo; Recipt.Leadger = db.Ledgers.FirstOrDefault(x => x.ApplicationNo == Emp.ApplicationNo).LeaderNo; Recipt.Type = "Offer Letter"; Recipt.ReciptNo = Help.recipt(); Recipt.Amount = Emp.Amount; Recipt.RecivedBy = Help.Teacher(); db.ApplicationRecipts.Add(Recipt); db.SaveChanges(); Process pr = db.Process.FirstOrDefault(x => x.ApplicationNo == Emp.ApplicationNo); if (pr.Medical == false) { var Process = db.Process.SingleOrDefault(x => x.ApplicationNo == Emp.ApplicationNo); if (Process != null) { Process.Offerletter = true; db.SaveChanges(); } } transaction.Commit(); TempData["Success"] = "Data Save Sucessfully"; return(Json(Emp, JsonRequestBehavior.AllowGet)); } catch (Exception e) { string a = e.Message; transaction.Rollback(); throw; } } }
public float TodayImmigration() { string franchid = help.Permission(); if (franchid == "Admin") { return((db.ApplicationRecipts.Where(x => x.Date == today)).Select(x => x.Amount).DefaultIfEmpty(0).Sum()); } // DateTime today = System.DateTime.Now; ApplicationRecipt ee = db.ApplicationRecipts.FirstOrDefault(x => x.Date == today); if (ee != null) { return((db.ApplicationRecipts.Where(x => x.Date == today)).Sum(x => x.Amount)); } else { return(0); } }