public JsonResult GetAllBranches()
 {
     if (Session["LOGGEDIN"] != null)
     {
         try
         {
             objBranchProperty = new Branch_Property();
             objBranch         = new Branch_BLL(objBranchProperty);
             var Data = JsonConvert.SerializeObject(objBranch.ViewAll());
             return(Json(new { data = Data, success = true, statuscode = 200, count = Data.Length }, JsonRequestBehavior.AllowGet));
         }
         catch (Exception ex)
         {
             return(Json(new { data = ex.Message, success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet));
         }
     }
     else
     {
         return(Json(new { data = "Session Expired", success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet));
     }
 }
        public ActionResult AddNewBranch(int?id)
        {
            string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
            string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
            string pagename       = @"/" + controllerName + @"/" + actionName;
            var    page           = (List <LP_Pages_Property>)Session["PageList"];

            if (Session["LoggedIn"] != null && Helper.CheckPageAccess(pagename, page) && Session["ISADMIN"] != null && Convert.ToBoolean(Session["ISADMIN"].ToString()) == true)
            {
                objBranchProperty     = new Branch_Property();
                objBranchProperty.idx = Convert.ToInt32(id);
                objBranch             = new Branch_BLL(objBranchProperty);
                if (id > 0 && id != null)
                {
                    var dt = objBranch.GetById();
                    objBranchProperty.companyIdx    = 1;
                    objBranchProperty.idx           = int.Parse(dt.Rows[0]["idx"].ToString());
                    objBranchProperty.companyIdx    = int.Parse(dt.Rows[0]["companyIdx"].ToString());
                    objBranchProperty.branchName    = dt.Rows[0]["branchName"].ToString();
                    objBranchProperty.address       = dt.Rows[0]["address"].ToString();
                    objBranchProperty.contactNumber = dt.Rows[0]["contactNumber"].ToString();
                    objBranchProperty.isMainBranch  = int.Parse(dt.Rows[0]["isMainBranch"].ToString());
                    //objBranchProperty.address = dt.Rows[0]["address"].ToString();
                }


                return(PartialView("_AddNewBranch", objBranchProperty));
            }
            else
            {
                if (Session["LoggedIn"] == null)
                {
                    return(RedirectToAction("Login", "Account"));
                }
                else
                {
                    return(RedirectToAction("NotAuthorized", "Account"));
                }
            }
        }
        public ActionResult AddNewWareHouse(int?id)
        {
            if (Session["LOGGEDIN"] != null)
            {
                objwarehouse    = new WareHouse_Property();
                objwarehousebll = new WareHouse_BLL(objwarehouse);
                Branch_BLL objBranch = new Branch_BLL();
                objwarehouse.BranchLists = Helper.ConvertDataTable <Branch_Property>(objBranch.ViewAll());

                if (objwarehouse.Idx > 0)
                {
                    return(View("_AddNewWareHouse", objwarehouse));
                }
                else
                {
                    return(View("_AddNewWareHouse", objwarehouse));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }