Пример #1
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));
            }
        }
Пример #2
0
        public string GetNoticeList(int pageIndex, int pageSize, string username)
        {
            try
            {
                WebSecurityService wsClient = new WebSecurityService();
                object             userId   = wsClient.GetUserId(username);
                if (userId == null)
                {
                    return("");
                }
                int    totalRecords = 0;
                Notice bll          = new Notice();
                var    list         = bll.GetMyNotice(pageIndex, pageSize, out totalRecords, userId);
                if (list == null || list.Count == 0)
                {
                    return("");
                }
                StringBuilder sb = new StringBuilder();
                sb.Append("<Rsp>");
                foreach (var model in list)
                {
                    sb.Append("<N>");
                    sb.AppendFormat("<Id>{0}</Id><Title>{1}</Title><AdTime>{2}</AdTime><Descr>{3}</Descr>", model.Id, model.Title, model.LastUpdatedDate.ToString("yyyy-MM-dd HH:mm"), model.Descr);
                    sb.Append("</N>");
                }
                sb.Append("</Rsp>");

                return(sb.ToString());
            }
            catch
            {
                return("");
            }
        }
Пример #3
0
        public string GetComplainRepairModel(Guid Id, string username)
        {
            WebSecurityService wsClient = new WebSecurityService();
            object             userId   = wsClient.GetUserId(username);

            if (userId == null)
            {
                return("");
            }

            ComplainRepair bll   = new ComplainRepair();
            var            model = bll.GetModel(Id);

            if (model == null)
            {
                return(string.Empty);
            }

            return(string.Format("<Rsp><N><Id>{0}</Id><Phone>{1}</Phone><Descr>{2}</Descr><AdTime>{3}</AdTime><Status>{4}</Status><Address>{5}</Address></N></Rsp>", model.Id, model.Phone, model.Descri, model.LastUpdatedDate.ToString("yyyy-MM-dd HH:mm"), SysEnumHelper.GetEnumNameForComplainRepairStatus(model.Status), model.Address));
        }
Пример #4
0
        public string GetComplainRepairList(int pageIndex, int pageSize, int repairType, string username)
        {
            string enumCode = SysEnumHelper.GetEnumNameForComplainRepairType(repairType);

            if (string.IsNullOrEmpty(enumCode))
            {
                return(string.Empty);
            }

            WebSecurityService wsClient = new WebSecurityService();
            object             userId   = wsClient.GetUserId(username);

            if (userId == null)
            {
                return(string.Empty);
            }
            int            totalRecords = 0;
            ComplainRepair bll          = new ComplainRepair();
            var            list         = bll.GetListByUser(pageIndex, pageSize, out totalRecords, userId, enumCode);

            if (list == null || list.Count == 0)
            {
                return(string.Empty);
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("<Rsp>");
            foreach (var model in list)
            {
                sb.AppendFormat("<N><Id>{0}</Id><Phone>{1}</Phone><Descr>{2}</Descr><AdTime>{3}</AdTime><Status>{4}</Status><Address>{5}</Address></N>", model.Id, model.Phone, model.Descri, model.LastUpdatedDate.ToString("yyyy-MM-dd HH:mm"), SysEnumHelper.GetEnumNameForComplainRepairStatus(model.Status), model.Address);
            }
            sb.Append("</Rsp>");

            return(sb.ToString());
        }
Пример #5
0
        public string GetNoticeModel(Guid Id, string username)
        {
            try
            {
                if (Id.Equals(Guid.Empty))
                {
                    return("");
                }
                WebSecurityService wsClient = new WebSecurityService();
                object             userId   = wsClient.GetUserId(username);
                if (userId == null)
                {
                    return("");
                }

                Notice bll   = new Notice();
                var    model = bll.GetMyNoticeModel(Id, userId);
                if (model == null)
                {
                    return("");
                }

                Regex r = new Regex("(<img)(.*)src=\"([^\"]*?)\"(.*)/>");

                StringBuilder sb = new StringBuilder();
                sb.Append("<Rsp>");
                sb.AppendFormat("<Id>{0}</Id><Title>{1}</Title><AdTime>{2}</AdTime><Descr>{3}</Descr><Content><![CDATA[{4}]]></Content>", model.Id, model.Title, model.LastUpdatedDate.ToString("yyyy-MM-dd HH:mm"), model.Descr, r.Replace(model.ContentText, "$1$2src=\"" + WebSiteHost + "$3\" />"));
                sb.Append("</Rsp>");

                return(sb.ToString());
            }
            catch
            {
                return("");
            }
        }