コード例 #1
0
        public async Task <IHttpActionResult> PutOnwayFlow(int id, OnwayFlow onwayFlow)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != onwayFlow.Id)
            {
                return(BadRequest());
            }

            db.Entry(onwayFlow).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OnwayFlowExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public async Task <IHttpActionResult> PutIssueTrack(long id, IssueTrack issueTrack)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != issueTrack.Id)
            {
                return(BadRequest());
            }

            db.Entry(issueTrack).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!IssueTrackExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        public async Task <IHttpActionResult> PutRepairApplyBill(int id, RepairApplyBill RepairApplyBill)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != RepairApplyBill.Id)
            {
                return(BadRequest());
            }

            db.Entry(RepairApplyBill).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }

            catch (DbUpdateConcurrencyException)
            {
                if (!RepairApplyBillExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            catch (Exception ex)
            { }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #4
0
        public async Task <IHttpActionResult> PutContact(string id, Contact contact)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != contact.Id)
            {
                return(BadRequest());
            }

            db.Entry(contact).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ContactExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #5
0
        public async Task <IHttpActionResult> PutSatisfactionLevel(int id, SatisfactionLevel satisfactionLevel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != satisfactionLevel.Id)
            {
                return(BadRequest());
            }

            db.Entry(satisfactionLevel).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SatisfactionLevelExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #6
0
        public async Task <IHttpActionResult> PutPrinterPermission(long id, PrinterPermission printerPermission)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != printerPermission.Id)
            {
                return(BadRequest());
            }

            db.Entry(printerPermission).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PrinterPermissionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #7
0
        public async Task <IHttpActionResult> PostSuperUser(SuperUser superUser)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.SuperUsers.Add(superUser);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = superUser.Id }, superUser));
        }
コード例 #8
0
        //public async Task<IHttpActionResult> PostOnwayFlow(OnwayFlow onwayFlow)
        public async Task <IHttpActionResult> PostOnwayFlow(OnwayFlowEntity onwayFlowEntity)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                //更新RepairApplyBill字段
                db.Entry(onwayFlowEntity.repairApplyBill).State = EntityState.Modified;

                #region 向OnwayFlow中增加记录
                string message;

                //报修单号
                string billNo = onwayFlowEntity.repairApplyBill.BillNo;
                //报修人手机号码
                string mobile = onwayFlowEntity.repairApplyBill.Phone;
                //报修人
                string bxEmployee = onwayFlowEntity.repairApplyBill.BXEmployee;
                //报修中心
                string bxDept = onwayFlowEntity.repairApplyBill.BXDept;
                //报修主题
                string bxTitle = onwayFlowEntity.repairApplyBill.Title;
                //邮箱
                string email               = onwayFlowEntity.repairApplyBill.EMail;
                long   repairApplyBillId   = onwayFlowEntity.repairApplyBill.Id;
                string ITMaintenanceMobile = ConfigurationManager.AppSettings["ITMaintenanceMobile"].ToString();
                db.OnwayFlows.Add(onwayFlowEntity.onwayFlow);
                #endregion

                await db.SaveChangesAsync();

                Common.updateNextDealer(onwayFlowEntity.onwayFlow);
                switch (onwayFlowEntity.onwayFlow.DealMethodId)
                {
                case 2:
                    //处理
                    //发送短信给报修人
                    message = string.Format("<a href='http://itsm.sztechand.com/Page/RepairBill.html?billType=4&id={1}'>您的报修单[提单号:{0}]已处理完毕,请填写满意度。</a><br><br>感谢您对流程与信息中心的支持!<br>欢迎使用<a href='http://itsm.sztechand.com'>IT服务平台</a>", billNo, repairApplyBillId);
                    //message = string.Format("您的报修单[提单号:{0}]已处理完毕,请填写满意度。", billNo);
                    //Common.sendMessage(mobile.ToString(), message);
                    Common.sendMail(string.Format("您的报修单[提单号:{0}]已处理完毕,请填写满意度", billNo), message, email, "流程与信息中心-应用运维部");
                    break;

                case 3:
                    //转发
                    //1.发送短信给报修人
                    message = string.Format("您的报修单[提单号:{0}]已由IT工程师[{1}]授理。", billNo, onwayFlowEntity.onwayFlow.NextDealer);
                    Common.sendMessage(mobile.ToString(), message);

                    //2.发送短信给IT工程师
                    //Common.sendMessage(ITMaintenanceMobile, string.Format("报修主题:{4},报修人:{1}[{2}],中心:{3}", billNo, bxEmployee, mobile, bxDept, bxTitle));

                    //Dictionary<string, string> dict = new Dictionary<string, string>();
                    //dict = Common.getUserInfo(onwayFlow.NextDealer);

                    //if (dict["Mobile"].Length == 0)
                    //{
                    //    Common.sendMessage("17722680637", onwayFlow.NextDealer + "的手机号码未维护");
                    //}
                    //else
                    //{
                    //    Common.sendMessage(dict["Mobile"], string.Format("你有待处理报修单,提单号:{0},报修人:{1},联系方式:{2},中心:{3},报修主题:{4}", billNo, bxEmployee, mobile, bxDept, bxTitle));
                    //}
                    break;

                case 4:
                    //接单
                    //1.发送短信给报修人
                    message = string.Format("您的报修单[提单号:{0}]已由IT工程师[{1}]授理。", billNo, onwayFlowEntity.onwayFlow.CurrentDealer);
                    Common.sendMessage(mobile.ToString(), message);
                    break;
                }
            }
            catch (System.Exception ex)
            { }
            return(CreatedAtRoute("DefaultApi", new { id = onwayFlowEntity.onwayFlow.Id }, onwayFlowEntity.onwayFlow));
        }