public ActionResult SaveProcessname(Processname_Model objModel, int page = 1, int pageSize = 10)
        {
            if (!ModelState.IsValid)
            {
                var message = string.Join("|", ModelState.Values.SelectMany(e => e.Errors).Select(em => em.ErrorMessage));
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, message));
            }

            //Save
            ProcessnameManager context = new ProcessnameManager(new DataContext());
            var msg = context.SaveProcessname(objModel.Table);

            if (msg.Contains("exists"))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, "exists"));
            }
            else
            {
                if (objModel.StaticPageSize != 0)
                {
                    pageSize = objModel.StaticPageSize;
                }
                objModel.StaticPageSize = pageSize;

                BindProcessnameGrid(objModel, page, pageSize);
                return(PartialView("ProcessnameList", objModel));
            }
        }
        public ActionResult AddEditProcessname(int ID = 0)
        {
            ProcessnameManager context  = new ProcessnameManager(new DataContext());
            Processname_Model  objModel = new Processname_Model();

            if (ID != 0)
            {
                objModel.Table = context.GetProcessnameById(ID);
            }
            else
            {
                objModel.Table = new Processname();
            }
            return(PartialView("ProcessnameCRUD", objModel));
        }
        public void BindProcessnameGrid(Processname_Model objModel, int page, int pageSize)
        {
            StringBuilder query   = new StringBuilder();
            var           colName = common.GetColumns(CommonFunction.module.Processname.ToString());

            query = common.GetSqlTableQuery(CommonFunction.module.Processname.ToString());
            if (objModel != null)
            {
                objModel.StaticPageSize = pageSize;
            }

            ProcessnameManager context = new ProcessnameManager(new DataContext());

            context.setModel(query, objModel, colName, "Processname", page, pageSize);
        }
        public ActionResult DeleteProcessname(string ID, Processname_Model objModel, int page = 1, int pageSize = 10)
        {
            ProcessnameManager context = new ProcessnameManager(new DataContext());

            if (!string.IsNullOrEmpty(ID))
            {
                int pId = Convert.ToInt32(ID);
                List <Processname> lst = context.GetAll(c => c.ProcID == pId).ToList();
                context.DeleteProcessname(lst);
            }

            if (objModel.StaticPageSize != 0)
            {
                pageSize = objModel.StaticPageSize;
            }
            objModel.StaticPageSize = pageSize;

            BindProcessnameGrid(objModel, page, pageSize);
            return(PartialView("ProcessnameList", objModel));
        }