Example #1
0
        private void SurveyInfoBind()
        {
            Entities.QuerySurveyInfo query = new Entities.QuerySurveyInfo();
            if (!string.IsNullOrEmpty(SurveyName))
            {
                query.Name = SurveyName;
            }
            int bgId = 0;

            if (int.TryParse(BGID, out bgId) && bgId > 0)
            {
                query.BGID = bgId;
            }
            int scId = 0;

            if (int.TryParse(SCID, out scId) && scId > 0)
            {
                query.SCID = scId;
            }
            int userId = 0;

            if (int.TryParse(CreateUserID, out userId) && userId > 0)
            {
                query.CreateUserID = userId;
            }
            query.IsAvailable = 1;
            query.LoginID     = BLL.Util.GetLoginUserID();
            int       totalCount = 0;
            DataTable dt         = BLL.SurveyInfo.Instance.GetSurveyInfo(query, "SurveyInfo.CreateTime desc", BLL.PageCommon.Instance.PageIndex, PageSize, out totalCount);

            rptSurvey.DataSource = dt;
            rptSurvey.DataBind();
            litPagerDown.Text = BLL.PageCommon.Instance.LinkStringByPost(BLL.Util.GetUrl(), GroupLength, totalCount, PageSize, BLL.PageCommon.Instance.PageIndex, 1);
        }
Example #2
0
        //绑定数据
        public void BindData()
        {
            Entities.QuerySurveyInfo query = new Entities.QuerySurveyInfo();

            if (RequestName != "")
            {
                query.Name = StringHelper.SqlFilter(RequestName);
            }
            if (RequestStatus != "")
            {
                query.Statuss = StringHelper.SqlFilter(RequestStatus);
            }
            if (RequestIsAvailable != "")
            {
                query.IsAvailables = StringHelper.SqlFilter(RequestIsAvailable);
            }
            if (RequestGroup != "")
            {
                query.BGID = int.Parse(RequestGroup);
            }
            if (RequestCategory != "")
            {
                query.SCID = int.Parse(RequestCategory);
            }
            if (RequestCreater != "")
            {
                query.CreateUserID = int.Parse(RequestCreater);
            }
            if (RequestBeginTime != "")
            {
                query.BeginTime = StringHelper.SqlFilter(RequestBeginTime);
            }
            if (RequestEndTime != "")
            {
                query.EndTime = StringHelper.SqlFilter(RequestEndTime);
            }

            query.LoginID = BLL.Util.GetLoginUserID();

            DataTable dt = BLL.SurveyInfo.Instance.GetSurveyInfo(query, "SurveyInfo.CreateTime Desc", BLL.PageCommon.Instance.PageIndex, PageSize, out RecordCount);

            repeaterTableList.DataSource = dt;
            repeaterTableList.DataBind();

            litPagerDown.Text = BLL.PageCommon.Instance.LinkStringByPost(BLL.Util.GetUrl(), GroupLength, RecordCount, PageSize, BLL.PageCommon.Instance.PageIndex, 1);
        }
Example #3
0
        private void UpdateSurveyCategoryStatus(out string msg)
        {
            msg = string.Empty;
            int _scid = 0;

            if (int.TryParse(RequestSCID, out _scid))
            {
                Entities.SurveyCategory model = BLL.SurveyCategory.Instance.GetSurveyCategory(_scid);
                if (model != null)
                {
                    int count;
                    if (model.Status == 0)
                    {
                        if (model.TypeId == 1)
                        {
                            //判断该分类在调查问卷或调查项目中使用,则不能删除
                            Entities.QuerySurveyInfo query_surveyInfo = new Entities.QuerySurveyInfo();
                            query_surveyInfo.SCID = _scid;
                            DataTable dt_surveyInfo = BLL.SurveyInfo.Instance.GetSurveyInfo(query_surveyInfo, "", 1, 10000, out count);
                            if (dt_surveyInfo.Rows.Count > 0)
                            {
                                msg = "{msg:'该分类在调查问卷中有使用,无法停用'}";
                                return;
                            }

                            //判断该分类在调查问卷或调查项目中使用,则不能删除
                            Entities.QuerySurveyProjectInfo query_projectInfo = new Entities.QuerySurveyProjectInfo();
                            query_projectInfo.SCID   = _scid;
                            query_projectInfo.Status = 0;
                            DataTable dt_projectInfo = BLL.SurveyProjectInfo.Instance.GetSurveyProjectInfo(query_projectInfo, "", 1, 10000, out count);
                            if (dt_projectInfo.Rows.Count > 0)
                            {
                                msg = "{msg:'该分类在调查项目中有使用,无法停用'}";
                                return;
                            }
                        }
                        else if (model.TypeId == 2)
                        {
                            Entities.QueryProjectInfo query = new Entities.QueryProjectInfo();
                            query.PCatageID = _scid;
                            query.Status    = 0;
                            DataTable dt = BLL.ProjectInfo.Instance.GetProjectInfo(query, "", 1, 9999, out count);
                            if (dt != null && dt.Rows.Count > 0)
                            {
                                msg = "{msg:'该分类在数据清洗项目中有使用,无法停用'}";
                                return;
                            }
                        }

                        model.Status = 1;
                    }
                    else if (model.Status == 1)
                    {
                        model.Status = 0;
                    }
                    int result = 0;
                    try
                    {
                        result = BLL.SurveyCategory.Instance.Update(model);
                        msg    = "{msg:'success'}";
                    }
                    catch (Exception ex)
                    {
                        msg = "{msg:'" + ex.Message + "'}";
                    }
                }
            }
        }
Example #4
0
        //问卷分类修改(包括编辑和删除)
        private void surveyCategoryUpdate(out string msg)
        {
            msg = string.Empty;
            int _scid;

            if (int.TryParse(RequestSCID, out _scid))
            {
                Entities.SurveyCategory model = BLL.SurveyCategory.Instance.GetSurveyCategory(_scid);
                if (model != null)
                {
                    string oldName = string.Empty;
                    string newName = string.Empty;

                    if (RequestName != "")
                    {
                        oldName    = model.Name;
                        model.Name = RequestName;
                        newName    = model.Name;
                    }

                    if (RequestStatus != "")
                    {
                        int count;

                        if (TypeId == "1")
                        {
                            //判断该分类在调查问卷或调查项目中使用,则不能删除
                            Entities.QuerySurveyInfo query_surveyInfo = new Entities.QuerySurveyInfo();
                            query_surveyInfo.SCID = _scid;
                            DataTable dt_surveyInfo = BLL.SurveyInfo.Instance.GetSurveyInfo(query_surveyInfo, "", 1, 10000, out count);
                            if (dt_surveyInfo.Rows.Count > 0)
                            {
                                msg = "{msg:'该分类在调查问卷中有使用,无法删除'}";
                                return;
                            }

                            //判断该分类在调查问卷或调查项目中使用,则不能删除
                            Entities.QuerySurveyProjectInfo query_projectInfo = new Entities.QuerySurveyProjectInfo();
                            query_projectInfo.SCID   = _scid;
                            query_projectInfo.Status = 0;
                            DataTable dt_projectInfo = BLL.SurveyProjectInfo.Instance.GetSurveyProjectInfo(query_projectInfo, "", 1, 10000, out count);
                            if (dt_projectInfo.Rows.Count > 0)
                            {
                                msg = "{msg:'该分类在调查项目中有使用,无法删除'}";
                                return;
                            }
                        }
                        else if (TypeId == "2")
                        {
                            Entities.QueryProjectInfo query = new Entities.QueryProjectInfo();
                            query.PCatageID = _scid;
                            query.Status    = 0;
                            DataTable dt = BLL.ProjectInfo.Instance.GetProjectInfo(query, "", 1, 9999, out count);
                            if (dt != null && dt.Rows.Count > 0)
                            {
                                msg = "{msg:'该分类在数据清洗项目中有使用,无法删除'}";
                                return;
                            }
                        }

                        model.Status = int.Parse(RequestStatus);
                    }
                    int result = 0;
                    try
                    {
                        result = BLL.SurveyCategory.Instance.Update(model);

                        if (RequestStatus != "" && TypeId == "2")
                        {
                            //如果是其他任务的删除
                            BLL.CallRecord_ORIG_Business.Instance.DeleteBusinessUrl((int)model.BGID, (int)model.SCID);
                        }

                        if (result == 1)
                        {
                            msg = "{msg:'操作成功'}";

                            string logType = string.Empty;

                            if (TypeId == "1")
                            {
                                //插入日志
                                if (model.Status == -1)//删除
                                {
                                    logType += "问卷分类【删除】主键【" + model.SCID + "】分类名称【" + model.Name + "】问卷";
                                }
                                else if (oldName != string.Empty && newName != string.Empty)
                                {
                                    logType += "问卷分类【修改】主键【" + model.SCID + "】分类名称由【" + oldName + "】修改为【" + newName + "】";
                                }
                            }
                            else if (TypeId == "2")
                            {
                                //插入日志
                                if (model.Status == -1)//删除
                                {
                                    logType += "项目分类【删除】主键【" + model.SCID + "】分类名称【" + model.Name + "】问卷";
                                }
                                else if (oldName != string.Empty && newName != string.Empty)
                                {
                                    logType += "项目分类【修改】主键【" + model.SCID + "】分类名称由【" + oldName + "】修改为【" + newName + "】";
                                }
                            }

                            BLL.Util.InsertUserLog(logType);
                        }
                        else
                        {
                            msg = "{msg:'操作失败'}";
                        }
                    }
                    catch (Exception ex)
                    {
                        msg = "{msg:'" + ex.Message + "'}";
                    }
                }
            }
        }