예제 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(SCZM.Model.Repair.repair_Schedule model, out string message)
        {
            message = "保存成功!";
            if (!dal.CheckSaveData(model.ScheduleDate, model.ID, model.AssignmentProcedureId))
            {
                message = "请合理保存反馈时间";
                return(false);
            }
            int rows = dal.Update(model);

            if (rows == 0)
            {
                message = "对不起,该条数据已被其他人删除!";
                return(false);
            }
            else
            {
                return(true);
            }
        }
예제 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(SCZM.Model.Repair.repair_Schedule model, out string message)
        {
            message = "保存成功!";
            if (!dal.CheckSaveData(model.ScheduleDate, model.ID, model.AssignmentProcedureId))
            {
                message = "请合理保存反馈时间";
                return(0);
            }
            int ScheduleType_current = dal.GetScheduleType(model.AssignmentProcedureId);

            switch (ScheduleType_current)
            {
            case 1:
                if (model.ScheduleType == 1)
                {
                    message = "当前进度以保存,请返回查看";
                    return(0);
                }
                break;

            case 2:
                if (model.ScheduleType == 2 || model.ScheduleType == 3)
                {
                    message = "当前进度以保存,请返回查看";
                    return(0);
                }
                break;

            case 3:
                message = "当前进度以保存,请返回查看";
                return(0);

            case -1:
                if (model.ScheduleType == 2 || model.ScheduleType == 3)
                {
                    message = "当前进度以保存,请返回查看";
                    return(0);
                }
                break;

            default:
                break;
            }
            int rowId = dal.Add(model);

            if (rowId < 1)
            {
                message = "保存失败!";
            }
            else
            {
                BLL.System.sys_Attachment attachmenBLL = new BLL.System.sys_Attachment();
                string IDList = (model.AttachmentList_Schedule == "" || model.AttachmentList_Schedule == null ? "" : model.AttachmentList_Schedule + ",")
                ;
                string FileUse = "进度反馈";
                if (IDList != "")
                {
                    attachmenBLL.UpdateUseList(Utils.DelLastComma(IDList), FileUse, rowId);
                }
            }
            return(rowId);
        }