Ejemplo n.º 1
0
        public string Added(FormCollection form)
        {
            var stateInfo = GeneralHandler.StateSuccess;

            if (AddedByCheck(form, out stateInfo))
            {
                DawnAuthStatusMDL dataInfo = new DawnAuthStatusMDL();
                dataInfo.StatTime = DateTime.Now;
                dataInfo.MdlId    = int.Parse(form["ddlModule"]);
                dataInfo.StatName = form["txtName"];
                dataInfo.StatCode = form["txtCode"];
                dataInfo.StatMark = int.Parse(form["txtMark"]);
                dataInfo.StatDesc = form["txtDesc"];
                bool added = DawnAuthStatusBLL.Exists(string.Format("stat_code='{0}'", dataInfo.StatCode));
                if (added)
                {
                    stateInfo = GeneralHandler.StateAdded;
                }
                else
                {
                    DawnAuthStatusBLL.Insert(dataInfo);
                }
            }
            return(stateInfo);
        }
Ejemplo n.º 2
0
        public string Delete(string id)
        {
            var stateInfo = GeneralHandler.StateSuccess;

            if (!string.IsNullOrEmpty(id))
            {
                DawnAuthStatusBLL.Delete(int.Parse(id));
            }
            return(stateInfo);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 状态机制数据列表
        /// </summary>
        /// <param name="id">数据表单</param>
        /// <returns>执行结果</returns>
        public ActionResult Search(FormCollection form)
        {
            string strWhere = null;
            var    pgParam  = "Nothing,Nothing";
            //隶属模块
            var sltModule = TypeHelper.TypeToInt32(form["sltModule"], -1);

            if (sltModule > 0)
            {
                pgParam += string.Format(",sltModule,{0}", sltModule);
                if (strWhere == null)
                {
                    strWhere = string.Format("mdl_id='{0}'", sltModule);
                }
                else
                {
                    strWhere += string.Format(" and mdl_id='{0}'", sltModule);
                }
            }
            //机制编码
            var txtCode = form["txtCode"] as string;

            if (!string.IsNullOrEmpty(txtCode) && ValidHelper.EngIsEngAndNums(txtCode))
            {
                pgParam += string.Format(",txtCode,{0}", txtCode);
                if (strWhere == null)
                {
                    strWhere = string.Format("charindex('{0}',stat_code)>0", txtCode);
                }
                else
                {
                    strWhere += string.Format(" and charindex('{0}',stat_code)>0", txtCode);
                }
            }
            var dataPager = new PagerHelperCHS();

            dataPager.PageSize = GeneralHandler.PageSize;
            if (form.Count > 1)
            {
                dataPager.PageCurrent = TypeHelper.TypeToInt32(form["pager"], 1);
            }
            else
            {
                dataPager.PageCurrent = TypeHelper.TypeToInt32(form["id"], 1);
            }
            int pageCount, recordCount;
            var dataList = DawnAuthStatusBLL.SelectPSPisAllPurposeRowNumber(dataPager.PageSize, dataPager.PageCurrent, "stat_time desc,mdl_id", strWhere, out pageCount, out recordCount);

            dataPager.PageCount       = pageCount;
            dataPager.RecordCount     = recordCount;
            dataPager.PageRecordCount = dataList.Count;
            ViewBag.Pager             = dataPager;
            ViewBag.PagerParam        = pgParam;
            return(View("List", dataList));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 生成状态机制
        /// </summary>
        /// <param name="sb"></param>
        static void BuildStatus(ref StringBuilder sb)
        {
            var mdlList = DawnAuthModuleBLL.ISelect("mdl_ident<1", "mdl_rank");

            if (mdlList.Count > 0)
            {
                foreach (var mdlInfo in mdlList)
                {
                    var statList = DawnAuthStatusBLL.ISelect(string.Format("mdl_id='{0}'", mdlInfo.MdlId), "stat_mark");
                    if (statList.Count > 0)
                    {
                        sb.Append("\n");
                        sb.AppendFormat("#region 状态机制·{0}\n", mdlInfo.MdlName);
                        sb.Append("\n");
                        sb.Append("/// <summary>\n");
                        sb.AppendFormat("/// 状态机制·{0}\n", mdlInfo.MdlName);
                        if (!string.IsNullOrEmpty(mdlInfo.MdlDesc))
                        {
                            sb.Append("/// <remarks>\n");
                            sb.AppendFormat("/// {0}\n", mdlInfo.MdlDesc);
                            sb.Append("/// </remarks>\n");
                        }
                        sb.Append("/// </summary>\n");
                        sb.AppendFormat("public enum StatusOf{0} : int\n", mdlInfo.MdlCode);
                        sb.Append("{\n");
                        int statCount = statList.Count;
                        foreach (var statInfo in statList)
                        {
                            statCount--;
                            sb.Append("/// <summary>\n");
                            sb.AppendFormat("/// {0}\n", statInfo.StatName);
                            sb.Append("/// </summary>\n");
                            if (statCount > 0)
                            {
                                sb.AppendFormat("{0}={1},\n", statInfo.StatCode, statInfo.StatMark);
                            }
                            else
                            {
                                sb.AppendFormat("{0}={1}\n", statInfo.StatCode, statInfo.StatMark);
                            }
                        }
                        sb.Append("}\n");
                        sb.Append("\n");
                        sb.Append("#endregion\n");
                    }
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 状态机制数据列表
        /// </summary>
        /// <param name="id">页码</param>
        /// <returns>执行结果</returns>
        public ActionResult List(string id)
        {
            var pager = new PagerHelperCHS();

            pager.PageSize    = GeneralHandler.PageSize;
            pager.PageCurrent = TypeHelper.TypeToInt32(id, 1);
            int pageCount, recordCount;
            var dataList = DawnAuthStatusBLL.SelectPSPisAllPurposeRowNumber(pager.PageSize, pager.PageCurrent, null, out pageCount, out recordCount);

            pager.PageCount       = pageCount;
            pager.RecordCount     = recordCount;
            pager.PageRecordCount = dataList.Count;
            ViewBag.Pager         = pager;
            ViewBag.PagerParam    = null;
            return(View(dataList));
        }
Ejemplo n.º 6
0
        public string GetStatus(FormCollection form)
        {
            int moduleId = TypeHelper.TypeToInt32(form["moduleId"], 0);
            int userId   = TypeHelper.TypeToInt32(form["userId"], 0);

            if (moduleId < 1 || userId < 1)
            {
                return(GeneralHandler.FNoneInfo);
            }
            var dataList = DawnAuthStatusBLL.ISelect(string.Format("mdl_id='{0}'", moduleId), "stat_mark");

            if (dataList == null || dataList.Count < 1)
            {
                return(GeneralHandler.FNoneInfo);
            }
            var           mapList  = DawnAuthUserStatusBLL.ISelect(string.Format("user_id='{0}'", userId));
            int           indexVal = 0;
            StringBuilder sb       = new StringBuilder();

            foreach (var item in dataList)
            {
                indexVal++;
                sb.Append("<li class=\"field-item bi\">");
                sb.AppendFormat("<label>{0}</label>", item.StatName);
                if (mapList != null && mapList.Count(p => p.StatId == item.StatId) > 0)
                {
                    sb.AppendFormat("<input class=\"switch-on\" type=\"button\" id=\"btn{0}\" onclick=\"dataUnSave({0},{1},{2});\" />", indexVal, userId, item.StatId);
                }
                else
                {
                    sb.AppendFormat("<input class=\"switch-off\" type=\"button\" id=\"btn{0}\" onclick=\"dataSave({0},{1},{2});\" />", indexVal, userId, item.StatId);
                }
                sb.AppendFormat("<span class=\"margin-left-10\">{0}</span>", item.StatDesc);
                sb.Append("</li>");
            }
            return(sb.ToString());
        }