Exemple #1
0
        public static DataOfRepair FindDataOfRepair(string phone)
        {
            DataOfRepair dor = new DataOfRepair();

            dor.Village             = repairHelper.GetHistoryRepairByPhone(phone).FirstOrDefault();
            dor.Villages            = repairHelper.GetAllVillage().ToList();
            dor.OveruseRepair       = repairHelper.GetOveruseRepair();
            dor.Record              = RecordHelper.GetRecordByPhone(phone);
            dor.HasUnFinishedRepair = repairHelper.HasUnFinishedRepairByPhone(phone);
            return(dor);
        }
Exemple #2
0
        /// <summary>
        /// 提交一个新的报修申请手机
        /// </summary>
        /// <param name="content"></param>
        /// <param name="mediaidList">图片</param>
        /// <param name="phone"></param>
        /// <param name="villageid"></param>
        /// <param name="name"></param>
        /// <param name="recordid"></param>
        /// <returns></returns>
        public Repair Add(string content, string phone, int villageid, string name, int recordid)
        {
            var db  = new ModelContext();
            var usr = db.UserInfo.FirstOrDefault(item => item.PhoneNumber == phone);

            if (usr == null)
            {
                return(null);
            }
            //var mediaIdArr = mediaidList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            var number = GetNewInnerNumber();
            var rep    = new Repair
            {
                Contenet    = content,
                CreateDate  = DateTime.Now,
                Status      = RepairStatus.Apply,
                UserId      = usr.UserInfoId,
                InnerNumber = number,
                PhoneNumber = phone,
                VillageId   = villageid,
                Name        = name,
            };


            db.RepairSet.Add(rep);

            db.SaveChanges();

            var vill = db.VillageSet.Find(villageid);

            RecordHelper.UpdateRecord(recordid, "openid", RecordType.MpRepair, phone, name, vill.Name);

            //发送企业号通知
            var    workernamArr = System.Configuration.ConfigurationManager.AppSettings["repairworkers"].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            string scontent     = rep.Contenet.Replace("<br />", ",").Length > 7 ? rep.Contenet.Replace("<br />", ",").Substring(0, 6) + "..." : rep.Contenet.Replace("<br />", ",");
            var    msg          = $"收到新的报修申请,请尽快处理!\n报修单位:{rep.Village?.Name}\n报修人:{rep.Name}\n联系方式:{rep.PhoneNumber}\n报修内容:{scontent}\n报修时间:{rep.CreateDate.ToString("yyyy-MM-dd hh:mm")}\n\n<a href=\\\"http://mp.doshine.com/DoShineMP/PhoneWeb/RepairDetailsInterior?repairid={rep.RepairId}\\\">点击查看</a>";

            WechatHelper.SendComponyMessage(workernamArr, msg);

            return(rep);
        }
Exemple #3
0
        /// <summary>
        /// 提交一个新的报修申请
        /// </summary>
        /// <param name="openid">用户openid</param>
        /// <param name="content"></param>
        /// <param name="mediaidList">图片列表,用逗号分割</param>
        /// <returns></returns>
        public Repair Add(string openid, string content, string mediaidList, string phone, int villageid, string name, int recordid)
        {
            var db  = new ModelContext();
            var usr = WechatHelper.CheckOpenid(openid);

            usr = WechatHelper.CheckUser(usr);
            if (usr.UserInfoId == null || usr.UserInfoId == 0 || usr.UserInfo == null)
            {
                return(null);
            }
            var mediaIdArr = mediaidList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);


            var number = GetNewInnerNumber();
            var rep    = new Repair
            {
                Contenet    = content,
                CreateDate  = DateTime.Now,
                Status      = RepairStatus.Apply,
                UserId      = usr.UserInfoId,
                InnerNumber = number,
                PhoneNumber = phone,
                VillageId   = villageid,
                Name        = name,
            };


            db.RepairSet.Add(rep);
            db.SaveChanges();

            //下载文件

            //单个
            //if (!string.IsNullOrEmpty(mediaid))
            //{
            //    WechatImageHelper.AddNewImageForRepair(mediaid, rep.RepairId, openid);
            //}


            //多个
            if (mediaIdArr != null && mediaIdArr.Length > 0)
            {
                List <ImageDownloadLog> md = WechatImageHelper.AddNewImageForRepair(mediaIdArr, rep.RepairId, openid).ToList();
                md.Clear();
            }


            LogHelper.AddLog("Apply a new repair", rep.RepairId.ToString(), openid);

            db.SaveChanges();

            var vill = db.VillageSet.Find(villageid);

            RecordHelper.UpdateRecord(recordid, openid, RecordType.MpRepair, phone, name, vill.Name);

            //发送企业号通知
            var    workernamArr = System.Configuration.ConfigurationManager.AppSettings["repairworkers"].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            string scontent     = rep.Contenet.Replace("<br />", ",").Length > 7 ? rep.Contenet.Replace("<br />", ",").Substring(0, 6) + "..." : rep.Contenet.Replace("<br />", ",");
            var    msg          = $"收到新的报修申请,请尽快处理!\n报修单位:{rep.Village?.Name}\n报修人:{rep.Name}\n联系方式:{rep.PhoneNumber}\n报修内容:{scontent}\n报修时间:{rep.CreateDate.ToString("yyyy-MM-dd hh:mm")}\n\n<a href=\\\"http://mp.doshine.com/DoShineMP/PhoneWeb/RepairDetailsInterior?repairid={rep.RepairId}\\\">点击查看</a>";

            WechatHelper.SendComponyMessage(workernamArr, msg);

            return(rep);
        }
Exemple #4
0
        public static DataOfLasterRepair FindDataOfLasterRepairByPhone(string phone)
        {
            DataOfLasterRepair dolr = new Helper.DataOfLasterRepair();

            dolr.Village = repairHelper.GetAllVillage().FirstOrDefault(item => item.Name == RecordHelper.GetRecordByPhone(phone).Address);
            var ceshi = repairHelper.GetHistoryRepairByPhone(phone);

            dolr.Repair = ceshi == null ? null : ceshi.ToList();
            return(dolr);
        }