Esempio n. 1
0
        /// <summary>
        /// Delete Sub Category
        /// </summary>
        /// <param name="objViewLawGuideModel"></param>
        /// <returns></returns>
        public ViewLawGuideModel DeleteLawGuide(ViewLawGuideModel objViewLawGuideModel)
        {
            try
            {
                SqlParameter pErrorCode = new SqlParameter("@ErrorCode", objViewLawGuideModel.ErrorCode);
                pErrorCode.Direction = ParameterDirection.Output;
                SqlParameter pErrorMessage = new SqlParameter("@ErrorMessage", objViewLawGuideModel.Message);
                pErrorMessage.Direction = ParameterDirection.Output;

                SqlParameter[] parmList =
                {
                    new SqlParameter("@LawGuideID", objViewLawGuideModel.DeletedLawGuideID)
                    ,                               new SqlParameter("@CreatedBy", objViewLawGuideModel.DeletedBy)
                    ,                               pErrorCode
                    ,                               pErrorMessage
                };
                //Call delete stored procedure to delete  category
                SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, DBConstants.Admin_DeleteLawGuide, parmList);
                //set output parameter error code and error message
                objViewLawGuideModel.ErrorCode = Convert.ToInt32(pErrorCode.Value);
                objViewLawGuideModel.Message   = Convert.ToString(pErrorMessage.Value);
                return(objViewLawGuideModel);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Get  LawGuide List  with paging, sorting and searching parameter
        /// </summary>
        /// <param name="objViewLawGuideModel">object of Model ViewLawGuideModel </param>
        /// <returns></returns>
        public DataTable GetLawGuideList(ViewLawGuideModel objViewLawGuideModel)
        {
            try
            {
                SqlParameter[] parmList =
                {
                    new SqlParameter("@SubCategoryId", objViewLawGuideModel.FilterSubCatId)
                    ,                                  new SqlParameter("@CurrentPage", objViewLawGuideModel.CurrentPage)
                    ,                                  new SqlParameter("@PageSize", objViewLawGuideModel.PageSize)
                    ,                                  new SqlParameter("@SortBy", objViewLawGuideModel.SortBy)
                    ,                                  new SqlParameter("@SortOrder", objViewLawGuideModel.SortOrder)
                };

                DataSet ds = SQLHelper.ExecuteDataset(SQLHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, DBConstants.Admin_GetLawGuideList, parmList);

                if (ds != null && ds.Tables.Count > 0)
                {
                    return(ds.Tables[0]);
                }
                return(null);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        public ActionResult ViewLawGuide()
        {
            ViewLawGuideModel ObjViewLawGuideModel = new ViewLawGuideModel();

            try
            {
                //initial set of current page, pageSize , Total pages
                ObjViewLawGuideModel.CurrentPage = 1;
                ObjViewLawGuideModel.PageSize    = CommonUtils.PageSize;
                ObjViewLawGuideModel.TotalPages  = 0;
                //Get  LawGuide List
                serviceResponse      = objUtilityWeb.PostAsJsonAsync(WebApiURL.LawGuide + "/GetLawGuideList", ObjViewLawGuideModel);
                ObjViewLawGuideModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <ViewLawGuideModel>().Result : null;
                //ObjViewLawGuideModel = objBLLawGuide.GetLawGuideList(ObjViewLawGuideModel);

                //Set Success Message if comes from save  page after click on save button
                if (!String.IsNullOrEmpty(Convert.ToString(TempData["SucessMessage"])))
                {
                    ObjViewLawGuideModel.Message     = Convert.ToString(TempData["SucessMessage"]);
                    ObjViewLawGuideModel.MessageType = CommonUtils.MessageType.Success.ToString().ToLower();
                    TempData["SucessMessage"]        = null;
                }

                SubCatDropDown(ObjViewLawGuideModel.FilterSubCatId, null, null);
            }
            catch (Exception ex)
            {
                ErrorLog(ex, "LawGuide", "View GET");
            }
            return(View("ViewLawGuide", ObjViewLawGuideModel));
        }
Esempio n. 4
0
        /// <summary>
        /// Get  LawGuide List based on paging, searching and sorting parameter
        /// </summary>
        /// <param name="objViewLawGuideModel">object of Model ViewLawGuideModel</param>
        /// <returns></returns>
        public ViewLawGuideModel GetLawGuideList(ViewLawGuideModel objViewLawGuideModel)
        {
            List <LawGuideModel> lstLawGuideModel = new List <LawGuideModel>();

            //if FilterLawGuideName is NULL than set to empty
            objViewLawGuideModel.FilterSubCatName = objViewLawGuideModel.FilterSubCatName ?? String.Empty;

            //if SortBy is NULL than set to empty
            objViewLawGuideModel.SortBy = objViewLawGuideModel.SortBy ?? String.Empty;

            //call GetLawGuideList Method which will retrun datatable of  LawGuide
            DataTable dtLawGuide = objDLLawGuide.GetLawGuideList(objViewLawGuideModel);

            //fetch each row of datable
            foreach (DataRow dr in dtLawGuide.Rows)
            {
                //Convert datarow into Model object and set Model object property
                LawGuideModel itemLawGuideModel = GetDataRowToEntity <LawGuideModel>(dr);
                //Add  LawGuide in List
                lstLawGuideModel.Add(itemLawGuideModel);
            }

            //set LawGuide List of Model ViewLawGuideModel
            objViewLawGuideModel.LawGuideList = lstLawGuideModel;
            //if  LawGuide List count is not null and greater than 0 Than set Total Pages for Paging.
            if (objViewLawGuideModel != null && objViewLawGuideModel.LawGuideList != null && objViewLawGuideModel.LawGuideList.Count > 0)
            {
                objViewLawGuideModel.CurrentPage = objViewLawGuideModel.LawGuideList[0].CurrentPage;
                int totalRecord = objViewLawGuideModel.LawGuideList[0].TotalCount;

                if (decimal.Remainder(totalRecord, objViewLawGuideModel.PageSize) > 0)
                {
                    objViewLawGuideModel.TotalPages = (totalRecord / objViewLawGuideModel.PageSize + 1);
                }
                else
                {
                    objViewLawGuideModel.TotalPages = totalRecord / objViewLawGuideModel.PageSize;
                }
            }
            else
            {
                objViewLawGuideModel.TotalPages  = 0;
                objViewLawGuideModel.CurrentPage = 1;
            }
            return(objViewLawGuideModel);
        }
Esempio n. 5
0
        public ActionResult ViewLawGuide(ViewLawGuideModel objViewLawGuideModel)
        {
            try
            {
                int    ErrorCode    = 0;
                String ErrorMessage = "";
                objViewLawGuideModel.Message = objViewLawGuideModel.MessageType = String.Empty;

                if (objViewLawGuideModel.ActionType == "delete")
                {
                    //delete
                    serviceResponse      = objUtilityWeb.PostAsJsonAsync(WebApiURL.LawGuide + "/DeleteLawGuide", objViewLawGuideModel);
                    objViewLawGuideModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <ViewLawGuideModel>().Result : null;

                    if (Convert.ToInt32(ErrorCode).Equals(0))
                    {
                        //if error code 0 means delete successfully than set Delete success message.
                        objViewLawGuideModel.Message     = "LawGuide Deleted Successfully";
                        objViewLawGuideModel.MessageType = CommonUtils.MessageType.Success.ToString().ToLower();
                    }
                    else
                    {
                        //if error code is not 0 means delete error  than set Delete error message.
                        objViewLawGuideModel.Message     = "Error while deleting record";
                        objViewLawGuideModel.MessageType = CommonUtils.MessageType.Error.ToString().ToLower();;
                    }
                }
                //Get  LawGuide List based on searching , sorting and paging parameter.

                serviceResponse      = objUtilityWeb.PostAsJsonAsync(WebApiURL.LawGuide + "/GetLawGuideList", objViewLawGuideModel);
                objViewLawGuideModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <ViewLawGuideModel>().Result : null;

                SubCatDropDown(objViewLawGuideModel.FilterSubCatId, null, null);
            }
            catch (Exception ex)
            {
                ErrorLog(ex, "LawGuide", "View POST");
            }
            return(PartialView("_LawGuideList", objViewLawGuideModel));
        }
 public ViewLawGuideModel GetLawGuideList(ViewLawGuideModel objViewLawGuideModel)
 {
     return(objBLLawGuide.GetLawGuideList(objViewLawGuideModel));
 }
 public ViewLawGuideModel DeleteLawGuide(ViewLawGuideModel objViewLawGuideModel)
 {
     return(objBLLawGuide.DeleteLawGuide(objViewLawGuideModel));
 }