public ActionResult DetailUpdate(DirectDebitWorkFlowClass model, String Command)
        {
            if (Session["Login"] != null)
            {
                LoginSession loginsession = (LoginSession)Session["Login"];
                String actionName = this.ControllerContext.RouteData.Values["action"].ToString();
                String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, BAL.Common.LayoutType(loginsession.UserType));
                if (ModelState.IsValid)
                {
                    try
                    {
                        model.CreatedBy = loginsession.UserID;
                        if (Command == "Paid")
                        {
                            model.Status = "1";
                            if (BAL.DirectDebitWrokFlowModel.DirectDebitWorkFlowAction(model))
                            {
                                return RedirectToAction("DirectDebit", "DirectDebit");
                            }
                            else
                            {
                                return Content("Unable to save , try again");
                            }

                        }
                        else
                        {
                            model.Status = "2";

                            if (BAL.DirectDebitWrokFlowModel.DirectDebitWorkFlowAction(model))
                            {
                                return RedirectToAction("DirectDebit", "DirectDebit");
                            }
                            else
                            {
                                return Content("Unable to save , try again");
                            }

                        }
                    }
                    catch (Exception ex)
                    {
                        return Content("ErrorMessage" + ":" + ex.StackTrace.ToString() );
                    }
                }
                else
                {
                    String errorMessage = String.Empty;
                    String exception = String.Empty;
                    foreach (var modelStateVal in ViewData.ModelState.Values)
                    {
                        foreach (var error in modelStateVal.Errors)
                        {
                            errorMessage = error.ErrorMessage;
                            exception = error.Exception.ToString();
                        }
                    }
                    return Content("ErrorMessage" + ":" + errorMessage);
                }
            }
            else
            { return RedirectToAction("Index", "Home"); }
        }
        public JsonResult DirectDebitUpdate(String mDebitID, String mDuedate, String mJobDate, String mClaimDate, String mBillNo, String mAmount)
        {
            if (Session["Login"] != null)
            {
                LoginSession loginsession = (LoginSession)Session["Login"];
                BAL.DirectDebitWorkFlowClass Debitcls = new BAL.DirectDebitWorkFlowClass();
                if ((mDebitID != "") && (mDuedate != "") && (mAmount!= ""))
                {
                    Debitcls.DirectDebitID = mDebitID;
                    Debitcls.DueDate = mDuedate;
                    Debitcls.JobDate = mJobDate;
                    Debitcls.ClaimDate = mClaimDate;
                    Debitcls.BillNo = mBillNo;
                    Debitcls.Amount = mAmount;
                    Debitcls.Status = "1";
                    Debitcls.CreatedBy = loginsession.UserID;
                    if (BAL.DirectDebitWrokFlowModel.DirectDebitWorkFlowAction(Debitcls))
                    {
                        return Json(new { Result = "true" }, JsonRequestBehavior.AllowGet);
                    }
                    else
                    { return Json(new { Result = "false" }, JsonRequestBehavior.AllowGet); }
                }

            }
            return Json(new { Resul= false }, JsonRequestBehavior.AllowGet);
        }
 public static Boolean DirectDebitWorkFlowAction(DirectDebitWorkFlowClass debit)
 {
     Boolean flag = false;
     try
     {
         IRecordInsert objtext = new BALDirectDebitWrokFlow();
         flag = objtext.AddRecord(debit);
     }
     catch (Exception ex)
     {
         throw;
     }
     return flag;
 }