Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            JobPayment jobPayment = db.JobPayments.Find(id);
            int        tmpId      = jobPayment.JobMainId;

            db.JobPayments.Remove(jobPayment);
            db.SaveChanges();
            return(RedirectToAction("Payments", new { id = tmpId }));
        }
Esempio n. 2
0
 public void AddJobPayment(JobPayment jobPayment)
 {
     //_dataBaseContext.JobPayments.AddObject(jobPayment);
     //SaveChangesToDataBase();
     //return jobPayment;
     var notes = jobPayment.Notes ?? "";
     var query = string.Format(
         "INSERT INTO dbo.JobPayments ( JobID, TransactionID, Notes ) VALUES( {0}, {1}, '{2}')", jobPayment.JobID, jobPayment.TransactionID, notes);
     _dataBaseContext.ExecuteStoreCommand(query);
 }
Esempio n. 3
0
        // GET: JobPayments/Create , remarks = "Partial Payment"
        public ActionResult Create(int?JobMainId, string remarks)
        {
            Models.JobPayment jp = new JobPayment();
            jp.JobMainId = (int)JobMainId;
            jp.DtPayment = DateTime.Now;
            jp.Remarks   = remarks;

            ViewBag.JobMainId = new SelectList(db.JobMains, "Id", "Description");
            ViewBag.BankId    = new SelectList(db.Banks, "Id", "BankName");

            return(View(jp));
        }
Esempio n. 4
0
 public ActionResult Edit([Bind(Include = "Id,JobMainId,DtPayment,PaymentAmt,Remarks,BankId")] JobPayment jobPayment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(jobPayment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Payments", new { id = jobPayment.JobMainId }));
     }
     ViewBag.JobMainId = new SelectList(db.JobMains, "Id", "Description", jobPayment.JobMainId);
     ViewBag.BankId    = new SelectList(db.Banks, "Id", "BankName", jobPayment.BankId);
     return(View(jobPayment));
 }
Esempio n. 5
0
        // GET: JobPayments/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            JobPayment jobPayment = db.JobPayments.Find(id);

            if (jobPayment == null)
            {
                return(HttpNotFound());
            }
            return(View(jobPayment));
        }
Esempio n. 6
0
        // GET: JobPayments/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            JobPayment jobPayment = db.JobPayments.Find(id);

            if (jobPayment == null)
            {
                return(HttpNotFound());
            }
            ViewBag.JobMainId = new SelectList(db.JobMains, "Id", "Description", jobPayment.JobMainId);
            ViewBag.BankId    = new SelectList(db.Banks, "Id", "BankName", jobPayment.BankId);
            return(View(jobPayment));
        }
Esempio n. 7
0
        //add paypal payment to job payment (full/partial)
        private void AddPaymentRecord(int JobMainId, decimal amount)
        {
            DateTime today = DateTime.Now;

            today = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(today, TimeZoneInfo.Local.Id, "Singapore Standard Time");

            string     remarks    = "PayPal Payment";
            JobPayment jobPayment = new JobPayment();

            jobPayment.BankId     = 5;                  //personal guarantee, need to add (5) paypal
            jobPayment.DtPayment  = today;
            jobPayment.JobMainId  = (int)JobMainId;
            jobPayment.PaymentAmt = amount;
            jobPayment.Remarks    = remarks;

            db.JobPayments.Add(jobPayment);
            db.SaveChanges();
        }