Ejemplo n.º 1
0
        public int AddRepairReport(RepairReport repairReport)
        {
            _db.RepairReports.Add(repairReport);
            _db.SaveChanges();

            return(repairReport.Id);
        }
Ejemplo n.º 2
0
        private void btnDelivered_Click(object sender, EventArgs e)
        {
            var indices = lvOrderList.SelectedItems.Count;

            if (indices < 1)
            {
                return;
            }

            int id = Convert.ToInt32(lvOrderList.SelectedItems[0].SubItems[0].Text);

            var rr = new RepairReport(id);

            rr.Show();
        }
Ejemplo n.º 3
0
        public RepairReport UpdateRepairReport(int id, RepairReport repairReport)
        {
            var currentRecord = _db.RepairReports.First(rr => rr.Id == id);

            foreach (PropertyInfo property in repairReport.GetType().GetProperties())
            {
                var value = repairReport.GetType().GetProperty(property.Name).GetValue(repairReport, null);
                if (value != null && property.Name.ToLower() != "id")
                {
                    currentRecord.GetType().GetProperty(property.Name).SetValue(currentRecord, value);
                }
            }
            _db.SaveChanges();

            return(currentRecord);
        }
Ejemplo n.º 4
0
 public GetRepairReportDto RepairReportToGetRepairReportDto(RepairReport repairReport)
 {
     if (repairReport == null)
     {
         return(null);
     }
     return(new GetRepairReportDto
     {
         Id = repairReport.Id,
         Description = repairReport.Description,
         Cost = repairReport.Cost,
         Time = repairReport.Time,
         IsDeleted = repairReport.IsDeleted,
         OrderId = repairReport.OrderId
     });
 }
Ejemplo n.º 5
0
        public ActionResult Create([Bind(Include = "Id,cus_id,header,body,File,date_time")] RepairReport repairreport)
        {
            var file = Request.Files[0];

            if (file != null && file.ContentLength > 0)
            {
                var fileName = Path.GetFileName(file.FileName);
                var path     = Path.Combine(Server.MapPath("~/Content/RepairReport"), fileName);
                file.SaveAs(path);
                repairreport.File = fileName;
            }
            repairreport.date_time = DateTime.Now;
            repairreport.cus_id    = User.Identity.GetUserId();
            db.RepairReport.Add(repairreport);
            db.SaveChanges();
            return(View("ReportSuccess"));
        }
Ejemplo n.º 6
0
        //public static StatusReport GetRepairReport1(string ztcode, string level)
        //{
        //    StatusReport sr = new StatusReport();
        //    string sqlStr =
        //        " select " +
        //        " ID,序号,部门,地址,报修人,联系电话,服务项目,服务类别," +
        //        " 紧急程度,报修说明,报修时间,预约服务时间,谈好上门时间,发单人,接单人,派工时间," +
        //        " 到场时间,操作人,完成时间,收费类别,材料费,人工费,是否已收,是否阅读,状态,完成情况及所耗物料,报修前照片1," +
        //        " 报修前照片2,报修前照片3,处理后照片1,处理后照片2,处理后照片3,延期原因,预计延期到,回访人,回访意见,回访时间, " +
        //        " 是否满意,业主确认完成,业主确认完成时间,是否满意,业主评价,是否入户 " +
        //        " from 小程序_工单管理 ";
        //    string sqlString = "";
        //    string condition = "";
        //    if (level == "助理")
        //    {
        //        DataTable dt = null;
        //        List<Repair> repairList = null;
        //        List<RepairReportProject> rrpList = new List<RepairReportProject>();
        //        RepairReportProject rrp = null;
        //        condition = " where 帐套代码 = @帐套代码 and isnull(完成时间,'') = '' " +
        //            " and left(CONVERT(varchar(10),getdate(),112),8) = left(CONVERT(varchar(10),报修时间,112),8) " +
        //            " and cast(left(CONVERT(varchar(20),getdate(),114),2) as int) >= 17 ";//当日未完工
        //        sqlString = sqlStr + condition;
        //        dt = SQLHelper.ExecuteQuery("wyt", sqlString,
        //        new SqlParameter("@帐套代码", ztcode));

        //        rrp = new RepairReportProject();
        //        rrp.type = "当日未完成";
        //        if (dt.Rows.Count != 0)
        //        {
        //            rrp = new RepairReportProject();
        //            rrp.type = "当日未完成";
        //            repairList = GetRepair(dt);
        //            rrp.repairs = repairList.ToArray();

        //        }
        //        rrpList.Add(rrp);

        //        condition = " where " +
        //            "  帐套代码 = @帐套代码 and ((预估完成时间 is not null " +
        //            " and isnull(完成时间,'') = '' " +
        //            " and DATEDIFF (hour, 预估完成时间, getdate()) >= 0) " +
        //            " or (预估完成时间 is not null " +
        //            " and DATEDIFF (hour, 预估完成时间, 完成时间) > 0" +
        //            " and DATEDIFF (hour, 预估完成时间, getdate()) >= 0)) ";//超过预估完成时间
        //        sqlString = sqlStr + condition;
        //        dt = SQLHelper.ExecuteQuery("wyt", sqlString,
        //        new SqlParameter("@帐套代码", ztcode));
        //        rrp = new RepairReportProject();
        //        rrp.type = "超过预估完成时间";
        //        if (dt.Rows.Count != 0)
        //        {
        //            repairList = GetRepair(dt);
        //            rrp.repairs = repairList.ToArray();
        //        }
        //        rrpList.Add(rrp);
        //        sr.status = "success";
        //        sr.result = "成功";
        //        sr.data = rrpList.ToArray();
        //        return sr;
        //    }
        //    else
        //    {
        //        condition = " where  帐套代码 = @帐套代码 and  是否满意 = '不满意' ";
        //        RepairReportCompany rrc = new RepairReportCompany();
        //        rrc.type = "业主不满意";
        //        sqlString = sqlStr + condition;
        //        DataTable dt = SQLHelper.ExecuteQuery("wyt", sqlString,
        //                        new SqlParameter("@帐套代码", ztcode));
        //        if (dt.Rows.Count == 0)
        //        {
        //            sr.status = "Fail";
        //            sr.result = "未查询到任何数据";
        //            return sr;
        //        }
        //        List<Repair> repairList = GetRepair(dt);
        //        rrc.repairs = repairList.ToArray();
        //        sr.status = "Success";
        //        sr.result = "成功";
        //        sr.data = rrc;
        //        return sr;
        //    }
        //}

        private static List <RepairReport> GetRepairReport(DataTable dt)
        {
            List <RepairReport> repairList = new List <RepairReport>();

            foreach (DataRow row in dt.Rows)
            {
                List <string> beforeList = new List <string>();
                List <string> afterList  = new List <string>();
                RepairReport  r          = new RepairReport();
                r.Id              = DataTypeHelper.GetIntValue(row["ID"]);
                r.SerialNumber    = DataTypeHelper.GetStringValue(row["序号"]);
                r.Department      = DataTypeHelper.GetStringValue(row["部门"]);
                r.Address         = DataTypeHelper.GetStringValue(row["地址"]);
                r.RepairPerson    = DataTypeHelper.GetStringValue(row["报修人"]);
                r.PhoneNumber     = DataTypeHelper.GetStringValue(row["联系电话"]);
                r.ServiceProject  = DataTypeHelper.GetStringValue(row["服务项目"]);
                r.ServiceCategory = DataTypeHelper.GetStringValue(row["服务类别"]);
                r.Level           = DataTypeHelper.GetStringValue(row["紧急程度"]);
                //r.Identity = DataTypeHelper.GetStringValue(row["身份"]);
                r.NeedIn                   = DataTypeHelper.GetStringValue(row["是否入户"]);
                r.RepairExplain            = DataTypeHelper.GetStringValue(row["报修说明"]);
                r.RepairTime               = DataTypeHelper.GetDateStringValue(row["报修时间"]);
                r.OrderTime                = DataTypeHelper.GetDateStringValue(row["预约服务时间"]);
                r.VisitTime                = DataTypeHelper.GetDateStringValue(row["谈好上门时间"]);
                r.SendPerson               = DataTypeHelper.GetStringValue(row["发单人"]);
                r.ReceivePerson            = DataTypeHelper.GetStringValue(row["接单人"]);
                r.DispatchTime             = DataTypeHelper.GetDateStringValue(row["派工时间"]);
                r.ArriveTime               = DataTypeHelper.GetDateStringValue(row["到场时间"]);
                r.OperatePerson            = DataTypeHelper.GetStringValue(row["操作人"]);
                r.CompleteTime             = DataTypeHelper.GetDateStringValue(row["完成时间"]);
                r.ChargeType               = DataTypeHelper.GetStringValue(row["收费类别"]);
                r.MaterialExpense          = DataTypeHelper.GetDoubleValue(row["材料费"]);
                r.LaborExpense             = DataTypeHelper.GetDoubleValue(row["人工费"]);
                r.IsPaid                   = DataTypeHelper.GetStringValue(row["是否已收"]);
                r.IsRead                   = DataTypeHelper.GetIntValue(row["是否阅读"]);
                r.AffirmComplete           = DataTypeHelper.GetStringValue(row["业主确认完成"]);
                r.AffirmCompleteEvaluation = DataTypeHelper.GetStringValue(row["业主评价"]);
                r.AffirmCompleteTime       = DataTypeHelper.GetDateStringValue(row["业主确认完成时间"]);
                r.IsSatisfying             = DataTypeHelper.GetStringValue(row["是否满意"]);
                r.CallBackEvaluation       = DataTypeHelper.GetStringValue(row["回访意见"]);
                r.CallBackPerson           = DataTypeHelper.GetStringValue(row["回访人"]);
                r.CallBackTime             = DataTypeHelper.GetDateStringValue(row["回访时间"]);
                r.status                   = DataTypeHelper.GetStringValue(row["状态"]);
                r.status                   = string.IsNullOrEmpty(r.AffirmComplete) ? r.status : "业主已确认";
                r.status                   = string.IsNullOrEmpty(r.CallBackPerson) ? r.status : "已回访";
                r.CompleteStatus           = DataTypeHelper.GetStringValue(row["完成情况及所耗物料"]);
                r.LateTime                 = DataTypeHelper.GetDateStringValue(row["预计延期到"]);
                r.type       = DataTypeHelper.GetStringValue(row["上报原因"]);
                r.LateReason = DataTypeHelper.GetStringValue(row["延期原因"]);
                beforeList.Add(DataTypeHelper.GetStringValue(row["报修前照片1"]));
                beforeList.Add(DataTypeHelper.GetStringValue(row["报修前照片2"]));
                beforeList.Add(DataTypeHelper.GetStringValue(row["报修前照片3"]));
                r.BeforeImage = beforeList.ToArray();
                afterList.Add(DataTypeHelper.GetStringValue(row["处理后照片1"]));
                afterList.Add(DataTypeHelper.GetStringValue(row["处理后照片2"]));
                afterList.Add(DataTypeHelper.GetStringValue(row["处理后照片3"]));
                r.AfterImage = afterList.ToArray();
                repairList.Add(r);
            }

            return(repairList);
        }