public ActionResult Add(SIMREG_REQUESTEDTYPEViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _boSIMREG_REQUESTEDTYPE = new BOSIMREG_REQUESTEDTYPE();

                    var beSIMREG_REQUESTEDTYPE = new BESIMREG_REQUESTEDTYPE
                    {
                        REQUESTEDTYPEID = model.REQUESTEDTYPEID,
                        TITLE = model.TITLE,
                        IDATE = DateTime.Now,
                        IUSER = model.IUSER,
                        EDATE = DateTime.Now,
                        EUSER = model.EUSER,
                        IsNew = true
                    };

                    _boSIMREG_REQUESTEDTYPE.Save(beSIMREG_REQUESTEDTYPE);

                    return Content(Boolean.TrueString);
                }

                return Content(ExceptionHelper.ModelStateErrorFormat(ModelState));
            }
            catch (Exception ex)
            {
                ExceptionHelper.ExceptionMessageFormat(ex);
                return Content("Sorry! Unable to add this data.");
            }
        }
        //
        // GET: /REQUESTEDTYPE/Delete/by id
        public ActionResult Delete(int id)
        {
            try
            {
                _boSIMREG_REQUESTEDTYPE = new BOSIMREG_REQUESTEDTYPE();

                var sIMREG_REQUESTEDTYPE = _boSIMREG_REQUESTEDTYPE.GetSIMREG_REQUESTEDTYPE(id);
                if (sIMREG_REQUESTEDTYPE != null)
                {
                    var sIMREG_REQUESTEDTYPEViewModel = new SIMREG_REQUESTEDTYPEViewModel
                    {
                        REQUESTEDTYPEID = sIMREG_REQUESTEDTYPE.REQUESTEDTYPEID,
                        TITLE = sIMREG_REQUESTEDTYPE.TITLE,
                        //IDATE = sIMREG_REQUESTEDTYPE.IDATE,
                        //IUSER = sIMREG_REQUESTEDTYPE.IUSER,
                        //EDATE = sIMREG_REQUESTEDTYPE.EDATE,
                        //EUSER = sIMREG_REQUESTEDTYPE.EUSER
                    };

                    return PartialView("_Delete", sIMREG_REQUESTEDTYPEViewModel);
                }
                else
                {
                    return PartialView("_Error", "Could not found, your request data.");
                }

            }
            catch (Exception ex)
            {
                ExceptionHelper.ExceptionMessageFormat(ex);
                return PartialView("_Error", ex);
            }
        }
        //
        // GET: /NEWFORM/Add
        public ActionResult Add()
        {
            try
            {
                _boSIMREG_REQUESTEDBY = new BOSIMREG_REQUESTEDBY();
                _boSIMREG_REQUESTEDTYPE = new BOSIMREG_REQUESTEDTYPE();
                _boSIMREG_DELIVEREDBY = new BOSIMREG_DELIVEREDBY();

                var sIMREG_NEWFORMViewModel = new SIMREG_NEWFORMViewModel();

                var sIMREG_REQUESTEDBYList = SelectListItemExtension.PopulateDropdownList(_boSIMREG_REQUESTEDBY.GetSIMREG_REQUESTEDBYs().ToList<BESIMREG_REQUESTEDBY>(), "REQUESTEDBYID", "TITLE").ToList();

                var sIMREG_REQUESTEDTYPEList = SelectListItemExtension.PopulateDropdownList(_boSIMREG_REQUESTEDTYPE.GetSIMREG_REQUESTEDTYPEs().ToList<BESIMREG_REQUESTEDTYPE>(), "REQUESTEDTYPEID", "TITLE").ToList();

                //var sIMREG_DELIVEREDBYList = SelectListItemExtension.PopulateDropdownList(_boSIMREG_DELIVEREDBY.GetSIMREG_DELIVEREDBYs().ToList<BESIMREG_DELIVEREDBY>(), "DELIVEREDBYID", "TITLE").ToList();

                string userName = Session["UserName"] != null ? Session["UserName"].ToString() : string.Empty;

                var sIMREG_DELIVEREDBY = _boSIMREG_DELIVEREDBY.GetSIMREG_DELIVEREDBYbyUSERNAME(userName);

                sIMREG_NEWFORMViewModel.ddlREQUESTEDBYS = sIMREG_REQUESTEDBYList;
                sIMREG_NEWFORMViewModel.ddlREQUESTEDTYPES = sIMREG_REQUESTEDTYPEList;
                sIMREG_NEWFORMViewModel.DELIVEREDBYID = sIMREG_DELIVEREDBY.DELIVEREDBYID;
                sIMREG_NEWFORMViewModel.DELIVEREDBYTITLE = sIMREG_DELIVEREDBY.TITLE;
                //sIMREG_NEWFORMViewModel.ddlDELIVEREDBYS = sIMREG_DELIVEREDBYList;
                //sIMREG_NEWFORMViewModel.REQUESTEDDATE = DateTime.Now;
                sIMREG_NEWFORMViewModel.DELIVEREDBYDATE = DateTime.Now;

                return PartialView("_Add", sIMREG_NEWFORMViewModel);

            }
            catch (Exception ex)
            {
                ExceptionHelper.ExceptionMessageFormat(ex);
                return PartialView("_Error", ex);
            }
        }
        private List<SIMREG_REQUESTEDTYPEViewModel> GetREQUESTEDTYPEDataList()
        {
            _boSIMREG_REQUESTEDTYPE = new BOSIMREG_REQUESTEDTYPE();

            List<SIMREG_REQUESTEDTYPEViewModel> modellist = new List<SIMREG_REQUESTEDTYPEViewModel>();

            var sIMREG_REQUESTEDTYPEList = _boSIMREG_REQUESTEDTYPE.GetSIMREG_REQUESTEDTYPEs().ToList();

            modellist = sIMREG_REQUESTEDTYPEList.Select(x => new SIMREG_REQUESTEDTYPEViewModel
            {
                REQUESTEDTYPEID = x.REQUESTEDTYPEID,
                TITLE = x.TITLE,
                IDATE = x.IDATE,
                IUSER = x.IUSER,
                EDATE = x.EDATE,
                EUSER = x.EUSER

            }).ToList();

            return modellist;
        }
        public ActionResult Edit(SIMREG_REQUESTEDTYPEViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _boSIMREG_REQUESTEDTYPE = new BOSIMREG_REQUESTEDTYPE();

                    var sIMREG_REQUESTEDTYPE = _boSIMREG_REQUESTEDTYPE.GetSIMREG_REQUESTEDTYPE(model.REQUESTEDTYPEID);

                    if (sIMREG_REQUESTEDTYPE != null)
                    {
                        sIMREG_REQUESTEDTYPE.REQUESTEDTYPEID = model.REQUESTEDTYPEID;
                        sIMREG_REQUESTEDTYPE.TITLE = model.TITLE;
                        //sIMREG_REQUESTEDTYPE.IDATE = DateTime.Now;
                        //sIMREG_REQUESTEDTYPE.IUSER = model.IUSER;
                        sIMREG_REQUESTEDTYPE.EDATE = DateTime.Now;
                        sIMREG_REQUESTEDTYPE.EUSER = model.EUSER;
                        sIMREG_REQUESTEDTYPE.IsNew = false;

                        _boSIMREG_REQUESTEDTYPE.Save(sIMREG_REQUESTEDTYPE);

                        return Content(Boolean.TrueString);
                    }
                    else
                    {
                        return Content("Could not found, your request data.");
                    }
                }

                return Content(ExceptionHelper.ModelStateErrorFormat(ModelState));
            }
            catch (Exception ex)
            {
                ExceptionHelper.ExceptionMessageFormat(ex);
                return Content("Sorry! Unable to edit this data.");
            }
        }
        //private List<SIMREG_NEWFORMViewModel> GetNEWFORMDataList(string msisdnTitle, string requestById, string requestTypeId, string deliverById, string fromDate, string toDate)
        private List<SIMREG_NEWFORMViewModel> GetNEWFORMDataList(string sidx, string sord, int page, int rows, string msisdnTitle, string requestById, string requestTypeId, string deliverById, string requestFromDate, string requestToDate, string deliverFromDate, string deliverToDate)
        {
            _boSIMREG_NEWFORM = new BOSIMREG_NEWFORM();
            _boSIMREG_REQUESTEDBY = new BOSIMREG_REQUESTEDBY();
            _boSIMREG_REQUESTEDTYPE = new BOSIMREG_REQUESTEDTYPE();
            _boSIMREG_DELIVEREDBY = new BOSIMREG_DELIVEREDBY();

            if (!String.IsNullOrEmpty(requestFromDate))
            {
                requestFromDate = Convert.ToDateTime(requestFromDate).ToString("dd-MMM-yyyy");
            }

            if (!String.IsNullOrEmpty(requestToDate))
            {
                requestToDate = Convert.ToDateTime(requestToDate).ToString("dd-MMM-yyyy");
            }

            if (!String.IsNullOrEmpty(deliverFromDate))
            {
                deliverFromDate = Convert.ToDateTime(deliverFromDate).ToString("dd-MMM-yyyy");
            }

            if (!String.IsNullOrEmpty(deliverToDate))
            {
                deliverToDate = Convert.ToDateTime(deliverToDate).ToString("dd-MMM-yyyy");
            }

            List<SIMREG_NEWFORMViewModel> modellist = new List<SIMREG_NEWFORMViewModel>();

            var sIMREG_NEWFORMList = _boSIMREG_NEWFORM.GetSIMREG_NEWFORMs(sidx, sord, page, rows, msisdnTitle, requestById, requestTypeId, deliverById, requestFromDate, requestToDate, deliverFromDate, deliverToDate).ToList();

            modellist = sIMREG_NEWFORMList.Select(x => new SIMREG_NEWFORMViewModel
            {

                ID = x.ID,
                MSISDNID = x.MSISDNID,
                //MSISDNTITLE = _boSIMREG_MSISDN.GetSIMREG_MSISDN(x.MSISDNID).TITLE,
                MSISDNTITLE = x.MSISDNTITLE,
                REQUESTEDDATE = x.REQUESTEDDATE,
                REQUESTEDBYID = x.REQUESTEDBYID,
                REQUESTEDBYTITLE = _boSIMREG_REQUESTEDBY.GetSIMREG_REQUESTEDBY(x.REQUESTEDBYID).TITLE,
                REQUESTEDTYPEID = x.REQUESTEDTYPEID,
                REQUESTEDTYPETITLE = _boSIMREG_REQUESTEDTYPE.GetSIMREG_REQUESTEDTYPE(x.REQUESTEDTYPEID).TITLE,
                DELIVEREDBYDATE = x.DELIVEREDBYDATE,
                DELIVEREDBYID = x.DELIVEREDBYID,
                DELIVEREDBYTITLE = _boSIMREG_DELIVEREDBY.GetSIMREG_DELIVEREDBY(x.DELIVEREDBYID).TITLE,
                IDATE = x.IDATE,
                IUSER = x.IUSER,
                EDATE = x.EDATE,
                EUSER = x.EUSER

            }).ToList();

            return modellist;
        }
        public ActionResult Search()
        {
            try
            {
                _boSIMREG_REQUESTEDBY = new BOSIMREG_REQUESTEDBY();
                _boSIMREG_REQUESTEDTYPE = new BOSIMREG_REQUESTEDTYPE();
                _boSIMREG_DELIVEREDBY = new BOSIMREG_DELIVEREDBY();

                var sIMREG_NEWFORMSearchViewModel = new SIMREG_NEWFORMSearchViewModel();

                var sIMREG_REQUESTEDBYList = SelectListItemExtension.PopulateDropdownList(_boSIMREG_REQUESTEDBY.GetSIMREG_REQUESTEDBYs().ToList<BESIMREG_REQUESTEDBY>(), "REQUESTEDBYID", "TITLE").ToList();

                var sIMREG_REQUESTEDTYPEList = SelectListItemExtension.PopulateDropdownList(_boSIMREG_REQUESTEDTYPE.GetSIMREG_REQUESTEDTYPEs().ToList<BESIMREG_REQUESTEDTYPE>(), "REQUESTEDTYPEID", "TITLE").ToList();

                var sIMREG_DELIVEREDBYList = SelectListItemExtension.PopulateDropdownList(_boSIMREG_DELIVEREDBY.GetSIMREG_DELIVEREDBYs().ToList<BESIMREG_DELIVEREDBY>(), "DELIVEREDBYID", "TITLE").ToList();

                sIMREG_NEWFORMSearchViewModel.ddlREQUESTEDBYS = sIMREG_REQUESTEDBYList;
                sIMREG_NEWFORMSearchViewModel.ddlREQUESTEDTYPES = sIMREG_REQUESTEDTYPEList;
                sIMREG_NEWFORMSearchViewModel.ddlDELIVEREDBYS = sIMREG_DELIVEREDBYList;

                return View(sIMREG_NEWFORMSearchViewModel);

            }
            catch (Exception ex)
            {
                ExceptionHelper.ExceptionMessageFormat(ex);
                return View("Error", ex);
            }
        }
        //
        // GET: /NEWFORM/Edit/by id
        public ActionResult Edit(int id)
        {
            try
            {
                _boSIMREG_NEWFORM = new BOSIMREG_NEWFORM();
                _boSIMREG_REQUESTEDBY = new BOSIMREG_REQUESTEDBY();
                _boSIMREG_REQUESTEDTYPE = new BOSIMREG_REQUESTEDTYPE();
                _boSIMREG_DELIVEREDBY = new BOSIMREG_DELIVEREDBY();

                var sIMREG_NEWFORM = _boSIMREG_NEWFORM.GetSIMREG_NEWFORM(id);
                if (sIMREG_NEWFORM != null)
                {

                    var sIMREG_REQUESTEDBYList = SelectListItemExtension.PopulateDropdownList(_boSIMREG_REQUESTEDBY.GetSIMREG_REQUESTEDBYs().ToList<BESIMREG_REQUESTEDBY>(), "REQUESTEDBYID", "TITLE", isEdit: true, selectedValue: sIMREG_NEWFORM != null ? sIMREG_NEWFORM.REQUESTEDBYID.ToString() : "0").ToList();

                    var sIMREG_REQUESTEDTYPEList = SelectListItemExtension.PopulateDropdownList(_boSIMREG_REQUESTEDTYPE.GetSIMREG_REQUESTEDTYPEs().ToList<BESIMREG_REQUESTEDTYPE>(), "REQUESTEDTYPEID", "TITLE", isEdit: true, selectedValue: sIMREG_NEWFORM != null ? sIMREG_NEWFORM.REQUESTEDTYPEID.ToString() : "0").ToList();

                    var sIMREG_DELIVEREDBYList = SelectListItemExtension.PopulateDropdownList(_boSIMREG_DELIVEREDBY.GetSIMREG_DELIVEREDBYs().ToList<BESIMREG_DELIVEREDBY>(), "DELIVEREDBYID", "TITLE", isEdit: true, selectedValue: sIMREG_NEWFORM != null ? sIMREG_NEWFORM.DELIVEREDBYID.ToString() : "0").ToList();

                    var sIMREG_NEWFORMViewModel = new SIMREG_NEWFORMViewModel
                    {
                        ID = sIMREG_NEWFORM.ID,
                        MSISDNID = sIMREG_NEWFORM.MSISDNID,
                        //MSISDNTITLE = _boSIMREG_MSISDN.GetSIMREG_MSISDN(sIMREG_NEWFORM.MSISDNID).TITLE,
                        MSISDNTITLE = sIMREG_NEWFORM.MSISDNTITLE,
                        REQUESTEDDATE = sIMREG_NEWFORM.REQUESTEDDATE,
                        REQUESTEDBYID = sIMREG_NEWFORM.REQUESTEDBYID,
                        REQUESTEDBYTITLE = _boSIMREG_REQUESTEDBY.GetSIMREG_REQUESTEDBY(sIMREG_NEWFORM.REQUESTEDBYID).TITLE,
                        REQUESTEDTYPEID = sIMREG_NEWFORM.REQUESTEDTYPEID,
                        REQUESTEDTYPETITLE = _boSIMREG_REQUESTEDTYPE.GetSIMREG_REQUESTEDTYPE(sIMREG_NEWFORM.REQUESTEDTYPEID).TITLE,
                        DELIVEREDBYDATE = sIMREG_NEWFORM.DELIVEREDBYDATE,
                        DELIVEREDBYID = sIMREG_NEWFORM.DELIVEREDBYID,
                        DELIVEREDBYTITLE = _boSIMREG_DELIVEREDBY.GetSIMREG_DELIVEREDBY(sIMREG_NEWFORM.DELIVEREDBYID).TITLE,
                        IDATE = sIMREG_NEWFORM.IDATE,
                        IUSER = sIMREG_NEWFORM.IUSER,
                        EDATE = sIMREG_NEWFORM.EDATE,
                        EUSER = sIMREG_NEWFORM.EUSER,
                        ddlREQUESTEDBYS = sIMREG_REQUESTEDBYList,
                        ddlREQUESTEDTYPES = sIMREG_REQUESTEDTYPEList,
                        //ddlDELIVEREDBYS = sIMREG_DELIVEREDBYList
                    };

                    return PartialView("_Edit", sIMREG_NEWFORMViewModel);
                }
                else
                {
                    return PartialView("_Error", "Could not found, your request data.");
                }

            }
            catch (Exception ex)
            {
                ExceptionHelper.ExceptionMessageFormat(ex);
                return PartialView("_Error", ex);
            }
        }
        //[HttpPost]
        //public ActionResult ExportToExcel(List<SIMREG_NEWFORMViewModel> modelList)
        //{
        //    try
        //    {
        //        if (modelList.Count > 0)
        //        {
        //            var modelDataTable = ConvertHelper.ConvertToDataTable<SIMREG_NEWFORMViewModel>(modelList);
        //            //ExportHelper exportHelper = new ExportHelper("SimRegisterReport.csv", true);
        //            //string expData = exportHelper.ExportData(modelDataTable, System.Web.HttpContext.Current.Response);
        //            //return File(new System.Text.UTF8Encoding().GetBytes(expData), "text/csv", "Report123.csv");
        //            return Content(Boolean.TrueString);
        //        }
        //        else
        //        {
        //            return Content("Sorry! Unable to export null data.");
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        return Content(ExceptionHelper.ExceptionMessageFormat(ex));
        //    }
        //}
        //
        // GET: /NEWFORM/Details/by id
        public ActionResult Details(int id)
        {
            try
            {
                _boSIMREG_NEWFORM = new BOSIMREG_NEWFORM();
                _boSIMREG_REQUESTEDBY = new BOSIMREG_REQUESTEDBY();
                _boSIMREG_REQUESTEDTYPE = new BOSIMREG_REQUESTEDTYPE();
                _boSIMREG_DELIVEREDBY = new BOSIMREG_DELIVEREDBY();

                var sIMREG_NEWFORM = _boSIMREG_NEWFORM.GetSIMREG_NEWFORM(id);
                if (sIMREG_NEWFORM != null)
                {
                    var sIMREG_NEWFORMViewModel = new SIMREG_NEWFORMViewModel
                    {
                        ID = sIMREG_NEWFORM.ID,
                        MSISDNID = sIMREG_NEWFORM.MSISDNID,
                        //MSISDNTITLE = _boSIMREG_MSISDN.GetSIMREG_MSISDN(sIMREG_NEWFORM.MSISDNID).TITLE,
                        MSISDNTITLE = sIMREG_NEWFORM.MSISDNTITLE,
                        REQUESTEDDATE = sIMREG_NEWFORM.REQUESTEDDATE,
                        REQUESTEDBYID = sIMREG_NEWFORM.REQUESTEDBYID,
                        REQUESTEDBYTITLE = _boSIMREG_REQUESTEDBY.GetSIMREG_REQUESTEDBY(sIMREG_NEWFORM.REQUESTEDBYID).TITLE,
                        REQUESTEDTYPEID = sIMREG_NEWFORM.REQUESTEDTYPEID,
                        REQUESTEDTYPETITLE = _boSIMREG_REQUESTEDTYPE.GetSIMREG_REQUESTEDTYPE(sIMREG_NEWFORM.REQUESTEDTYPEID).TITLE,
                        DELIVEREDBYDATE = sIMREG_NEWFORM.DELIVEREDBYDATE,
                        DELIVEREDBYID = sIMREG_NEWFORM.DELIVEREDBYID,
                        DELIVEREDBYTITLE = _boSIMREG_DELIVEREDBY.GetSIMREG_DELIVEREDBY(sIMREG_NEWFORM.DELIVEREDBYID).TITLE,
                        IDATE = sIMREG_NEWFORM.IDATE,
                        IUSER = sIMREG_NEWFORM.IUSER,
                        EDATE = sIMREG_NEWFORM.EDATE,
                        EUSER = sIMREG_NEWFORM.EUSER
                    };

                    return PartialView("_Details", sIMREG_NEWFORMViewModel);
                }
                else
                {
                    return PartialView("_Error", "Could not found, your request data.");
                }

            }
            catch (Exception ex)
            {
                ExceptionHelper.ExceptionMessageFormat(ex);
                return PartialView("_Error", ex);
            }
        }