Exemplo n.º 1
0
        public JsonResult SaveReportComponent(ReportComponentInfo info)
        {
            ResultModel <ReportComponentInfo> result = new ResultModel <ReportComponentInfo>();

            if (CheckSession(false) == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }
            try
            {
                List <UploadFileInfo> fileReportComponent = GetUploadFilesInSession();

                if (fileReportComponent != null)
                {
                    foreach (UploadFileInfo file in fileReportComponent)
                    {
                        file.FileContent = ParseBase64String(file.FileContent);
                    }
                }

                info        = dispatchManager.SaveReportComponent(info, fileReportComponent);
                result.Data = info;
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Exemplo n.º 2
0
 public int AddReportComponent(ReportComponentInfo info)
 {
     sqlStr = "INSERT INTO tblReportComponent(DispatchReportID,ComponentID,NewSerialCode,OldSerialCode) " +
              " VALUES(@DispatchReportID,@ComponentID,@NewSerialCode,@OldSerialCode)" +
              " SELECT @@IDENTITY";
     using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr))
     {
         command.Parameters.Add("@DispatchReportID", SqlDbType.Int).Value   = info.DispatchReportID;
         command.Parameters.Add("@ComponentID", SqlDbType.Int).Value        = info.NewComponent.Component.ID;
         command.Parameters.Add("@NewSerialCode", SqlDbType.NVarChar).Value = info.NewComponent.SerialCode;
         command.Parameters.Add("@OldSerialCode", SqlDbType.NVarChar).Value = info.OldComponent.SerialCode;
         info.ID = SQLUtil.ConvertInt(command.ExecuteScalar());
     }
     return(info.ID);
 }
Exemplo n.º 3
0
        public ReportComponentInfo SaveReportComponent(ReportComponentInfo info, List <UploadFileInfo> fileReportComponent)
        {
            info.ID = this.dispatchReportDao.AddReportComponent(info);

            if (fileReportComponent != null)
            {
                foreach (UploadFileInfo file in fileReportComponent)
                {
                    file.ObjectID     = info.ID;
                    file.ObjectTypeId = ObjectTypes.ReportAccessory;
                    file.ID           = this.fileManager.SaveUploadFile(file).ID;
                    file.FileContent  = "";
                }
                info.FileInfos = fileReportComponent;
            }
            return(info);
        }