public ActionResult Index(int page = 1)
        {
            SysEnum.RepNormalType RepNormalType = SysEnum.Parse <SysEnum.RepNormalType>(Function.GetRequestString("RepNormalType"));
            var list = RepResearchNormalBLL.GetList(p => true);

            list = list.Where(a => a.TypeFlag == (int)RepNormalType);
            ViewBag.RepNormalType = RepNormalType;
            string   Name      = Function.GetRequestString("Name");
            DateTime DateBegin = Function.GetRequestDateTime("DateBegin");
            DateTime DateEnd   = Function.GetRequestDateTime("DateEnd");

            if (DateBegin > DicInfo.DateZone)
            {
                list = list.Where(a => DbFunctions.DiffDays(a.DateBegin, DateBegin) <= 0);
                ViewBag.TxtDateBegin = DateBegin.ToString("yyyy-MM-dd");
            }
            if (DateEnd > DicInfo.DateZone)
            {
                list = list.Where(a => DbFunctions.DiffDays(a.DateEnd, DateEnd) >= 0);
                ViewBag.TxtDateEnd = DateEnd.ToString("yyyy-MM-dd");
            }
            switch (RepNormalType)
            {
            case SysEnum.RepNormalType.集体调研:
                if (!PowerActionBLL.PowerCheck(PowerInfo.P_工作信息管理.PP常规.PPP集体调研.查看所有))
                {
                    list = list.Where(a => a.CreateUserID == CurrentUser.ID);
                }
                break;

            case SysEnum.RepNormalType.一加三:
                if (!PowerActionBLL.PowerCheck(PowerInfo.P_工作信息管理.PP常规.PPP一加三.查看所有))
                {
                    list = list.Where(a => a.CreateUserID == CurrentUser.ID);
                }
                break;

            case SysEnum.RepNormalType.蹲点:
                if (!PowerActionBLL.PowerCheck(PowerInfo.P_工作信息管理.PP常规.PPP蹲点.查看所有))
                {
                    list = list.Where(a => a.CreateUserID == CurrentUser.ID);
                }
                break;

            case SysEnum.RepNormalType.教研组织:
                if (!PowerActionBLL.PowerCheck(PowerInfo.P_工作信息管理.PP常规.PPP教研组织.查看所有))
                {
                    list = list.Where(a => a.CreateUserID == CurrentUser.ID);
                }
                break;

            default:
                break;
            }

            list = list.OrderByDescending(p => p.ID);
            IPagedList <RepResearchNormalInfo> result = list.ToPagedList(page, PageSize);

            return(View(result));
        }
Example #2
0
        /// <summary>
        /// 保存企业投诉保修
        /// </summary>
        /// <param name="username"></param>
        /// <param name="address"></param>
        /// <param name="phone"></param>
        /// <param name="descri"></param>
        /// <returns></returns>
        public string SaveHouseOwnerComplainRepair(string username, string address, string phone, string descri)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(address))
                {
                    return(string.Format("<Rsp><IsOK>{0}</IsOK><RtMsg>{1}</RtMsg></Rsp>", false, "住址为必填项"));
                }
                if (string.IsNullOrWhiteSpace(phone))
                {
                    return(string.Format("<Rsp><IsOK>{0}</IsOK><RtMsg>{1}</RtMsg></Rsp>", false, "联系号码为必填项"));
                }
                if (string.IsNullOrWhiteSpace(descri))
                {
                    return(string.Format("<Rsp><IsOK>{0}</IsOK><RtMsg>{1}</RtMsg></Rsp>", false, "描述为必填项"));
                }

                WebSecurityService wsClient = new WebSecurityService();
                object             userId   = wsClient.GetUserId(username);
                if (userId == null)
                {
                    return(string.Format("<Rsp><IsOK>{0}</IsOK><RtMsg>{1}</RtMsg></Rsp>", false, "用户【" + username + "】不存在或已被删除"));
                }

                SysEnum seBll   = new SysEnum();
                var     seModel = seBll.GetModel(SysEnumHelper.GetEnumNameForComplainRepairType(SysEnumHelper.ComplainRepairType.ResidentFamily));
                if (seModel == null)
                {
                    return(string.Format("<Rsp><IsOK>{0}</IsOK><RtMsg>{1}</RtMsg></Rsp>", false, "找不到投诉保修类型,待系统管理员设定后再使用"));
                }

                ComplainRepairInfo model = new ComplainRepairInfo();
                model.UserId          = Guid.Parse(userId.ToString());
                model.LastUpdatedDate = DateTime.Now;
                model.Phone           = phone.Trim();
                model.Descri          = descri.Trim();
                model.SysEnumId       = Guid.Parse(seModel.Id.ToString());
                model.Status          = (byte)SysEnumHelper.ComplainRepairStatus.受理中;
                model.Address         = address.Trim();

                ComplainRepair bll    = new ComplainRepair();
                int            effect = bll.Insert(model);
                if (effect == 110)
                {
                    return(string.Format("<Rsp><IsOK>{0}</IsOK><RtMsg>{1}</RtMsg></Rsp>", false, "已存在相同数据记录,请勿重复提交!"));
                }
                if (effect < 1)
                {
                    return(string.Format("<Rsp><IsOK>{0}</IsOK><RtMsg>{1}</RtMsg></Rsp>", false, "操作失败,请正确操作!"));
                }
                else
                {
                    return(string.Format("<Rsp><IsOK>{0}</IsOK><RtMsg>{1}</RtMsg></Rsp>", true, "保存成功,我们会尽快处理!"));
                }
            }
            catch (Exception ex)
            {
                return(string.Format("<Rsp><IsOK>{0}</IsOK><RtMsg>{1}</RtMsg></Rsp>", false, "异常:" + ex.Message));
            }
        }
Example #3
0
        public string DelSysEnum(string id)
        {
            string errorMsg = string.Empty;

            try
            {
                if (!HttpContext.Current.User.IsInRole("Administrators"))
                {
                    return(MC.Role_InvalidError);
                }

                if (string.IsNullOrWhiteSpace(id))
                {
                    return(MC.Submit_InvalidRow);
                }
                Guid gId = Guid.Empty;
                Guid.TryParse(id, out gId);
                if (gId.Equals(Guid.Empty))
                {
                    return(MC.GetString(MC.Submit_Params_GetInvalidRegex, "对应标识值"));
                }

                SysEnum bll = new SysEnum();

                bll.Delete(gId);

                return("1");
            }
            catch (Exception ex)
            {
                errorMsg = ex.Message;
            }

            return(MC.GetString(MC.Submit_Ex_Error, errorMsg));
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Page.Title = "工作删除";
            BP.WF.Node nd = new BP.WF.Node(this.FK_Node);
            this.ToolBar1.Add("<b>删除方式:</b>");
            this.ToolBar1.AddDDL("DDL1");
            this.DDL1.Attributes["onchange"] = "OnChange(this);";
            this.ToolBar1.AddBtn("Btn_OK", "确定");
            this.ToolBar1.GetBtnByID("Btn_OK").Attributes["onclick"] = " return confirm('您确定要执行吗?');";
            this.ToolBar1.GetBtnByID("Btn_OK").Click += new EventHandler(ReturnWork_Click);
            this.ToolBar1.AddBtn("Btn_Cancel", "取消");
            this.ToolBar1.GetBtnByID("Btn_Cancel").Click += new EventHandler(ReturnWork_Click);
            string  appPath = this.Request.ApplicationPath;
            TextBox tb      = new TextBox();

            tb.TextMode = TextBoxMode.MultiLine;
            tb.ID       = "TB_Doc";
            tb.Rows     = 15;
            tb.Columns  = 50;
            this.Pub1.Add(tb);
            if (this.IsPostBack == false)
            {
                if (nd.HisDelWorkFlowRole == DelWorkFlowRole.DeleteAndWriteToLog)
                {
                    /*删除并记录日志 */
                    SysEnum se = new SysEnum(BtnAttr.DelEnable, (int)DelWorkFlowRole.DeleteAndWriteToLog);
                    this.DDL1.Items.Add(new ListItem(se.Lab, se.IntKey.ToString()));
                }

                if (nd.HisDelWorkFlowRole == DelWorkFlowRole.DeleteByFlag)
                {
                    /*逻辑删除 */
                    SysEnum se = new SysEnum(BtnAttr.DelEnable, (int)DelWorkFlowRole.DeleteByFlag);
                    this.DDL1.Items.Add(new ListItem(se.Lab, se.IntKey.ToString()));
                }

                if (nd.HisDelWorkFlowRole == DelWorkFlowRole.ByUser)
                {
                    /*让用户来决定.*/
                    SysEnums ses = new SysEnums(BtnAttr.DelEnable);
                    foreach (SysEnum se in ses)
                    {
                        DelWorkFlowRole role = (DelWorkFlowRole)se.IntKey;
                        if (role == DelWorkFlowRole.None)
                        {
                            continue;
                        }
                        if (role == DelWorkFlowRole.ByUser)
                        {
                            continue;
                        }
                        this.DDL1.Items.Add(new ListItem(se.Lab, se.IntKey.ToString()));
                    }
                }
            }
        }
Example #5
0
    void btn_Click(object sender, EventArgs e)
    {
        //原有个数
        SysEnums souceSes = new SysEnums();

        souceSes.Retrieve(SysEnumAttr.EnumKey, this.RefNo, SysEnumAttr.IntKey);

        SysEnums ses = new SysEnums();

        for (int i = 0; i < souceSes.Count + 10; i++)
        {
            TextBox tb = this.UCSys1.GetTextBoxByID("TB_" + i);
            if (tb == null)
            {
                continue;
            }
            if (string.IsNullOrEmpty(tb.Text))
            {
                continue;
            }

            SysEnum se = new SysEnum();
            se.IntKey  = i;
            se.Lab     = tb.Text.Trim();
            se.Lang    = BP.Web.WebUser.SysLang;
            se.EnumKey = this.RefNo;
            se.MyPK    = se.EnumKey + "_" + se.Lang + "_" + se.IntKey;
            ses.AddEntity(se);
        }

        if (ses.Count == 0)
        {
            this.Alert("枚举项目不能为空.");
            return;
        }

        ses.Delete(SysEnumAttr.EnumKey, this.RefNo);

        string lab = "";

        foreach (SysEnum se in ses)
        {
            se.Save();
            lab += "@" + se.IntKey + "=" + se.Lab;
        }
        SysEnumMain main = new SysEnumMain(this.RefNo);

        main.Name   = UCSys1.GetTextBoxByID("TB_Name").Text;
        main.CfgVal = lab;
        main.Update();
        this.Alert("保存成功.");
    }
Example #6
0
        /// <summary>
        /// 检查听评对象用记是否存在,不存在则创建
        /// </summary>
        private bool CreatePConfirmlectureUserID(ResearchInfo infoResearch)
        {
            UserInfo infoUser = null;

            if (infoResearch.lectureUserID > 0)
            {
                infoUser = UserBLL.GetList(a =>
                                           a.ID == infoResearch.lectureUserID &&
                                           a.DepartmentID == infoResearch.ResearchPlanInfo.DepartmentID).FirstOrDefault();
                if (null != infoUser)
                {
                    return(true);
                }
            }

            infoUser = new UserInfo();
            infoUser.DepartmentID     = infoResearch.ResearchPlanInfo.DepartmentID;
            infoUser.Name             = Function.GetRequestString("TxtLectureUserID");
            infoUser.Code             = infoUser.Name;
            infoUser.PassWord         = Guid.NewGuid().ToString().Replace("-", "");
            infoUser.Email            = infoUser.Tel = string.Empty;
            infoUser.CreateDate       = infoUser.LastDate = DateTime.Now;
            infoUser.Enable           = false;
            infoUser.LocationX        = infoUser.LocationY = 0;
            infoUser.WechatOpenID     = infoUser.WechatNameNick = infoUser.WechatHeadImg = infoUser.Sex = string.Empty;
            infoUser.IDCard           = string.Empty;
            infoUser.TypeID           = -1;
            infoUser.DefaultSubjectID = infoResearch.SubjectID;
            if (string.IsNullOrEmpty(infoUser.Name))
            {
                return(false);
            }

            //再根据名称找一,如果就不要加啦
            var ExistItem = UserBLL.GetList(a => a.Name.StartsWith(infoUser.Name + "|外区")).FirstOrDefault();

            if (null != ExistItem)
            {
                infoResearch.lectureUserID = ExistItem.ID;
                return(true);
            }


            //做insert前最后修正
            infoUser.Name = infoUser.Code = infoUser.Name
                                            + "|"
                                            + SysEnum.GetName(typeof(SysEnum.ResearchArea), infoResearch.ResearchPlanInfo.AreaID)
                                            + Guid.NewGuid().ToString().Replace("-", "");
            infoUser.SubjectInfo.Add(infoResearch.SubjectInfo);
            return(UserBLL.Create(infoUser).ID > 0);
        }
Example #7
0
        public string SaveSysEnum(SysEnumInfo sysEnumModel)
        {
            if (string.IsNullOrWhiteSpace(sysEnumModel.EnumName))
            {
                return(MessageContent.Submit_Params_InvalidError);
            }
            if (string.IsNullOrWhiteSpace(sysEnumModel.EnumCode))
            {
                return(MessageContent.Submit_Params_InvalidError);
            }
            if (string.IsNullOrWhiteSpace(sysEnumModel.EnumValue))
            {
                return(MessageContent.Submit_Params_InvalidError);
            }

            Guid gId = Guid.Empty;

            Guid.TryParse(sysEnumModel.Id.ToString(), out gId);
            sysEnumModel.Id = gId;

            Guid parentId = Guid.Empty;

            Guid.TryParse(sysEnumModel.ParentId.ToString(), out parentId);
            sysEnumModel.ParentId = parentId;

            SysEnum bll    = new SysEnum();
            int     effect = -1;

            if (!gId.Equals(Guid.Empty))
            {
                effect = bll.Update(sysEnumModel);
            }
            else
            {
                effect = bll.Insert(sysEnumModel);
            }

            if (effect == 110)
            {
                return(MessageContent.Submit_Exist);
            }
            if (effect > 0)
            {
                return("1");
            }
            else
            {
                return(MessageContent.Submit_Error);
            }
        }
        /// <summary>
        /// 绑定运输环节
        /// </summary>
        private void BindTranNode()
        {
            SysEnum seBll      = new SysEnum();
            var     list       = seBll.GetList("and t2.EnumCode = 'SendReceiveType' ");
            string  itemAppend = "";

            foreach (var item in list)
            {
                itemAppend += "{\"id\":\"" + item.EnumCode + "\",\"text\":\"" + item.EnumValue + "\"},";
            }
            itemAppend  = itemAppend.Trim(',');
            htmlAppend += "<div id=\"myDataForTranNode\" style=\"display:none;\">[";

            htmlAppend += itemAppend;

            htmlAppend += "]</div>";
        }
        /// <summary>
        /// 获取列表查询条件项,并构建查询参数集
        /// </summary>
        private void GetSearchItem()
        {
            parms = new ParamsHelper();
            SysEnum seBll = new SysEnum();
            var     model = seBll.GetModel("PublicTerritory");

            if (model == null)
            {
                MessageBox.Messager(Page, "数据字典未配置”投诉保修类别/公共区域投诉保修“", MessageContent.AlertTitle_Ex_Error, "error");
                return;
            }
            sqlWhere += "and SysEnumId = @SysEnumId ";
            SqlParameter parm = new SqlParameter("@SysEnumId", SqlDbType.UniqueIdentifier);

            parm.Value = model.Id;
            parms.Add(parm);
        }
Example #10
0
        public string DelSysEnum(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                return(MessageContent.Submit_InvalidRow);
            }
            Guid gId = Guid.Empty;

            Guid.TryParse(id, out gId);
            if (gId.Equals(Guid.Empty))
            {
                return(MessageContent.GetString(MessageContent.Submit_Params_GetInvalidRegex, "对应标识值"));
            }
            SysEnum bll = new SysEnum();

            bll.Delete(gId);
            return("1");
        }
Example #11
0
        private void GetJsonForCbbRepair(HttpContext context)
        {
            SysEnum seBll = new SysEnum();
            var     list  = seBll.GetListIncludeChild("ComplainCategory");

            if (list == null || list.Count() == 0)
            {
                context.Response.Write("[]");
            }

            string json = "";

            foreach (var model in list)
            {
                json += "{\"id\":\"" + model.Id + "\",\"text\":\"" + model.EnumValue + "\"},";
            }

            context.Response.Write("[" + json.Trim(',') + "]");
        }
        /// <summary>
        /// 获取模板参数并绑定到前端控件
        /// </summary>
        private void BindTemplateParams()
        {
            htmlAppend += "<div id=\"myDataForSmsParam\" style=\"display:none;\">[";

            SysEnum seBll      = new SysEnum();
            string  itemAppend = "";
            var     list       = seBll.GetList("and t2.EnumCode = 'SmsParam'", null);

            if (list != null && list.Count > 0)
            {
                foreach (var item in list)
                {
                    itemAppend += "{\"EnumCode\":\"" + item.EnumCode + "\",\"EnumValue\":\"" + item.EnumValue + "\",\"ParamsValue\":\"\",\"status\":\"否\"},";
                }

                itemAppend  = itemAppend.Trim(',');
                htmlAppend += itemAppend;
            }

            htmlAppend += "]</div>";
        }
Example #13
0
        private void GetJsonForCombobox(HttpContext context)
        {
            string enumCode = context.Request.QueryString["enumCode"];

            SysEnum seBll = new SysEnum();
            var     dic   = seBll.GetKeyValueByParent(enumCode);

            if (dic == null || dic.Count() == 0)
            {
                context.Response.Write("[]");
            }

            string json = "";

            foreach (var kvp in dic)
            {
                json += "{\"id\":\"" + kvp.Key + "\",\"text\":\"" + kvp.Value + "\"},";
            }

            context.Response.Write("[" + json.Trim(',') + "]");
        }
Example #14
0
        /// <summary>
        /// 获取属于当前枚举代号的所有节点项json格式字符串
        /// </summary>
        /// <param name="enumCode"></param>
        /// <returns></returns>
        public static string GetJsonForEnumCode(string enumCode)
        {
            SysEnum bll = new SysEnum();

            if (!enableCaching)
            {
                return(bll.GetTreeJsonForEnumCode("DicCode"));
            }

            string key  = "SysEnum_Json_" + enumCode + "";
            string data = (string)HttpRuntime.Cache[key];

            if (data == null)
            {
                data = bll.GetTreeJsonForEnumCode("DicCode");

                AggregateCacheDependency cd = DependencyFacade.GetSysEnumDependency();
                HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddHours(sysEnumTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }

            return(data);
        }
Example #15
0
        public static List <SysEnumInfo> GetList()
        {
            SysEnum bll = new SysEnum();

            if (!enableCaching)
            {
                return(bll.GetList());
            }

            string             key  = "sysEnum_list";
            List <SysEnumInfo> data = (List <SysEnumInfo>)HttpRuntime.Cache[key];

            if (data == null)
            {
                data = bll.GetList();

                AggregateCacheDependency cd = DependencyFacade.GetSysEnumDependency();
                HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddHours(sysEnumTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }

            return(data);
        }
Example #16
0
        public string SaveEnum(string enumKey, string enumLab, string cfg)
        {
            SysEnumMain sem = new SysEnumMain();

            sem.No = enumKey;
            if (sem.RetrieveFromDBSources() == 0)
            {
                sem.Name   = enumLab;
                sem.CfgVal = cfg;
                sem.Lang   = WebUser.SysLang;
                sem.Insert();
            }
            else
            {
                sem.Name   = enumLab;
                sem.CfgVal = cfg;
                sem.Lang   = WebUser.SysLang;
                sem.Update();
            }

            string[] strs = cfg.Split('@');
            foreach (string str in strs)
            {
                if (string.IsNullOrEmpty(str))
                {
                    continue;
                }
                string[] kvs = str.Split('=');
                SysEnum  se  = new SysEnum();
                se.EnumKey = enumKey;
                se.Lang    = WebUser.SysLang;
                se.IntKey  = int.Parse(kvs[0]);
                se.Lab     = kvs[1];
                se.Insert();
            }
            return("save ok.");
        }
Example #17
0
        public static List <SysEnumInfo> GetList(string parentName)
        {
            SysEnum bll = new SysEnum();

            SqlParameter parm = new SqlParameter("@EnumName", parentName);

            if (!enableCaching)
            {
                return(bll.GetList(1, 100000, "and t2.EnumName = @EnumName", parm));
            }

            string             key  = "sysEnum_list_" + parentName + "";
            List <SysEnumInfo> data = (List <SysEnumInfo>)HttpRuntime.Cache[key];

            if (data == null)
            {
                data = bll.GetList(1, 100000, "and t2.EnumName = @EnumName", parm);

                AggregateCacheDependency cd = DependencyFacade.GetSysEnumDependency();
                HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddHours(sysEnumTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }

            return(data);
        }
Example #18
0
    void btn_New_Click(object sender, EventArgs e)
    {
        string      no   = this.UCSys1.GetTextBoxByID("TB_No").Text;
        string      name = this.UCSys1.GetTextBoxByID("TB_Name").Text;
        SysEnumMain m    = new SysEnumMain();

        m.No = no;
        if (m.RetrieveFromDBSources() == 1)
        {
            this.Alert("枚举编号:" + m.No + " 已经被:" + m.Name + "占用");
            return;
        }
        m.Name = name;
        if (string.IsNullOrEmpty(name))
        {
            this.Alert("枚举名称不能为空");
            return;
        }

        SysEnums ses = new SysEnums();

        for (int i = 0; i < 20; i++)
        {
            TextBox tb = this.UCSys1.GetTextBoxByID("TB_" + i);
            if (tb == null)
            {
                continue;
            }
            if (string.IsNullOrEmpty(tb.Text))
            {
                continue;
            }

            SysEnum se = new SysEnum();
            se.IntKey  = i;
            se.Lab     = tb.Text.Trim();
            se.Lang    = BP.Web.WebUser.SysLang;
            se.EnumKey = m.No;
            se.MyPK    = se.EnumKey + "_" + se.Lang + "_" + se.IntKey;
            ses.AddEntity(se);
        }

        if (ses.Count == 0)
        {
            this.Alert("枚举项目不能为空.");
            return;
        }

        string lab = "";

        foreach (SysEnum se in ses)
        {
            se.Save();
            lab += "@" + se.IntKey + "=" + se.Lab;
        }

        m.Lang   = BP.Web.WebUser.SysLang;
        m.CfgVal = lab;
        m.Insert();
        this.Response.Redirect("EnumList.aspx?RefNo=" + m.No + "&T=" + DateTime.Now.ToString("yyyyMMddHHmmssfff"), true);
    }
Example #19
0
        public ActionResult Create(ResearchPlanInfo info)
        {
            #region 计划对象ResearchPlanInfo
            info.Name = string.Format("{0}听评{1}", CurrentUser.Name, SysEnum.GetName(typeof(SysEnum.ResearchArea), info.AreaID));
            if (string.IsNullOrEmpty(info.Memo))
            {
                info.Memo = string.Empty;
            }
            if (info.DateBegin.Date < DateTime.Now.Date)
            {
                return(Json(new APIJson("日期有误")));
            }
            if (info.TemplateID <= 0)
            {
                return(Json(new APIJson("请选择评价模板")));
            }
            info.CategoryID   = PlanCategoryPersonalID;
            info.Address      = string.Empty;
            info.DateEnd      = info.DateBegin;
            info.TypeEnum     = (int)SysEnum.ResearchPlanType.个人听课;
            info.CreateUserID = CurrentUser.ID;
            info.CreateDate   = DateTime.Now;
            info.Status       = (int)SysEnum.ResearchPlanStatus.进行中;

            info.SummaryDetail   = string.Empty;
            info.SummaryUserName = string.Empty;
            #endregion

            #region 听评课对象ResearchInfo
            var infoResearch = new ResearchInfo();
            infoResearch.UserID            = CurrentUser.ID;
            infoResearch.SubjectID         = Function.GetRequestInt("SubjectID");
            infoResearch.lectureUserID     = Function.GetRequestInt("lectureUserID", 0);
            infoResearch.Topic             = Function.GetRequestString("Topic");
            infoResearch.LessionNumber     = Function.GetRequestInt("LessionNumber");
            infoResearch.ClassName         = Function.GetRequestString("ClassName");
            infoResearch.GradeName         = Function.GetRequestString("GradeName");
            infoResearch.SubjectiveOpinion = string.Empty;
            infoResearch.NoteMemo          = string.Empty;
            infoResearch.Status            = (int)SysEnum.ResearchStatus.未评;
            infoResearch.ScoreTotal        = 0;
            infoResearch.ScoreLever        = (int)SysEnum.ResearchScoreLever.合格;
            infoResearch.CreateDate        = DateTime.Now;
            var infoExist = ResearchBLL.GetList(a =>
                                                DbFunctions.DiffDays(a.CreateDate, infoResearch.CreateDate) == 0 &&
                                                a.ResearchPlanID == infoResearch.ResearchPlanID &&
                                                a.UserID == CurrentUser.ID &&
                                                a.ClassName == infoResearch.ClassName &&
                                                a.GradeName == infoResearch.GradeName &&
                                                a.LessionNumber == infoResearch.LessionNumber
                                                ).FirstOrDefault();
            if (null != infoExist)
            {
                return(Json(new APIJson(2, "您还在听评当前课程,将直接进入", new { PlanID = infoExist.ResearchPlanID, ResearchID = infoExist.ID })));
            }
            //infoResearch.ResearchPlanID
            //infoResearch.SubjectID
            if (string.IsNullOrEmpty(infoResearch.Topic))
            {
                return(Json(new APIJson(-1, "请填写课题")));
            }
            if (string.IsNullOrEmpty(infoResearch.ClassName))
            {
                return(Json(new APIJson(-1, "请填写年级")));
            }
            if (string.IsNullOrEmpty(infoResearch.GradeName))
            {
                return(Json(new APIJson(-1, "请填写班级")));
            }
            if (infoResearch.SubjectID <= 0)
            {
                return(Json(new APIJson(-1, "请选择学科")));
            }
            SubjectInfo infoSubject = SubjectBLL.GetList(a => a.ID == infoResearch.SubjectID).FirstOrDefault();
            if (null == infoSubject)
            {
                return(Json(new APIJson(-1, "请选择学科")));
            }
            infoResearch.SubjectInfo       = infoSubject;
            infoResearch.SubjectiveOpinion = string.Empty;
            infoResearch.NoteMemo          = string.Empty;
            infoResearch.Status            = (int)SysEnum.ResearchStatus.未评;
            infoResearch.ScoreTotal        = 0;
            infoResearch.ScoreLever        = (int)SysEnum.ResearchScoreLever.合格;

            infoResearch.ResearchPlanInfo = info;
            info.ResearchInfo.Add(infoResearch);
            #endregion


            if (!CreatePConfirmDepartmentID(info))
            {
                return(Json(new APIJson(-1, "请认真输放学校信息,对于系统未录入的学校,请务必认真输入全名")));
            }
            if (!CreatePConfirmlectureUserID(infoResearch))
            {
                return(Json(new APIJson(-1, "请认真输放听课对象,对于系统未录入的老师,请务必认真填写其姓名")));
            }
            if (ResearchPlanBLL.Create(info).ID > 0)
            {
                return(Json(new APIJson(0, "提交成功", new { PlanID = info.ID, ResearchID = infoResearch.ID })));
            }
            return(Json(new APIJson(-1, "提交失败,请重试")));
        }
        private static void WorkProcessor()
        {
            Random   rnd         = new Random();
            bool     isPassNight = false;             //是否已到深夜0点
            DateTime startTime   = DateTime.MinValue; //开始时间
            DateTime endTime     = DateTime.MinValue; //结束时间

            try
            {
                TyUser  bll   = new TyUser();
                SysEnum seBll = new SysEnum();

                while (true)
                {
                    if (!isPassNight)
                    {
                        if (DateTime.Now.Hour == 0)
                        {
                            isPassNight = true;
                        }
                    }

                    List <SysEnumInfo> seList     = seBll.GetList("and t2.EnumCode = 'UserProcessor'");
                    double             runTimeout = 0;
                    double.TryParse(seList.Find(m => m.EnumCode == "RunTimeout").EnumValue.Trim(), out runTimeout);
                    bool isOff = seList.Find(m => m.EnumCode == "On/Off").EnumValue.Trim().ToLower() == "off" ? true : false;
                    if (isOff)
                    {
                        Thread.Sleep(5000);
                        continue;
                    }

                    string sStartTime = seList.Find(m => m.EnumCode.Trim() == "StartTime").EnumValue;
                    string sEndTime   = seList.Find(m => m.EnumCode.Trim() == "EndTime").EnumValue;

                    if ((sStartTime.IndexOf(':') != -1) && (sEndTime.IndexOf(':') != -1))
                    {
                        DateTime currTime = DateTime.Now;
                        sStartTime = string.Format("{0} {1}", currTime.ToString("yyyy-MM-dd"), sStartTime);
                        sEndTime   = string.Format("{0} {1}", currTime.ToString("yyyy-MM-dd"), sEndTime);

                        DateTime.TryParse(sStartTime, out startTime);
                        DateTime.TryParse(sEndTime, out endTime);
                        DateTime maxTime = DateTime.Parse(string.Format("{0} {1}", currTime.ToString("yyyy-MM-dd"), "23:59:59"));

                        if ((startTime != DateTime.MinValue) && (endTime != DateTime.MinValue))
                        {
                            if (currTime >= endTime || currTime <= startTime)
                            {
                                Thread.Sleep(5000);
                                continue;
                            }
                        }
                    }

                    #region  步用户表开始

                    TyUser tyuserBll = new TyUser();

                    List <string>     newUsers = new List <string>();
                    string[]          oldUsers = tyuserBll.GetTyUsers();
                    List <TyUserInfo> userList = tyuserBll.GetList();

                    foreach (string userName in oldUsers)
                    {
                        if (!userList.Exists(m => m.UserName == userName))
                        {
                            newUsers.Add(userName);
                        }
                    }

                    if (newUsers.Count > 0)
                    {
                        using (TransactionScope scope = new TransactionScope())
                        {
                            foreach (string userName in newUsers)
                            {
                                string psw = (rnd.NextDouble() * Int32.MaxValue).ToString().PadLeft(6, '0').Substring(0, 6);
                                Membership.CreateUser(userName, psw, "" + userName + "@tygaweb.com");
                                Roles.AddUserToRole(userName, "Users");
                                tyuserBll.Insert(new TyUserInfo {
                                    UserName = userName, Password = psw, IsEnable = true, LastUpdatedDate = DateTime.Now
                                });
                            }

                            scope.Complete();
                        }
                    }

                    #endregion

                    if (runTimeout > 0)
                    {
                        TimeSpan ts = DateTime.Now.AddMinutes(runTimeout) - DateTime.Now;
                        Thread.Sleep(ts);
                    }
                    else
                    {
                        Thread.Sleep(5000);
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLog log = new WriteLog();
                log.Write(ex.Message);
            }
        }
        /// <summary>
        /// 批量提交PDA扫描数据
        /// </summary>
        /// <param name="dt">应包含opType、barCode、scanTime、userName等列</param>
        /// <returns>返回:包含“成功”,则调用成功,否则返回调用失败原因</returns>
        public string InsertByBatch(DataTable dt)
        {
            if (dt == null || dt.Rows.Count == 0)
            {
                return("无任何可保存的数据");
            }

            string[] colNames = { "opType", "barCode", "scanTime", "userName" };

            DataColumnCollection cols = dt.Columns;

            foreach (DataColumn col in cols)
            {
                if (!colNames.Contains(col.ColumnName))
                {
                    return("检测到提交的数据集中未包含" + col.ColumnName + "列");
                }
            }

            DataRowCollection rows = dt.Rows;

            List <PDAOrderScanDetailInfo> osdList = new List <PDAOrderScanDetailInfo>();

            //定义非重复的用户名、用户ID
            Dictionary <string, object> dicUser = new Dictionary <string, object>();

            try
            {
                SysEnum seBll  = new SysEnum();
                var     seList = seBll.GetList("and t2.EnumCode = 'SendReceiveType'", null);
                if (seList == null || seList.Count == 0)
                {
                    return("服务端的操作类型未设定,请先完成设定");
                }
                var firstModel = seList.OrderBy(m => m.Sort).First();

                foreach (DataRow row in rows)
                {
                    string opType = "";
                    if (row["opType"] != DBNull.Value)
                    {
                        opType = row["opType"].ToString();
                    }
                    else
                    {
                        return("操作类型不能为空");
                    }

                    var seModel = seList.Find(m => m.EnumValue.Trim() == opType.Trim());
                    if (seModel == null)
                    {
                        return("不存在操作类型:" + opType);
                    }

                    string barCode = "";
                    if (row["barCode"] != DBNull.Value)
                    {
                        barCode = row["barCode"].ToString();
                    }
                    DateTime scanTime = DateTime.MinValue;
                    if (row["scanTime"] != DBNull.Value)
                    {
                        DateTime.TryParse(row["scanTime"].ToString(), out scanTime);
                    }
                    if (scanTime == DateTime.MinValue)
                    {
                        return("数据集中包含不合法数据:scanTime值格式不正确");
                    }

                    string userName = "";
                    if (row["userName"] != DBNull.Value)
                    {
                        userName = row["userName"].ToString();
                    }
                    if (string.IsNullOrEmpty(userName))
                    {
                        return("数据集中包含用户名为空");
                    }

                    if (!dicUser.ContainsKey(userName))
                    {
                        dicUser.Add(userName, Guid.Empty);
                    }

                    osdList.Add(new PDAOrderScanDetailInfo {
                        OrderCode = barCode, CurrNodeId = seModel.Id, ScanTime = scanTime, Remark = seModel.Remark, Sort = seModel.Sort, LastUpdatedDate = DateTime.Now, UserName = userName, SysEnumValue = opType
                    });
                }

                TyUser tyuBll = new TyUser();

                foreach (KeyValuePair <string, object> kvp in dicUser)
                {
                    MembershipUser user = Membership.GetUser(kvp.Key, false);
                    if (user == null)
                    {
                        return("不存在用户:" + kvp.Key);
                    }

                    TyUserInfo tyuModel = tyuBll.GetModelByUser(user.UserName);

                    var currList = osdList.FindAll(m => m.UserName == kvp.Key);
                    foreach (var item in currList)
                    {
                        item.UserId = user.ProviderUserKey;

                        string sRemark = "";
                        if (tyuModel != null && !string.IsNullOrWhiteSpace(tyuModel.OrganizationName))
                        {
                            sRemark = string.Format(item.Remark, tyuModel.OrganizationName);
                        }
                        else
                        {
                            sRemark = item.Remark.Replace(@"{0}", "");
                        }
                        sRemark = item.SysEnumValue + ":" + sRemark;

                        item.Remark = sRemark;
                    }
                }

                PDAOrderScan       osBll  = new PDAOrderScan();
                PDAOrderScanDetail osdBll = new PDAOrderScanDetail();
                Order   oBll   = new Order();
                SmsSend smsBll = new SmsSend();

                var q = osdList.OrderBy(m => m.Sort);
                foreach (var item in q)
                {
                    object nextNodeId  = Guid.Empty;
                    var    currSeModel = seList.Find(m => m.EnumValue.Trim() == item.SysEnumValue);
                    var    nextSeModel = seList.FindAll(m => m.Sort > item.Sort).OrderBy(m => m.Sort).FirstOrDefault();
                    if (nextSeModel == null)
                    {
                        nextNodeId = item.CurrNodeId;
                    }
                    else
                    {
                        nextNodeId = nextSeModel.Id;
                    }
                    var  lastSeModel = seList.OrderByDescending(m => m.Sort).First();
                    bool isFinish    = lastSeModel.EnumValue.Trim() == item.SysEnumValue;

                    bool isOsdExists = false;

                    PDAOrderScanInfo currOsModel = new PDAOrderScanInfo();
                    currOsModel.OrderCode       = item.OrderCode;
                    currOsModel.CurrNodeId      = item.CurrNodeId;
                    currOsModel.NextNodeId      = nextNodeId;
                    currOsModel.IsFinish        = isFinish;
                    currOsModel.LastUpdatedDate = DateTime.Now;

                    PDAOrderScanDetailInfo currOsdModel = new PDAOrderScanDetailInfo();
                    currOsdModel.OrderCode       = item.OrderCode;
                    currOsdModel.CurrNodeId      = item.CurrNodeId;
                    currOsdModel.ScanTime        = item.ScanTime;
                    currOsdModel.UserId          = item.UserId;
                    currOsdModel.LastUpdatedDate = currOsModel.LastUpdatedDate;
                    currOsdModel.Remark          = item.Remark;

                    if (item.SysEnumValue == "干线发运" || item.SysEnumValue == "干线到达")
                    {
                        var orders = oBll.GetOrderByCarcode(item.OrderCode);
                        if (orders == null || orders.Count() == 0)
                        {
                            return("操作类型:" + item.SysEnumValue + "找不到订单号,有错误");
                        }

                        foreach (var currOrderCode in orders)
                        {
                            currOsModel.OrderCode  = currOrderCode;
                            currOsdModel.OrderCode = currOrderCode;

                            var oldOsdList = osdBll.GetList(currOrderCode);
                            if (oldOsdList != null)
                            {
                                isOsdExists = oldOsdList.Exists(m => m.CurrNodeId.Equals(item.CurrNodeId));
                            }

                            if (!isOsdExists)
                            {
                                SmsSendInfo ssiModel = new SmsSendInfo();
                                ssiModel.OrderCode    = currOrderCode;
                                ssiModel.TranNode     = currSeModel.EnumCode;
                                ssiModel.TranNodeText = currSeModel.EnumValue;

                                using (TransactionScope scope = new TransactionScope())
                                {
                                    if (osBll.GetModel(currOrderCode) == null)
                                    {
                                        osBll.Insert(currOsModel);
                                    }
                                    else
                                    {
                                        osBll.Update(currOsModel);
                                    }

                                    osdBll.Insert(currOsdModel);

                                    scope.Complete();
                                }

                                smsBll.InsertByStrategy(ssiModel);
                            }
                        }
                    }
                    else if (item.Sort == firstModel.Sort)
                    {
                        var oldOsModel = osBll.GetModel(item.OrderCode);
                        if (oldOsModel == null)
                        {
                            SmsSendInfo ssiModel = new SmsSendInfo();
                            ssiModel.OrderCode    = item.OrderCode;
                            ssiModel.TranNode     = currSeModel.EnumCode;
                            ssiModel.TranNodeText = currSeModel.EnumValue;

                            using (TransactionScope scope = new TransactionScope())
                            {
                                osBll.Insert(currOsModel);
                                osdBll.Insert(currOsdModel);

                                scope.Complete();
                            }

                            smsBll.InsertByStrategy(ssiModel);
                        }
                    }
                    else
                    {
                        var oldOsModel = osBll.GetModel(item.OrderCode);
                        if (oldOsModel == null)
                        {
                            return("订单号:" + item.OrderCode + ",操作类型:" + item.SysEnumValue + "未取货,有错误");
                        }

                        var oldOsdList = osdBll.GetList(item.OrderCode);
                        if (oldOsdList != null)
                        {
                            isOsdExists = oldOsdList.Exists(m => m.CurrNodeId.Equals(item.CurrNodeId));

                            currOsModel.IsFinish = oldOsdList.Count == 5;
                        }

                        if (currOsModel.IsFinish)
                        {
                            continue;
                        }

                        if (!isOsdExists)
                        {
                            SmsSendInfo ssiModel = new SmsSendInfo();
                            ssiModel.OrderCode    = currOsModel.OrderCode;
                            ssiModel.TranNode     = currSeModel.EnumCode;
                            ssiModel.TranNodeText = currSeModel.EnumValue;

                            using (TransactionScope scope = new TransactionScope())
                            {
                                osBll.Update(currOsModel);

                                osdBll.Insert(currOsdModel);

                                scope.Complete();
                            }

                            smsBll.InsertByStrategy(ssiModel);
                        }
                    }

                    Console.WriteLine("request: opType:{0},barCode:{1},scanTime:{3},user:{2}", item.SysEnumValue, item.OrderCode, item.ScanTime, item.UserName);
                }

                return("保存成功");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
        /// <summary>
        /// 新增PDA扫描数据
        /// </summary>
        /// <param name="opType">操作类型</param>
        /// <param name="barCode">单号条码</param>
        /// <param name="scanTime">扫描时间</param>
        /// <param name="userName">用户名</param>
        /// <returns>返回:包含“成功”,则调用成功,否则返回调用失败原因</returns>
        public string Insert(string opType, string barCode, DateTime scanTime, string userName)
        {
            #region 参数合法性检查

            if (string.IsNullOrEmpty(opType))
            {
                return("操作类型不能为空");
            }
            opType = opType.Trim();
            if (string.IsNullOrEmpty(barCode))
            {
                return("单号条码不能为空");
            }
            barCode = barCode.Trim();
            //if (barCode.Length != 13)
            //{
            //    return "单号条码不正确";
            //}

            if (scanTime == DateTime.MinValue)
            {
                return("扫描时间格式不正确");
            }

            if (string.IsNullOrEmpty(userName))
            {
                return("用户不能为空");
            }

            #endregion

            try
            {
                MembershipUser user = Membership.GetUser(userName);
                if (user == null)
                {
                    return("不存在用户:" + userName);
                }

                SysEnum seBll  = new SysEnum();
                var     seList = seBll.GetList("and t2.EnumCode = 'SendReceiveType'", null);
                if (seList == null || seList.Count == 0)
                {
                    return("服务端的操作类型未设定,请先完成设定");
                }

                var firstModel  = seList.OrderBy(m => m.Sort).First();
                var currSeModel = seList.Find(m => m.EnumValue.Trim() == opType);
                if (currSeModel == null)
                {
                    return("当前操作类型“" + opType + "”不存在");
                }

                object nextNodeId  = Guid.Empty;
                var    nextSeModel = seList.FindAll(m => m.Sort > currSeModel.Sort).OrderBy(m => m.Sort).FirstOrDefault();
                if (nextSeModel == null)
                {
                    nextNodeId = currSeModel.Id;
                }
                else
                {
                    nextNodeId = nextSeModel.Id;
                }

                bool isOsdExists = false;

                PDAOrderScanInfo currOsModel = new PDAOrderScanInfo();
                currOsModel.OrderCode       = barCode;
                currOsModel.CurrNodeId      = currSeModel.Id;
                currOsModel.NextNodeId      = nextNodeId;
                currOsModel.IsFinish        = false;
                currOsModel.LastUpdatedDate = DateTime.Now;

                PDAOrderScanDetailInfo currOsdModel = new PDAOrderScanDetailInfo();
                currOsdModel.OrderCode       = barCode;
                currOsdModel.CurrNodeId      = currOsModel.CurrNodeId;
                currOsdModel.ScanTime        = scanTime;
                currOsdModel.UserId          = user.ProviderUserKey;
                currOsdModel.LastUpdatedDate = currOsModel.LastUpdatedDate;

                Order              oBll   = new Order();
                PDAOrderScan       osBll  = new PDAOrderScan();
                PDAOrderScanDetail osdBll = new PDAOrderScanDetail();
                TyUser             tyuBll = new TyUser();
                SmsSend            smsBll = new SmsSend();

                string     sRemark  = "";
                TyUserInfo tyuModel = tyuBll.GetModelByUser(user.UserName);
                if (tyuModel != null && !string.IsNullOrWhiteSpace(tyuModel.OrganizationName))
                {
                    sRemark = string.Format(currSeModel.Remark, tyuModel.OrganizationName);
                }
                else
                {
                    sRemark = currSeModel.Remark.Replace(@"{0}", "");
                }
                sRemark = currSeModel.EnumValue + ":" + sRemark;

                currOsdModel.Remark = sRemark;

                if (opType == "干线发运" || opType == "干线到达")
                {
                    var orders = oBll.GetOrderByCarcode(barCode);
                    if (orders == null || orders.Count() == 0)
                    {
                        return("操作类型:" + barCode + "找不到订单号,有错误");
                    }

                    foreach (var currOrderCode in orders)
                    {
                        currOsModel.OrderCode  = currOrderCode;
                        currOsdModel.OrderCode = currOrderCode;

                        var oldOsdList = osdBll.GetList(currOrderCode);
                        if (oldOsdList != null)
                        {
                            isOsdExists = oldOsdList.Exists(m => m.CurrNodeId.Equals(currSeModel.Id));
                        }

                        if (isOsdExists)
                        {
                            return("订单号:" + currOrderCode + " 操作类型:" + opType + "已存在,不能重复提交");
                        }

                        //发短信
                        SmsSendInfo ssiModel = new SmsSendInfo();
                        ssiModel.OrderCode    = currOrderCode;
                        ssiModel.TranNode     = currSeModel.EnumCode;
                        ssiModel.TranNodeText = currSeModel.EnumValue;

                        using (TransactionScope scope = new TransactionScope())
                        {
                            if (osBll.GetModel(currOrderCode) == null)
                            {
                                osBll.Insert(currOsModel);
                            }
                            else
                            {
                                osBll.Update(currOsModel);
                            }

                            osdBll.Insert(currOsdModel);

                            scope.Complete();
                        }

                        smsBll.InsertByStrategy(ssiModel);
                    }
                }

                else if (currSeModel.Sort == firstModel.Sort)
                {
                    var oldOsModel = osBll.GetModel(barCode);
                    if (oldOsModel != null)
                    {
                        return("订单号:" + barCode + ",操作类型:" + opType + "已存在,不能重复提交");
                    }

                    SmsSendInfo ssiModel = new SmsSendInfo();
                    ssiModel.OrderCode    = barCode;
                    ssiModel.TranNode     = currSeModel.EnumCode;
                    ssiModel.TranNodeText = currSeModel.EnumValue;

                    using (TransactionScope scope = new TransactionScope())
                    {
                        osBll.Insert(currOsModel);
                        osdBll.Insert(currOsdModel);

                        scope.Complete();
                    }

                    smsBll.InsertByStrategy(ssiModel);
                }
                else
                {
                    var oldOsModel = osBll.GetModel(barCode);
                    if (oldOsModel == null)
                    {
                        return("订单号:" + barCode + ",操作类型:" + opType + "未取货,有错误");
                    }

                    var oldOsdList = osdBll.GetList(barCode);
                    if (oldOsdList != null)
                    {
                        isOsdExists = oldOsdList.Exists(m => m.CurrNodeId.Equals(currSeModel.Id));

                        currOsModel.IsFinish = oldOsdList.Count == 5;
                    }

                    if (currOsModel.IsFinish)
                    {
                        return("订单号:" + barCode + "已完成所有操作");
                    }

                    if (isOsdExists)
                    {
                        return("订单号:" + barCode + ",操作类型:" + opType + "已存在,不能重复提交");
                    }

                    SmsSendInfo ssiModel = new SmsSendInfo();
                    ssiModel.OrderCode    = barCode;
                    ssiModel.TranNode     = currSeModel.EnumCode;
                    ssiModel.TranNodeText = currSeModel.EnumValue;

                    using (TransactionScope scope = new TransactionScope())
                    {
                        osBll.Update(currOsModel);

                        osdBll.Insert(currOsdModel);

                        scope.Complete();
                    }

                    smsBll.InsertByStrategy(ssiModel);
                }

                Console.WriteLine("request: opType:{0},barCode:{1},scanTime:{3},user:{2}", opType, barCode, scanTime, userName);

                return("保存成功");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Example #23
0
        public string GetJsonForSysEnum()
        {
            SysEnum bll = new SysEnum();

            return(bll.GetTreeJson());
        }
Example #24
0
        public void BindStep1()
        {
            this.Pub1.AddTable();
            this.Pub1.AddCaption("表单创建向导:填写表单基础信息");

            SysEnum se = new SysEnum(MapDataAttr.FrmType, this.FrmType);

            this.Pub1.AddTR();
            this.Pub1.AddTD("表单类型");
            this.Pub1.AddTD(se.Lab);
            this.Pub1.AddTD("返回上一步可以更改");
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTD("数据源");
            BP.Sys.SFDBSrc srcs = new SFDBSrc(this.DBSrc);
            this.Pub1.AddTD(srcs.Name);
            this.Pub1.AddTD("您可以把表单创建不同的数据源上.");
            this.Pub1.AddTREnd();


            this.Pub1.AddTR();
            this.Pub1.AddTD("创建路径");
            //更改绑定样式 qin
            //BP.Sys.SysFormTrees trees = new SysFormTrees();

            //去除对应数据源根目录
            //trees.Retrieve(SysFormTreeAttr.DBSrc, this.DBSrc, SysFormTreeAttr.IsDir, "0");
            DataTable dt = DBAccess.RunSQLReturnTable("SELECT No,Name,ParentNo FROM Sys_FormTree WHERE DBSrc='local' AND IsDir='0'");

            BP.Web.Controls.DDL ddl = new BP.Web.Controls.DDL();
            ddl.ID = "DDL_FrmTree";
            BP.Web.Controls.DDL.MakeTree(dt, "ParentNo", "0", "No", "Name", ddl, -1);
            //ddl.Bind(trees, this.DBSrc);
            this.Pub1.AddTD(ddl);
            this.Pub1.AddTD("表单类别.");
            this.Pub1.AddTREnd();


            this.Pub1.AddTR();
            this.Pub1.AddTD("<font color='Red'>*</font>表单名称");
            TextBox tb = new TextBox();

            tb.ID           = "TB_Name";
            tb.Columns      = 90;
            tb.AutoPostBack = true;
            tb.TextChanged += new EventHandler(tb_TextChanged);
            this.Pub1.AddTD(tb);
            this.Pub1.AddTD("1到30个字符");
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTD("<font color='Red'>*</font>表单编号");
            tb         = new TextBox();
            tb.ID      = "TB_No";
            tb.Columns = 90;
            this.Pub1.AddTD(tb);
            this.Pub1.AddTD("以字母或者下划线开头,不能包含中文或者其他特殊字符.");
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTD("<font color='Red'>*</font>数据表");
            tb         = new TextBox();
            tb.ID      = "TB_PTable";
            tb.Columns = 90;

            this.Pub1.AddTD(tb);
            this.Pub1.AddTD("只能以字母或者下划线开头,不能包含中文与其它特殊字符。");
            this.Pub1.AddTREnd();

            #region 快速填写.
            this.Pub1.AddTR();
            this.Pub1.AddTD("快速填写");
            this.Pub1.AddTDBegin();
            RadioButton rb = new RadioButton();
            rb.ID              = "RB0";
            rb.Text            = "生成全拼名称";
            rb.CheckedChanged += new EventHandler(tb_TextChanged);
            rb.Checked         = true;
            rb.AutoPostBack    = true;
            rb.GroupName       = "ss";
            this.Pub1.Add(rb);

            rb                 = new RadioButton();
            rb.ID              = "RB1";
            rb.Text            = "生成简拼名称";
            rb.CheckedChanged += new EventHandler(tb_TextChanged);
            rb.GroupName       = "ss";
            rb.AutoPostBack    = true;
            this.Pub1.Add(rb);
            this.Pub1.AddTDEnd();
            this.Pub1.AddTD("注意:允许多个表单指定同一个表.");
            this.Pub1.AddTREnd();
            #endregion 快速填写.

            #region 表单生成方式.
            this.Pub1.AddTR();
            if ((BP.Sys.FrmType)(this.FrmType) != BP.Sys.FrmType.Url)
            {
                if ((BP.Sys.FrmType)(this.FrmType) == BP.Sys.FrmType.FreeFrm ||
                    (BP.Sys.FrmType)(this.FrmType) == BP.Sys.FrmType.Column4Frm ||
                    (BP.Sys.FrmType)(this.FrmType) == BP.Sys.FrmType.SLFrm)
                {
                    this.Pub1.AddTD("表单生成方式");
                    this.Pub1.AddTDBegin("colspan=2");
                    rb           = new RadioButton();
                    rb.ID        = "RB_FrmGenerMode_0";
                    rb.Text      = "直接生成表单";
                    rb.Checked   = true;
                    rb.GroupName = "s2s";
                    this.Pub1.Add(rb);
                    this.Pub1.AddBR();

                    rb           = new RadioButton();
                    rb.ID        = "RB_FrmGenerMode_1";
                    rb.Text      = "从ccfrom云表单库中选择一个表单模版导入";
                    rb.GroupName = "s2s";
                    this.Pub1.Add(rb);
                    this.Pub1.AddBR();

                    rb           = new RadioButton();
                    rb.ID        = "RB_FrmGenerMode_2";
                    rb.Text      = "从本机或其他数据库的的表导入表结构";
                    rb.GroupName = "s2s";
                    this.Pub1.Add(rb);
                    this.Pub1.AddBR();
                }
                //ExcelFrm,WordFrm 只保留上传
                if ((BP.Sys.FrmType)(this.FrmType) == BP.Sys.FrmType.ExcelFrm ||
                    (BP.Sys.FrmType)(this.FrmType) == BP.Sys.FrmType.WordFrm)
                {
                    this.Pub1.AddTD("<font color='Red'>*</font>上传" + se.Lab + "(默认模版)");
                    this.Pub1.AddTDBegin("colspan=2");

                    FileUpload fUp = new FileUpload();
                    fUp.ID    = "fUpFrm";
                    fUp.Width = 300;

                    this.Pub1.Add("&nbsp;&nbsp;&nbsp;");
                    this.Pub1.Add(fUp);
                }
                this.Pub1.AddTDEnd();
            }
            else
            {
                this.Pub1.AddTD("<font color='Red'>*</font>表单Url");
                this.Pub1.AddTDBegin("colspan=2");
                tb         = new TextBox();
                tb.ID      = "TB_Url";
                tb.Columns = 40;

                this.Pub1.Add(tb);
                this.Pub1.Add("&nbsp;&nbsp;&nbsp;请正确填写表单链接,支持全局变量@Ho");
                this.Pub1.AddTDEnd();
            }
            this.Pub1.AddTREnd();


            //  //ExcelFrm,WordFrm 只保留上传
            //if ((BP.Sys.FrmType)(this.FrmType) == BP.Sys.FrmType.ExcelFrm ||
            //    (BP.Sys.FrmType)(this.FrmType) == BP.Sys.FrmType.WordFrm)
            //{
            //    this.Pub1.AddTRend();
            //    this.Pub1.AddTREnd();
            //}

            #endregion 表单生成方式.

            #region 操作按钮放到table中,布局缩放不会乱
            this.Pub1.AddTR();
            this.Pub1.AddTDBegin(" colspan='3' ");

            Button btn = new Button();
            btn.ID     = "Btn_Save";
            btn.Text   = "下一步";
            btn.Click += new EventHandler(BindStep1_Click);
            this.Pub1.Add(btn);
            this.Pub1.Add("<input type='button' value='返回上一步' onclick='Back();' />");

            this.Pub1.AddTDEnd();
            this.Pub1.AddTREnd();
            #endregion

            this.Pub1.AddTableEnd();
        }
Example #25
0
        private string SetEntityAttrVal(string no, DataRow dr, Attrs attrs, Entity en, DataTable dt, int saveType)
        {
            string errInfo = "";

            //按照属性赋值.
            foreach (Attr item in attrs)
            {
                if (item.Key == "No")
                {
                    en.SetValByKey(item.Key, no);
                    continue;
                }
                if (item.Key == "Name")
                {
                    en.SetValByKey(item.Key, dr[item.Desc].ToString());
                    continue;
                }


                if (dt.Columns.Contains(item.Desc) == false)
                {
                    continue;
                }

                //枚举处理.
                if (item.MyFieldType == FieldType.Enum)
                {
                    string val = dr[item.Desc].ToString();

                    SysEnum se = new SysEnum();
                    int     i  = se.Retrieve(SysEnumAttr.EnumKey, item.UIBindKey, SysEnumAttr.Lab, val);

                    if (i == 0)
                    {
                        errInfo += "err@枚举[" + item.Key + "][" + item.Desc + "],值[" + val + "]不存在.";
                        continue;
                    }

                    en.SetValByKey(item.Key, se.IntKey);
                    continue;
                }

                //外键处理.
                if (item.MyFieldType == FieldType.FK)
                {
                    string val    = dr[item.Desc].ToString();
                    Entity attrEn = item.HisFKEn;
                    int    i      = attrEn.Retrieve("Name", val);
                    if (i == 0)
                    {
                        errInfo += "err@外键[" + item.Key + "][" + item.Desc + "],值[" + val + "]不存在.";
                        continue;
                    }

                    if (i != 1)
                    {
                        errInfo += "err@外键[" + item.Key + "][" + item.Desc + "],值[" + val + "]重复..";
                        continue;
                    }

                    //把编号值给他.
                    en.SetValByKey(item.Key, attrEn.GetValByKey("No"));
                    continue;
                }

                //boolen类型的处理..
                if (item.MyDataType == DataType.AppBoolean)
                {
                    string val = dr[item.Desc].ToString();
                    if (val == "是" || val == "有")
                    {
                        en.SetValByKey(item.Key, 1);
                    }
                    else
                    {
                        en.SetValByKey(item.Key, 0);
                    }
                    continue;
                }

                string myval = dr[item.Desc].ToString();
                en.SetValByKey(item.Key, myval);
            }

            try
            {
                if (en.IsNoEntity == true)
                {
                    if (saveType == 0)
                    {
                        en.Insert();
                    }
                    else
                    {
                        en.Update();
                    }
                }
            }
            catch (Exception ex)
            {
                return("err@" + ex.Message);
            }

            return(errInfo);
        }
Example #26
0
        public void BindCond()
        {
            string msg  = "";
            string note = "";

            Cond cond = new Cond();

            cond.MyPK = this.GenerMyPK;
            cond.RetrieveFromDBSources();

            if (BP.WF.Glo.OSModel == OSModel.WorkFlow)
            {
                SysEnums ses = new SysEnums("StaGrade");
                Stations sts = new Stations();
                sts.RetrieveAll();

                string    sql = "SELECT No,Name FROM Port_Station WHERE StaGrade  NOT IN (SELECT IntKey FROM Sys_Enum WHERE EnumKey='StaGrade')";
                DataTable dt  = DBAccess.RunSQLReturnTable(sql);
                if (dt.Rows.Count != 0)
                {
                    if (ses.Count == 0)
                    {
                        SysEnum se = new SysEnum();
                        se.EnumKey = "StaGrade";
                        se.Lab     = "普通岗";
                        se.IntKey  = 0;
                        se.Insert();

                        ses.AddEntity(se);
                    }

                    foreach (Station st in sts)
                    {
                        st.StaGrade = 0;
                        st.Save();
                    }

                    //Pub1.AddEasyUiPanelInfo("错误",
                    //                        "在ccflow的集成工作模式下,岗位表集成或者维护错误,有" + dt.Rows.Count +
                    //                        "个岗位枚举值对应不上:<br />{技术信息:排查的sql:" + sql + "}", "icon-no");
                    //return;
                }

                this.Pub1.AddTable("class='Table' cellSpacing='0' cellPadding='0'  border='0' style='width:100%'");

                foreach (SysEnum se in ses)
                {
                    this.Pub1.AddTR();
                    CheckBox mycb = new CheckBox();
                    mycb.Text = se.Lab;
                    mycb.ID   = "CB_s_d" + se.IntKey;
                    this.Pub1.AddTD("colspan=3 class='GroupTitle'", mycb);
                    this.Pub1.AddTREnd();

                    int    i      = 0;
                    string ctlIDs = "";

                    foreach (Station st in sts)
                    {
                        if (st.StaGrade != se.IntKey)
                        {
                            continue;
                        }

                        i++;

                        if (i == 4)
                        {
                            i = 1;
                        }

                        if (i == 1)
                        {
                            Pub1.AddTR();
                        }

                        CheckBox cb = new CheckBox();
                        cb.ID   = "CB_" + st.No;
                        ctlIDs += cb.ID + ",";
                        cb.Text = st.Name;
                        if (cond.OperatorValue.ToString().Contains("@" + st.No + "@"))
                        {
                            cb.Checked = true;
                        }

                        Pub1.AddTD(cb);

                        if (i == 3)
                        {
                            Pub1.AddTREnd();
                        }
                    }

                    mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";

                    switch (i)
                    {
                    case 1:
                        Pub1.AddTD();
                        Pub1.AddTD();
                        Pub1.AddTREnd();
                        break;

                    case 2:
                        Pub1.AddTD();
                        Pub1.AddTREnd();
                        break;

                    default:
                        break;
                    }
                }
            }
            else
            {
                /*BPM 模式*/
                BP.GPM.StationTypes tps = new BP.GPM.StationTypes();
                tps.RetrieveAll();

                BP.GPM.Stations sts = new BP.GPM.Stations();
                sts.RetrieveAll();

                string    sql = "SELECT No,Name FROM Port_Station WHERE FK_StationType NOT IN (SELECT No FROM Port_StationType)";
                DataTable dt  = DBAccess.RunSQLReturnTable(sql);
                if (dt.Rows.Count != 0)
                {
                    if (tps.Count == 0)
                    {
                        var stp = new BP.GPM.StationType {
                            No = "01", Name = "普通岗"
                        };
                        stp.Save();

                        tps.AddEntity(stp);
                    }

                    //更新所有对不上岗位类型的岗位,岗位类型为01或第一个
                    foreach (BP.GPM.Station st in sts)
                    {
                        st.FK_StationType = tps[0].No;
                        st.Update();
                    }

                    //Pub1.AddEasyUiPanelInfo("错误",
                    //                        "在ccflow的集成工作模式下,岗位表集成或者维护错误,有" + dt.Rows.Count +
                    //                        "个岗位外键对应不上:<br />{技术信息:排查的sql:" + sql + "}", "icon-no");
                    //return;
                }

                this.Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1'  border='1' style='width:100%'");
                foreach (BP.GPM.StationType tp in tps)
                {
                    this.Pub1.AddTR();
                    CheckBox mycb = new CheckBox();
                    mycb.Text = tp.Name;
                    mycb.ID   = "CB_s_d" + tp.No;
                    this.Pub1.AddTD("colspan=3 class='GroupTitle'", mycb);
                    this.Pub1.AddTREnd();

                    int    i      = 0;
                    string ctlIDs = "";

                    foreach (BP.GPM.Station st in sts)
                    {
                        if (st.FK_StationType != tp.No)
                        {
                            continue;
                        }

                        i++;

                        if (i == 4)
                        {
                            i = 1;
                        }

                        if (i == 1)
                        {
                            Pub1.AddTR();
                        }

                        CheckBox cb = new CheckBox();
                        cb.ID   = "CB_" + st.No;
                        ctlIDs += cb.ID + ",";
                        cb.Text = st.Name;
                        if (cond.OperatorValue.ToString().Contains("@" + st.No + "@"))
                        {
                            cb.Checked = true;
                        }

                        this.Pub1.AddTD(cb);

                        if (i == 3)
                        {
                            Pub1.AddTREnd();
                        }
                    }

                    mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";

                    switch (i)
                    {
                    case 1:
                        Pub1.AddTD();
                        Pub1.AddTD();
                        Pub1.AddTREnd();
                        break;

                    case 2:
                        Pub1.AddTD();
                        Pub1.AddTREnd();
                        break;

                    default:
                        break;
                    }
                }
            }

            this.Pub1.AddTableEnd();
            Pub1.AddBR();
            Pub1.AddSpace(1);

            var btn = new LinkBtn(false, NamesOfBtn.Save, "保存");

            btn.Click += new EventHandler(btn_Save_Click);
            this.Pub1.Add(btn);
            Pub1.AddSpace(1);

            btn = new LinkBtn(false, NamesOfBtn.Delete, "删除");
            btn.Attributes["onclick"] = " return confirm('您确定要删除吗?');";
            btn.Click += new EventHandler(btn_Save_Click);
            this.Pub1.Add(btn);
        }
Example #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PushMsgs msgs = new PushMsgs(this.FK_Flow);
            var      msg  = msgs.GetEntityByKey(PushMsgAttr.FK_Event, this.Event, PushMsgAttr.FK_Node, int.Parse(this.NodeID)) as PushMsg;

            if (msg == null)
            {
                msg          = new PushMsg();
                msg.FK_Event = this.Event;
                msg.FK_Node  = int.Parse(this.NodeID);
            }

            if (!string.IsNullOrWhiteSpace(this.ThePushWay))
            {
                if (this.ThePushWay != msg.PushWay.ToString())
                {
                    msg.PushDoc = string.Empty;
                    msg.Tag     = string.Empty;
                }

                msg.PushWay = int.Parse(this.ThePushWay);
            }

            this.Pub1.AddTable("class='Table' cellspacing='1' cellpadding='1' border='1' style='width:100%'");

            this.Pub1.AddTR();
            this.Pub1.AddTD("style='width:100px'", "推送设置方式:");
            var ddl = new DDL();

            ddl.BindSysEnum(PushMsgAttr.PushWay);
            ddl.ID = "DDL_" + PushMsgAttr.PushWay;
            ddl.SetSelectItem((int)msg.PushWay);
            ddl.AutoPostBack          = true;
            ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);
            this.Pub1.AddTD(ddl);
            this.Pub1.AddTREnd();

            switch ((PushWay)msg.PushWay)
            {
            case PushWay.ByParas:

                #region  照系统指定参数

                Pub1.AddTR();
                Pub1.AddTD("输入参数名:");
                Pub1.AddTDBegin();

                var rad = new RadioBtn();
                rad.GroupName = "Para";
                rad.ID        = "RB_0";
                rad.Text      = "系统参数";
                rad.Checked   = msg.PushDoc == "0";

                Pub1.Add(rad);

                var tb = new TB();
                tb.ID = "TB_" + PushMsgAttr.Tag;

                if (msg.PushDoc == "0")
                {
                    tb.Text = msg.Tag;
                }
                else
                {
                    tb.Text = "NoticeTo";
                }

                Pub1.Add(tb);

                Pub1.Add("&nbsp;默认为NoticeTo");
                Pub1.AddBR();

                rad           = new RadioBtn();
                rad.GroupName = "Para";
                rad.ID        = "RB_1";
                rad.Text      = "表单字段参数";
                rad.Checked   = msg.PushDoc == "1";

                Pub1.Add(rad);

                MapAttrs attrs = new MapAttrs();
                attrs.Retrieve(MapAttrAttr.FK_MapData, "ND" + this.NodeID);

                MapAttrs attrNs = new MapAttrs();

                foreach (MapAttr attr in attrs)
                {
                    if (attr.IsBigDoc)
                    {
                        continue;
                    }

                    switch (attr.KeyOfEn)
                    {
                    case "Title":
                    case "FK_Emp":
                    case "MyNum":
                    case "FK_NY":
                    case WorkAttr.Emps:
                    case WorkAttr.OID:
                    case StartWorkAttr.Rec:
                    case StartWorkAttr.FID:
                        continue;

                    default:
                        break;
                    }

                    attrNs.AddEntity(attr);
                }

                ddl    = new DDL();
                ddl.ID = "DDL_" + PushMsgAttr.Tag;
                ddl.BindEntities(attrNs, MapAttrAttr.MyPK, MapAttrAttr.Name);
                ddl.AutoPostBack = false;

                if (msg.PushDoc == "1")
                {
                    ddl.SetSelectItem(msg.Tag);
                }

                Pub1.Add(ddl);
                Pub1.AddTREnd();
                #endregion

                break;

            case PushWay.NodeWorker:

                #region  照指定结点的工作人员

                Pub1.AddTR();
                Pub1.AddTDBegin("colspan='2'");

                Pub1.Add("请选择要推送到的节点工作人员:<br />");
                Nodes    nds = new Nodes(this.FK_Flow);
                CheckBox cb  = null;

                foreach (BP.WF.Node nd in nds)
                {
                    if (nd.NodeID == int.Parse(this.NodeID))
                    {
                        continue;
                    }

                    cb         = new CheckBox();
                    cb.ID      = "CB_" + nd.NodeID;
                    cb.Text    = nd.NodeID + " &nbsp;" + nd.Name;
                    cb.Checked = msg.PushDoc.Contains("@" + nd.NodeID + "@");
                    Pub1.Add(cb);
                    Pub1.AddBR();
                }

                Pub1.AddTDEnd();
                Pub1.AddTREnd();
                #endregion

                break;

            case PushWay.SpecDepts:

                #region  照指定的部门

                Pub1.AddTR();
                Pub1.AddTDBegin("colspan='2'");

                this.Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1'  border='1' style='width:100%'");
                this.Pub1.AddTR();
                this.Pub1.AddTD("colspan='3' class='GroupTitle'", "部门选择");
                this.Pub1.AddTREnd();

                //NodeDepts ndepts = new NodeDepts(int.Parse(this.NodeID));
                Depts depts = new Depts();
                depts.RetrieveAll();
                int i = 0;

                //foreach (NodeDept dept in ndepts)
                foreach (Dept dept in depts)
                {
                    i++;

                    if (i == 4)
                    {
                        i = 1;
                    }

                    if (i == 1)
                    {
                        Pub1.AddTR();
                    }

                    cb = new CheckBox();
                    //cb.ID = "CB_" + dept.FK_Dept;
                    //cb.Text = (depts.GetEntityByKey(dept.FK_Dept) as Dept).Name;
                    cb.ID   = "CB_" + dept.No;
                    cb.Text = dept.Name;

                    //if (msg.PushDoc.Contains("@" + dept.FK_Dept + "@"))
                    if (msg.PushDoc.Contains("@" + dept.No + "@"))
                    {
                        cb.Checked = true;
                    }

                    this.Pub1.AddTD(cb);

                    if (i == 3)
                    {
                        Pub1.AddTREnd();
                    }
                }

                switch (i)
                {
                case 1:
                    Pub1.AddTD();
                    Pub1.AddTD();
                    Pub1.AddTREnd();
                    break;

                case 2:
                    Pub1.AddTD();
                    Pub1.AddTREnd();
                    break;

                default:
                    break;
                }

                this.Pub1.AddTableEnd();
                Pub1.AddTDEnd();
                Pub1.AddTREnd();
                #endregion

                break;

            case PushWay.SpecEmps:

                #region  照指定的人员

                Pub1.AddTR();
                //Pub1.AddTDBegin("colspan='2'");

                Pub1.AddTD("选择人员:");
                Pub1.AddTDBegin();

                tb          = new TB();
                tb.ID       = "TB_Users";
                tb.TextMode = TextBoxMode.MultiLine;
                tb.Style.Add("width", "99%");
                tb.Rows     = 4;
                tb.ReadOnly = true;

                var hf = new HiddenField();
                hf.ID = "HID_Users";

                //加载已经选择的人员
                if (!string.IsNullOrWhiteSpace(msg.PushDoc))
                {
                    hf.Value = msg.PushDoc.Replace("@@", ",").Trim('@');

                    var emps = new Emps();
                    emps.RetrieveAll();

                    tb.Text =
                        hf.Value.Split(',').Select(o => (emps.GetEntityByKey(o) as Emp).Name).Aggregate(
                            string.Empty, (curr, next) => curr + next + ",").TrimEnd(',');
                }

                Pub1.Add(tb);
                Pub1.Add(hf);
                Pub1.AddBR();
                Pub1.AddBR();

                Pub1.Add(
                    "<a class='easyui-linkbutton' data-options=\"iconCls:'icon-user'\" href='javascript:void(0)' onclick=\"showWin('../Comm/Port/SelectUser_Jq.aspx','" +
                    tb.ClientID + "','" + hf.ClientID + "');\">选择人员...</a>");
                Pub1.AddTDEnd();
                //Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1'  border='1' style='width:100%'");
                //depts = new Depts();
                //depts.RetrieveAll();
                //var emps = new Emps();
                //emps.RetrieveAll();
                //var empDepts = new EmpDepts();
                //empDepts.RetrieveAll();
                //var nemps = new NodeEmps(int.Parse(this.NodeID));

                //Emp emp = null;

                //foreach (Dept dept in depts)
                //{
                //    this.Pub1.AddTR();
                //    var mycb = new CheckBox();
                //    mycb.Text = dept.Name;
                //    mycb.ID = "CB_D_" + dept.No;
                //    this.Pub1.AddTD("colspan='3' class='GroupTitle'", mycb);
                //    this.Pub1.AddTREnd();

                //    i = 0;
                //    string ctlIDs = "";

                //    foreach (EmpDept ed in empDepts)
                //    {
                //        if (ed.FK_Dept != dept.No)
                //            continue;

                //        //排除非当前结点绑定的人员
                //        if (nemps.GetEntityByKey(NodeEmpAttr.FK_Emp, ed.FK_Emp) == null)
                //            continue;

                //        i++;

                //        if (i == 4)
                //            i = 1;

                //        if (i == 1)
                //            Pub1.AddTR();

                //        emp = emps.GetEntityByKey(ed.FK_Emp) as Emp;

                //        cb = new CheckBox();
                //        cb.ID = "CB_E_" + emp.No;
                //        ctlIDs += cb.ID + ",";
                //        cb.Text = emp.Name;
                //        if (msg.PushDoc.Contains("@" + emp.No + "@"))
                //            cb.Checked = true;

                //        Pub1.AddTD(cb);

                //        if (i == 3)
                //            Pub1.AddTREnd();
                //    }

                //    mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";

                //    switch (i)
                //    {
                //        case 1:
                //            Pub1.AddTD();
                //            Pub1.AddTD();
                //            Pub1.AddTREnd();
                //            break;
                //        case 2:
                //            Pub1.AddTD();
                //            Pub1.AddTREnd();
                //            break;
                //        default:
                //            break;
                //    }
                //}

                //Pub1.AddTableEnd();

                //Pub1.AddTDEnd();
                Pub1.AddTREnd();
                #endregion

                break;

            case PushWay.SpecSQL:

                #region  照指定的SQL查询语句

                Pub1.AddTR();

                this.Pub1.AddTDBegin("colspan='2'");
                this.Pub1.Add("SQL查询语句:<br />");
                tb         = new TB();
                tb.ID      = "TB_" + PushMsgAttr.PushDoc;
                tb.Columns = 50;
                tb.Style.Add("width", "99%");
                tb.TextMode = TextBoxMode.MultiLine;
                tb.Rows     = 4;
                tb.Text     = msg.PushDoc;
                this.Pub1.Add(tb);
                this.Pub1.AddTDEnd();
                Pub1.AddTREnd();
                #endregion

                break;

            case PushWay.SpecStations:

                #region  照指定的岗位

                Pub1.AddTR();
                Pub1.AddTDBegin("colspan='2'");

                if (BP.WF.Glo.OSModel == OSModel.WorkFlow)
                {
                    SysEnums ses = new SysEnums("StaGrade");
                    Stations sts = new Stations();
                    sts.RetrieveAll();

                    string    sql = "SELECT No,Name FROM Port_Station WHERE StaGrade  NOT IN (SELECT IntKey FROM Sys_Enum WHERE EnumKey='StaGrade')";
                    DataTable dt  = DBAccess.RunSQLReturnTable(sql);
                    if (dt.Rows.Count != 0)
                    {
                        if (ses.Count == 0)
                        {
                            SysEnum se = new SysEnum();
                            se.EnumKey = "StaGrade";
                            se.Lab     = "普通岗";
                            se.IntKey  = 0;
                            se.Insert();

                            ses.AddEntity(se);
                        }

                        foreach (Station st in sts)
                        {
                            st.StaGrade = 0;
                            st.Save();
                        }
                    }

                    this.Pub1.AddTable("class='Table' cellSpacing='0' cellPadding='0'  border='0' style='width:100%'");

                    foreach (SysEnum se in ses)
                    {
                        this.Pub1.AddTR();
                        CheckBox mycb = new CheckBox();
                        mycb.Text = se.Lab;
                        mycb.ID   = "CB_SG_" + se.IntKey;
                        this.Pub1.AddTD("colspan='3' class='GroupTitle'", mycb);
                        this.Pub1.AddTREnd();

                        i = 0;
                        string ctlIDs = "";

                        foreach (Station st in sts)
                        {
                            if (st.StaGrade != se.IntKey)
                            {
                                continue;
                            }

                            i++;

                            if (i == 4)
                            {
                                i = 1;
                            }

                            if (i == 1)
                            {
                                Pub1.AddTR();
                            }

                            cb      = new CheckBox();
                            cb.ID   = "CB_S_" + st.No;
                            ctlIDs += cb.ID + ",";
                            cb.Text = st.Name;

                            if (msg.PushDoc.Contains("@" + st.No + "@"))
                            {
                                cb.Checked = true;
                            }

                            Pub1.AddTD(cb);

                            if (i == 3)
                            {
                                Pub1.AddTREnd();
                            }
                        }

                        mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";

                        switch (i)
                        {
                        case 1:
                            Pub1.AddTD();
                            Pub1.AddTD();
                            Pub1.AddTREnd();
                            break;

                        case 2:
                            Pub1.AddTD();
                            Pub1.AddTREnd();
                            break;

                        default:
                            break;
                        }
                    }

                    this.Pub1.AddTableEnd();
                }
                else
                {
                    /*BPM 模式*/
                    BP.GPM.StationTypes tps = new BP.GPM.StationTypes();
                    tps.RetrieveAll();

                    BP.GPM.Stations sts = new BP.GPM.Stations();
                    sts.RetrieveAll();

                    string    sql = "SELECT No,Name FROM Port_Station WHERE FK_StationType NOT IN (SELECT No FROM Port_StationType)";
                    DataTable dt  = DBAccess.RunSQLReturnTable(sql);
                    if (dt.Rows.Count != 0)
                    {
                        if (tps.Count == 0)
                        {
                            var stp = new BP.GPM.StationType {
                                No = "01", Name = "普通岗"
                            };
                            stp.Save();

                            tps.AddEntity(stp);
                        }

                        //更新所有对不上岗位类型的岗位,岗位类型为01或第一个
                        foreach (BP.GPM.Station st in sts)
                        {
                            st.FK_StationType = tps[0].No;
                            st.Update();
                        }
                    }

                    this.Pub1.AddTable("class='Table' cellSpacing='0' cellPadding='0'  border='0' style='width:100%'");

                    foreach (BP.GPM.StationType tp in tps)
                    {
                        this.Pub1.AddTR();
                        CheckBox mycb = new CheckBox();
                        mycb.Text = tp.Name;
                        mycb.ID   = "CB_ST_" + tp.No;
                        this.Pub1.AddTD("colspan='3' class='GroupTitle'", mycb);
                        this.Pub1.AddTREnd();

                        i = 0;
                        string ctlIDs = "";

                        foreach (BP.GPM.Station st in sts)
                        {
                            if (st.FK_StationType != tp.No)
                            {
                                continue;
                            }

                            i++;

                            if (i == 4)
                            {
                                i = 1;
                            }

                            if (i == 1)
                            {
                                Pub1.AddTR();
                            }

                            cb      = new CheckBox();
                            cb.ID   = "CB_S_" + st.No;
                            ctlIDs += cb.ID + ",";
                            cb.Text = st.Name;

                            if (msg.PushDoc.Contains("@" + st.No + "@"))
                            {
                                cb.Checked = true;
                            }

                            this.Pub1.AddTD(cb);

                            if (i == 3)
                            {
                                Pub1.AddTREnd();
                            }
                        }

                        mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";

                        switch (i)
                        {
                        case 1:
                            Pub1.AddTD();
                            Pub1.AddTD();
                            Pub1.AddTREnd();
                            break;

                        case 2:
                            Pub1.AddTD();
                            Pub1.AddTREnd();
                            break;

                        default:
                            break;
                        }
                    }

                    this.Pub1.AddTableEnd();
                }

                #region 原逻辑,只考虑了一种模式,停用
                //Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1'  border='1' style='width:100%'");
                //SysEnums ses = new SysEnums("StaGrade");
                //Stations sts = new Stations();
                //NodeStations nsts = new NodeStations(int.Parse(this.NodeID));
                //sts.RetrieveAll();

                //foreach (SysEnum se in ses)
                //{
                //    this.Pub1.AddTR();
                //    var mycb = new CheckBox();
                //    mycb.Text = se.Lab;
                //    mycb.ID = "CB_SG_" + se.IntKey;
                //    this.Pub1.AddTD("colspan=3 class='GroupTitle'", mycb);
                //    this.Pub1.AddTREnd();

                //    i = 0;
                //    string ctlIDs = "";

                //    foreach (Station st in sts)
                //    {
                //        if (st.StaGrade != se.IntKey)
                //            continue;

                //        //排除非当前结点的岗位
                //        if (nsts.GetEntityByKey(NodeStationAttr.FK_Station, st.No) == null)
                //            continue;

                //        i++;

                //        if (i == 4)
                //            i = 1;

                //        if (i == 1)
                //            Pub1.AddTR();

                //        cb = new CheckBox();
                //        cb.ID = "CB_S_" + st.No;
                //        ctlIDs += cb.ID + ",";
                //        cb.Text = st.Name;
                //        if (msg.PushDoc.Contains("@" + st.No + "@"))
                //            cb.Checked = true;

                //        Pub1.AddTD(cb);

                //        if (i == 3)
                //            Pub1.AddTREnd();
                //    }

                //    mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";

                //    switch (i)
                //    {
                //        case 1:
                //            Pub1.AddTD();
                //            Pub1.AddTD();
                //            Pub1.AddTREnd();
                //            break;
                //        case 2:
                //            Pub1.AddTD();
                //            Pub1.AddTREnd();
                //            break;
                //        default:
                //            break;
                //    }
                //}
                //Pub1.AddTableEnd();
                #endregion

                Pub1.AddTDEnd();
                Pub1.AddTREnd();
                #endregion

                break;
            }

            Pub1.AddTableEnd();

            Pub1.AddBR();
            Pub1.AddSpace(1);

            var btn = new LinkBtn(false, NamesOfBtn.Save, "保存");
            btn.Click += new EventHandler(btn_Click);
            Pub1.Add(btn);

            if (!string.IsNullOrWhiteSpace(msg.MyPK))
            {
                Pub1.AddSpace(1);
                btn        = new LinkBtn(false, NamesOfBtn.Delete, "删除");
                btn.Click += new EventHandler(btn_Delete_Click);
                btn.Attributes["onclick"] = "return confirm('你确定要删除此消息推送设置吗?');";
                Pub1.Add(btn);
            }
        }
Example #28
0
        void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                SysEnumMain main = new SysEnumMain();
                if (this.RefNo == null)
                {
                    main.No = this.Pub1.GetTBByID("TB_No").Text;
                    if (main.IsExits)
                    {
                        //this.Alert("编号(枚举英文名称)[" + main.No + "]已经存在。");
                        this.Alert("编号(枚举英文名称)[" + main.No + "]已经存在。");
                        return;
                    }

                    SysEnum se = new SysEnum();
                    if (se.IsExit(SysEnumAttr.EnumKey, main.No) == true)
                    {
                        this.Alert("编号(枚举英文名称)[" + main.No + "]已经存在。");
                        return;
                    }

                    main = (SysEnumMain)this.Pub1.Copy(main);
                    if (main.No.Length == 0 || main.Name.Length == 0)
                    {
                        throw new Exception("编号与名称不能为空");
                    }
                }
                else
                {
                    main.No = this.RefNo;
                    main.Retrieve();
                    main = (SysEnumMain)this.Pub1.Copy(main);
                    if (main.No.Length == 0 || main.Name.Length == 0)
                    {
                        throw new Exception("编号与名称不能为空");
                    }
                }

                string cfgVal = "";
                int    idx    = -1;
                while (idx < 19)
                {
                    idx++;
                    string t = this.Pub1.GetTBByID("TB_" + idx).Text.Trim();
                    if (t.Length == 0)
                    {
                        continue;
                    }

                    cfgVal += "@" + idx + "=" + t;
                }

                main.CfgVal = cfgVal;
                if (main.CfgVal == "")
                {
                    throw new Exception("错误:您必须输入枚举值,请参考帮助。");  //错误:您必须输入枚举值,请参考帮助。
                }
                main.Save();

                //重新生成
                SysEnums se1s = new SysEnums();
                se1s.Delete(SysEnumAttr.EnumKey, main.No);
                SysEnums ses = new SysEnums();
                ses.RegIt(main.No, cfgVal);

                string keyApp = "EnumOf" + main.No + WebUser.SysLang;
                BP.DA.Cash.DelObjFormApplication(keyApp);

                if (this.MyPK != null)
                {
                    this.Response.Redirect("SysEnum.aspx?RefNo=" + main.No + "&MyPK=" + this.MyPK + "&IDX=" + this.IDX, true);
                }
                return;
            }
            catch (Exception ex)
            {
                this.ResponseWriteBlueMsg(ex.Message);
                //this.ToErrorPage(ex.Message);
                //this.Alert(ex.Message);
            }
        }
Example #29
0
        public void BindSysEnum(SysEnumMain en)
        {
            SysEnums ses = new SysEnums();

            if (en.No.Length > 0)
            {
                //ses = new SysEnums(en.No);
                ses.Retrieve(SysEnumAttr.EnumKey, en.No);
            }

            this.Pub1.AddTable();
            if (this.RefNo == null)
            {
                this.Pub1.AddCaptionLeft("<a href='Do.aspx?DoType=AddF&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'>增加新字段向导</a> - <a href='Do.aspx?DoType=AddSysEnum&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'>枚举字段</a> - 新建");
            }
            else
            {
                this.Pub1.AddCaptionLeft("<a href='Do.aspx?DoType=AddF&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'>增加新字段向导</a> - <a href='Do.aspx?DoType=AddSysEnum&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'>枚举字段</a> - 编辑");
            }

            if (this.RefNo == null)
            {
                this.Title = "新建枚举";
            }
            else
            {
                this.Title = "编辑枚举类型";
            }


            this.Pub1.AddTR();
            this.Pub1.AddTDTitle("&nbsp;");
            this.Pub1.AddTDTitle("&nbsp;");
            this.Pub1.AddTDTitle("备注");
            this.Pub1.AddTREnd();

            this.Pub1.AddTRSum();
            this.Pub1.AddTD("编号");
            BP.Web.Controls.TB tb = new BP.Web.Controls.TB();
            tb.ID   = "TB_No";
            tb.Text = en.No;
            if (this.RefNo == null)
            {
                tb.Enabled = true;
            }
            else
            {
                tb.Enabled = false;
            }

            this.Pub1.AddTD(tb);
            this.Pub1.AddTD("枚举英文名称");
            this.Pub1.AddTREnd();


            this.Pub1.AddTRSum();
            this.Pub1.AddTD("名称");
            tb      = new BP.Web.Controls.TB();
            tb.ID   = "TB_Name";
            tb.Text = en.Name;
            this.Pub1.AddTD(tb);
            this.Pub1.AddTD("枚举中文名称");
            this.Pub1.AddTREnd();

            int idx = 0;

            while (idx < 20)
            {
                this.Pub1.AddTR();
                this.Pub1.AddTDIdx(idx);
                tb    = new BP.Web.Controls.TB();
                tb.ID = "TB_" + idx;
                SysEnum se = ses.GetEntityByKey(SysEnumAttr.IntKey, idx) as SysEnum;
                if (se != null)
                {
                    tb.Text = se.Lab;
                }
                //   tb.Text = en.Name;
                this.Pub1.AddTD(tb);
                this.Pub1.AddTD("");
                this.Pub1.AddTREnd();
                idx++;
            }

            this.Pub1.AddTRSum();
            this.Pub1.Add("<TD colspan=3 align=center>");
            Button btn = new Button();

            btn.ID       = "Btn_Save";
            btn.CssClass = "Btn";
            btn.Text     = " 保存 ";
            btn.Click   += new EventHandler(btn_Save_Click);
            this.Pub1.Add(btn);

            btn          = new Button();
            btn.CssClass = "Btn";
            btn.ID       = "Btn_Add";
            btn.Text     = "添加到表单"; // "添加到表单";
            btn.Attributes["onclick"] = " return confirm('您确认吗?');";
            btn.Click += new EventHandler(btn_Add_Click);
            if (this.RefNo == null)
            {
                btn.Enabled = false;
            }
            this.Pub1.Add(btn);

            btn          = new Button();
            btn.CssClass = "Btn";
            btn.ID       = "Btn_Del";
            btn.Text     = " 删除 ";
            btn.Attributes["onclick"] = " return confirm('您确认吗?');";
            if (this.RefNo == null)
            {
                btn.Enabled = false;
            }

            btn.Click += new EventHandler(btn_Del_Click);
            this.Pub1.Add(btn);

            this.Pub1.AddTDEnd();
            this.Pub1.AddTREnd();
            this.Pub1.AddTableEnd();
        }
Example #30
0
        public string SaveSysEnum(SysEnumInfo model)
        {
            if (string.IsNullOrWhiteSpace(model.EnumName))
            {
                return(MC.Submit_Params_InvalidError);
            }
            if (string.IsNullOrWhiteSpace(model.EnumCode))
            {
                return(MC.Submit_Params_InvalidError);
            }
            if (string.IsNullOrWhiteSpace(model.EnumValue))
            {
                return(MC.Submit_Params_InvalidError);
            }

            Guid gId = Guid.Empty;

            Guid.TryParse(model.Id.ToString(), out gId);
            model.Id = gId;

            Guid parentId = Guid.Empty;

            Guid.TryParse(model.ParentId.ToString(), out parentId);
            model.ParentId = parentId;

            SysEnum bll    = new SysEnum();
            int     effect = -1;

            if (!gId.Equals(Guid.Empty))
            {
                effect = bll.Update(model);
            }
            else
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (TransactionScope scope2 = new TransactionScope(TransactionScopeOption.Suppress))
                    {
                        if (bll.IsExist(model.EnumCode, model.ParentId, model.Id))
                        {
                            effect = 110;
                        }
                        else
                        {
                            effect = bll.Insert(model);
                        }
                        scope2.Complete();
                    }

                    scope.Complete();
                }
            }
            if (effect == 110)
            {
                return(MC.Submit_Exist);
            }
            if (effect > 0)
            {
                return("1");
            }
            else
            {
                return(MC.Submit_Error);
            }
        }