Exemple #1
0
        public GovPublicApplyInfo GetApplyInfo(int publishmentSystemId, bool isOrganization, string queryName, string queryCode)
        {
            GovPublicApplyInfo info = null;
            var nameAttribute       = GovPublicApplyAttribute.CivicName;

            if (isOrganization)
            {
                nameAttribute = GovPublicApplyAttribute.OrgName;
            }
            string sqlWhere =
                $"WHERE PublishmentSystemID = {publishmentSystemId} AND {nameAttribute} = '{queryName}' AND QueryCode = '{queryCode}'";
            var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(TableName, SqlUtils.Asterisk, sqlWhere);

            using (var rdr = ExecuteReader(sqlSelect))
            {
                if (rdr.Read())
                {
                    info = new GovPublicApplyInfo();
                    BaiRongDataProvider.DatabaseDao.ReadResultsToExtendedAttributes(rdr, info);
                }
                rdr.Close();
            }

            info?.AfterExecuteReader();
            return(info);
        }
Exemple #2
0
        public GovPublicApplyInfo GetApplyInfo(int publishmentSystemId, int styleId, NameValueCollection form)
        {
            var queryCode      = GovPublicApplyManager.GetQueryCode();
            var departmentId   = TranslateUtils.ToInt(form[GovPublicApplyAttribute.DepartmentId]);
            var departmentName = string.Empty;

            if (departmentId > 0)
            {
                departmentName = DepartmentManager.GetDepartmentName(departmentId);
            }
            var applyInfo = new GovPublicApplyInfo(0, styleId, publishmentSystemId, TranslateUtils.ToBool(form[GovPublicApplyAttribute.IsOrganization], false), form[GovPublicApplyAttribute.Title], departmentName, departmentId, DateTime.Now, queryCode, EGovPublicApplyState.New);

            foreach (var name in form.AllKeys)
            {
                if (GovPublicApplyAttribute.BasicAttributes.Contains(name.ToLower()))
                {
                    var value = form[name];
                    if (!string.IsNullOrEmpty(value))
                    {
                        applyInfo.SetExtendedAttribute(name, value);
                    }
                }
            }

            return(applyInfo);
        }
Exemple #3
0
        public int Insert(GovPublicApplyInfo info)
        {
            int applyId;

            info.BeforeExecuteNonQuery();
            IDataParameter[] parms;
            var sqlInsert = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(info.Attributes, TableName, out parms);

            using (var conn = GetConnection())
            {
                conn.Open();
                using (var trans = conn.BeginTransaction())
                {
                    try
                    {
                        applyId = ExecuteNonQueryAndReturnId(trans, sqlInsert, parms);
                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        throw;
                    }
                }
            }

            return(applyId);
        }
Exemple #4
0
        public void Update(GovPublicApplyInfo info)
        {
            info.BeforeExecuteNonQuery();
            IDataParameter[] parms;
            var sqlUpdate = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(info.Attributes, TableName, out parms);

            ExecuteNonQuery(sqlUpdate, parms);
        }
Exemple #5
0
        public GovPublicApplyInfo GetApplyInfo(int applyId)
        {
            GovPublicApplyInfo info     = null;
            string             sqlWhere = $"WHERE ID = {applyId}";
            var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(TableName, SqlUtils.Asterisk, sqlWhere);

            using (var rdr = ExecuteReader(sqlSelect))
            {
                if (rdr.Read())
                {
                    info = new GovPublicApplyInfo();
                    BaiRongDataProvider.DatabaseDao.ReadResultsToExtendedAttributes(rdr, info);
                }
                rdr.Close();
            }

            info?.AfterExecuteReader();
            return(info);
        }
Exemple #6
0
        public static EGovPublicApplyLimitType GetLimitType(PublishmentSystemInfo publishmentSystemInfo, GovPublicApplyInfo applyInfo)
        {
            var ts = new TimeSpan(DateTime.Now.Ticks - applyInfo.AddDate.Ticks);

            var alert  = publishmentSystemInfo.Additional.GovPublicApplyDateLimit + publishmentSystemInfo.Additional.GovPublicApplyAlertDate;
            var yellow = alert + publishmentSystemInfo.Additional.GovPublicApplyYellowAlertDate;
            var red    = yellow + publishmentSystemInfo.Additional.GovPublicApplyRedAlertDate;

            if (ts.Days >= red)
            {
                return(EGovPublicApplyLimitType.Red);
            }
            else if (ts.Days >= yellow)
            {
                return(EGovPublicApplyLimitType.Yellow);
            }
            else if (ts.Days >= alert)
            {
                return(EGovPublicApplyLimitType.Alert);
            }

            return(EGovPublicApplyLimitType.Normal);
        }
Exemple #7
0
        void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var applyInfo = new GovPublicApplyInfo(e.Item.DataItem);

                var ltlTr         = e.Item.FindControl("ltlTr") as Literal;
                var ltlTitle      = e.Item.FindControl("ltlTitle") as Literal;
                var ltlAddDate    = e.Item.FindControl("ltlAddDate") as Literal;
                var ltlRemark     = e.Item.FindControl("ltlRemark") as Literal;
                var ltlDepartment = e.Item.FindControl("ltlDepartment") as Literal;
                var ltlLimit      = e.Item.FindControl("ltlLimit") as Literal;
                var ltlState      = e.Item.FindControl("ltlState") as Literal;
                var ltlFlowUrl    = e.Item.FindControl("ltlFlowUrl") as Literal;
                var ltlViewUrl    = e.Item.FindControl("ltlViewUrl") as Literal;

                ltlTr.Text = @"<tr class=""tdbg"" style=""height:25px"">";
                var limitType = GovPublicApplyManager.GetLimitType(PublishmentSystemInfo, applyInfo);
                if (limitType == EGovPublicApplyLimitType.Alert)
                {
                    ltlTr.Text = @"<tr class=""tdbg"" style=""height:25px;background-color:#AAAAD5"">";
                }
                else if (limitType == EGovPublicApplyLimitType.Yellow)
                {
                    ltlTr.Text = @"<tr class=""tdbg"" style=""height:25px;background-color:#FF9"">";
                }
                else if (limitType == EGovPublicApplyLimitType.Red)
                {
                    ltlTr.Text = @"<tr class=""tdbg"" style=""height:25px;background-color:#FE5461"">";
                }

                if (applyInfo.State == EGovPublicApplyState.Accepted || applyInfo.State == EGovPublicApplyState.Redo)
                {
                    ltlTitle.Text =
                        $@"<a href=""{PageGovPublicApplyToReplyDetail.GetRedirectUrl(PublishmentSystemId,
                            applyInfo.Id, PageUrl)}"">{applyInfo.Title}</a>";
                }
                else if (applyInfo.State == EGovPublicApplyState.Checked || applyInfo.State == EGovPublicApplyState.Replied)
                {
                    ltlTitle.Text =
                        $@"<a href=""{PageGovPublicApplyToCheckDetail.GetRedirectUrl(PublishmentSystemId,
                            applyInfo.Id, PageUrl)}"">{applyInfo.Title}</a>";
                }
                else if (applyInfo.State == EGovPublicApplyState.Denied || applyInfo.State == EGovPublicApplyState.New)
                {
                    ltlTitle.Text =
                        $@"<a href=""{PageGovPublicApplyToAcceptDetail.GetRedirectUrl(PublishmentSystemId,
                            applyInfo.Id, PageUrl)}"">{applyInfo.Title}</a>";
                }
                var departmentName = DepartmentManager.GetDepartmentName(applyInfo.DepartmentId);
                if (applyInfo.DepartmentId > 0 && departmentName != applyInfo.DepartmentName)
                {
                    ltlTitle.Text += "<span style='color:red'>【转】</span>";
                }
                ltlAddDate.Text    = DateUtils.GetDateAndTimeString(applyInfo.AddDate);
                ltlRemark.Text     = GovPublicApplyManager.GetApplyRemark(applyInfo.Id);
                ltlDepartment.Text = departmentName;
                ltlLimit.Text      = EGovPublicApplyLimitTypeUtils.GetText(limitType);
                ltlState.Text      = EGovPublicApplyStateUtils.GetText(applyInfo.State);
                if (applyInfo.State == EGovPublicApplyState.New)
                {
                    ltlState.Text = $"<span style='color:red'>{ltlState.Text}</span>";
                }
                else if (applyInfo.State == EGovPublicApplyState.Redo)
                {
                    ltlState.Text = $"<span style='color:red'>{ltlState.Text}</span>";
                }
                ltlFlowUrl.Text =
                    $@"<a href=""javascript:;"" onclick=""{ModalGovPublicApplyFlow.GetOpenWindowString(
                        PublishmentSystemId, applyInfo.Id)}"">轨迹</a>";
                ltlViewUrl.Text =
                    $@"<a href=""javascript:;"" onclick=""{ModalGovPublicApplyView.GetOpenWindowString(
                        PublishmentSystemId, applyInfo.Id)}"">查看</a>";
            }
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            PageUtils.CheckRequestParameter("PublishmentSystemID", "ApplyID", "ReturnUrl");

            applyInfo = DataProvider.GovPublicApplyDao.GetApplyInfo(TranslateUtils.ToInt(Request.QueryString["ApplyID"]));
            returnUrl = StringUtils.ValueFromUrl(Request.QueryString["ReturnUrl"]);

            if (!IsPostBack)
            {
                if (!applyInfo.IsOrganization)
                {
                    ltlType.Text              = "公民";
                    phCivic.Visible           = true;
                    phOrg.Visible             = false;
                    ltlCivicName.Text         = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.CivicName);
                    ltlCivicOrganization.Text = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.CivicOrganization);
                    ltlCivicCardType.Text     = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.CivicCardType);
                    ltlCivicCardNo.Text       = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.CivicCardNo);
                    ltlCivicPhone.Text        = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.CivicPhone);
                    ltlCivicPostCode.Text     = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.CivicPostCode);
                    ltlCivicAddress.Text      = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.CivicAddress);
                    ltlCivicEmail.Text        = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.CivicEmail);
                    ltlCivicFax.Text          = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.CivicFax);

                    ltlName.Text = ltlCivicName.Text;
                }
                else
                {
                    ltlType.Text           = "法人/其他组织";
                    phCivic.Visible        = false;
                    phOrg.Visible          = true;
                    ltlOrgName.Text        = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.OrgName);
                    ltlOrgUnitCode.Text    = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.OrgUnitCode);
                    ltlOrgLegalPerson.Text = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.OrgLegalPerson);
                    ltlOrgLinkName.Text    = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.OrgLinkName);
                    ltlOrgPhone.Text       = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.OrgPhone);
                    ltlOrgPostCode.Text    = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.OrgPostCode);
                    ltlOrgAddress.Text     = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.OrgAddress);
                    ltlOrgEmail.Text       = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.OrgEmail);
                    ltlOrgFax.Text         = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.OrgFax);

                    ltlName.Text = ltlOrgName.Text;
                }

                ltlState.Text       = EGovPublicApplyStateUtils.GetText(applyInfo.State);
                ltlQueryCode.Text   = applyInfo.QueryCode;
                ltlTitle.Text       = applyInfo.Title;
                ltlContent.Text     = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.Content);
                ltlPurpose.Text     = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.Purpose);
                ltlIsApplyFree.Text = TranslateUtils.ToBool(applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.Content)) ? "申请" : "不申请";
                ltlProvideType.Text = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.ProvideType);
                ltlObtainType.Text  = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.ObtainType);

                if (phReply != null)
                {
                    if (applyInfo.State == EGovPublicApplyState.Denied || applyInfo.State == EGovPublicApplyState.Replied || applyInfo.State == EGovPublicApplyState.Redo || applyInfo.State == EGovPublicApplyState.Checked)
                    {
                        var replyInfo = DataProvider.GovPublicApplyReplyDao.GetReplyInfoByApplyId(applyInfo.Id);
                        if (replyInfo != null)
                        {
                            phReply.Visible = true;
                            ltlDepartmentAndUserName.Text =
                                $"{DepartmentManager.GetDepartmentName(replyInfo.DepartmentID)}({replyInfo.UserName})";
                            ltlAddDate.Text = DateUtils.GetDateAndTimeString(replyInfo.AddDate);
                            ltlReply.Text   = replyInfo.Reply;
                            ltlFileUrl.Text = replyInfo.FileUrl;
                        }
                    }
                }

                if (divAddDepartment != null)
                {
                    divAddDepartment.Attributes.Add("onclick", ModalGovPublicCategoryDepartmentSelect.GetOpenWindowString(PublishmentSystemId));
                    var scriptBuilder = new StringBuilder();
                    if (applyInfo.DepartmentId > 0)
                    {
                        var departmentName = DepartmentManager.GetDepartmentName(applyInfo.DepartmentId);
                        scriptBuilder.Append(
                            $@"<script>showCategoryDepartment('{departmentName}', '{applyInfo.DepartmentId}');</script>");
                    }
                    ltlScript.Text = scriptBuilder.ToString();
                }

                rptRemarks.DataSource     = DataProvider.GovPublicApplyRemarkDao.GetDataSourceByApplyId(applyInfo.Id);
                rptRemarks.ItemDataBound += rptRemarks_ItemDataBound;
                rptRemarks.DataBind();

                if (rptLogs != null)
                {
                    rptLogs.DataSource     = DataProvider.GovPublicApplyLogDao.GetDataSourceByApplyId(applyInfo.Id);
                    rptLogs.ItemDataBound += rptLogs_ItemDataBound;
                    rptLogs.DataBind();
                }
            }
        }
Exemple #9
0
        public static void SendSMSByGovPublicApply(PublishmentSystemInfo publishmentSystemInfo, TagStyleGovPublicApplyInfo tagStyleInfo, GovPublicApplyInfo applyInfo)
        {
            try
            {
                if (tagStyleInfo.IsSMS && !string.IsNullOrEmpty(tagStyleInfo.SMSTo))
                {
                    var mobiles         = tagStyleInfo.SMSTo.Split(';', ',');
                    var mobileArrayList = new ArrayList();

                    foreach (var mobile in mobiles)
                    {
                        if (!string.IsNullOrEmpty(mobile) && StringUtils.IsMobile(mobile) && !mobileArrayList.Contains(mobile))
                        {
                            mobileArrayList.Add(mobile);
                        }
                    }

                    var builder    = new StringBuilder(tagStyleInfo.SMSTitle);
                    var attributes = new NameValueCollection();
                    attributes["申请人类型"] = "公民";
                    if (TranslateUtils.ToBool(applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.IsOrganization)))
                    {
                        attributes["申请人类型"] = "法人/其他组织";
                    }
                    attributes["申请时间"] = DateUtils.GetDateAndTimeString(applyInfo.AddDate);
                    foreach (string key in attributes.Keys)
                    {
                        var theValue = attributes[key];

                        builder.Append($@"{key}:{theValue},");
                    }

                    if (builder.Length > 0)
                    {
                        builder.Length = builder.Length - 1;
                    }

                    if (builder.Length > 60)
                    {
                        builder.Length = 60;
                    }

                    //var errorMessage = string.Empty;
                    //var providerInfo = BaiRongDataProvider.SmsProviderDAO.GetFirstSmsProviderInfo();
                    //if (providerInfo != null)
                    //{
                    //    SmsProviderManager.Send(providerInfo, mobileArrayList, builder.ToString(), out errorMessage);
                    //}
                }
            }
            catch
            {
                // ignored
            }
        }
Exemple #10
0
        public static string GetCallbackScript(PublishmentSystemInfo publishmentSystemInfo, bool isSuccess, GovPublicApplyInfo applyInfo, string failureMessage)
        {
            var jsonAttributes = new NameValueCollection();

            jsonAttributes.Add("isSuccess", isSuccess.ToString().ToLower());
            if (isSuccess && applyInfo != null)
            {
                jsonAttributes.Add("isOrg", applyInfo.IsOrganization.ToString().ToLower());
                foreach (string attributeName in applyInfo.Attributes.Keys)
                {
                    jsonAttributes.Add(attributeName, applyInfo.GetExtendedAttribute(attributeName));
                }
                jsonAttributes.Add("replystate", EGovPublicApplyStateUtils.GetFrontText(applyInfo.State));
                if (applyInfo.State == EGovPublicApplyState.Checked || applyInfo.State == EGovPublicApplyState.Denied)
                {
                    var replyInfo = DataProvider.GovPublicApplyReplyDao.GetReplyInfoByApplyId(applyInfo.Id);
                    if (replyInfo != null)
                    {
                        jsonAttributes.Add("replycontent", replyInfo.Reply);
                        jsonAttributes.Add("replyfileurl", replyInfo.FileUrl);
                        jsonAttributes.Add("replydepartmentname", DepartmentManager.GetDepartmentName(replyInfo.DepartmentID));
                        jsonAttributes.Add("replyusername", replyInfo.UserName);
                        jsonAttributes.Add("replyadddate", DateUtils.GetDateAndTimeString(replyInfo.AddDate));
                    }
                }
            }
            jsonAttributes.Add("failureMessage", failureMessage);

            var jsonString = TranslateUtils.NameValueCollectionToJsonString(jsonAttributes);

            jsonString = StringUtils.ToJsString(jsonString);

            return($"<script>window.parent.stlQueryCallback('{jsonString}');</script>");
        }