public JsonResult FillDepartment(Int64 ID_Department)
 {
     try
     {
         DataTable    dtbl         = new DataTable();
         BlDepartment bldepartment = new BlDepartment();
         bldepartment.MasterID   = ID_Department;
         bldepartment.UserCode   = Convert.ToInt64(Session["ID_Agent"]);
         bldepartment.FK_Company = Convert.ToInt64(Session["ID_Company"]);
         dtbl = bldepartment.SelectAllData();
         return(Json(Converttojson(dtbl), JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(ex));
     }
 }
 public JsonResult DeleteDepartment(Int64 ID_Department)
 {
     try
     {
         long         statusCode   = 0;
         BlDepartment bldepartment = new BlDepartment();
         bldepartment.MasterID   = ID_Department;
         bldepartment.UserCode   = Convert.ToInt64(Session["ID_Agent"]);
         bldepartment.FK_Company = Convert.ToInt64(Session["ID_Company"]);
         statusCode = bldepartment.DeleteData();
         return(Json(new { statusCode = "" + statusCode + "" }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(ex));
     }
 }
        public ActionResult UpdateDepartment(BlDepartment bldepartment)
        {
            long statusCode = 0;

            bldepartment.UserCode   = Convert.ToInt64(Session["ID_Agent"]);
            bldepartment.FK_Company = Convert.ToInt64(Session["ID_Company"]);
            if (bldepartment.MasterID == 0)
            {
                statusCode = bldepartment.InsertData();
            }
            else
            {
                statusCode = bldepartment.UpdateData();
            }

            return(Json(new { statusCode = "" + statusCode + "" }, JsonRequestBehavior.AllowGet));
        }
 public JsonResult SelectDepartmentAll(string PageIndex = "1", string SearchItem = "")
 {
     try
     {
         int          statusCode   = 1;
         DataTable    dtbl         = new DataTable();
         BlDepartment bldepartment = new BlDepartment();
         bldepartment.PageIndex  = Convert.ToInt32(PageIndex);
         bldepartment.DepCode    = SearchItem;
         bldepartment.DepName    = SearchItem;
         bldepartment.FK_Company = Convert.ToInt64(Session["ID_Company"]);
         dtbl = bldepartment.SelectAllData();
         return(Json(Converttojson(dtbl), JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         ///
         return(Json(ex));
     }
 }