예제 #1
0
 public SigmaResultType AddUploadedFileInfo(TypeUploadedFileInfo objUploadedFileInfo)
 {
     SigmaResultType result = new SigmaResultType();
     try
     {
         UploadedFileInfoMgr uploadedFileInfoMgr = new UploadedFileInfoMgr();
         result = uploadedFileInfoMgr.AddUploadedFileInfo(objUploadedFileInfo);
         return result;
     }
     catch (Exception ex)
     {
         // Log Exception
         ExceptionHelper.logException(ex);
         result.IsSuccessful = false;
         result.ErrorMessage = ex.Message;
         return result;
     }
 }
예제 #2
0
        public SigmaResultType AddUploadedFileInfo(TypeUploadedFileInfo objUploadedFileInfo)
        {
            TransactionScope scope = null;
            SigmaResultType result = new SigmaResultType();

            TypeUserInfo userinfo = AuthMgr.GetUserInfo();
            //objFileStore.CompanyId = userinfo.CompanyId.ToString();
            objUploadedFileInfo.CreatedBy = userinfo.SigmaUserId;
            objUploadedFileInfo.UpdatedBy = userinfo.SigmaUserId;
            objUploadedFileInfo.UploadedBy = userinfo.SigmaUserId;

            // Get connection string
            string connStr = ConnStrHelper.getDbConnString();

            using (scope = new TransactionScope(TransactionScopeOption.Required))
            {

                List<SqlParameter> paramList = new List<SqlParameter>();
                paramList.Add(new SqlParameter("@FileStoreId", objUploadedFileInfo.FileStoreId));
                paramList.Add(new SqlParameter("@Name", objUploadedFileInfo.Name));
                paramList.Add(new SqlParameter("@Size", objUploadedFileInfo.Size));
                paramList.Add(new SqlParameter("@Path", objUploadedFileInfo.Path));
                paramList.Add(new SqlParameter("@UploadedBy", objUploadedFileInfo.UploadedBy));
                //paramList.Add(new SqlParameter("@UploadedDate", objUploadedFileInfo.UploadedDate));
                paramList.Add(new SqlParameter("@FileExtension", objUploadedFileInfo.FileExtension));
                paramList.Add(new SqlParameter("@Revision", GetUploadedFileRevisionInfo(objUploadedFileInfo.FileStoreId)));
                paramList.Add(new SqlParameter("@CreatedBy", objUploadedFileInfo.CreatedBy));
                paramList.Add(new SqlParameter("@UpdatedBy", objUploadedFileInfo.UpdatedBy));
                SqlParameter outParam = new SqlParameter("@NewId", SqlDbType.Int);
                outParam.Direction = ParameterDirection.Output;
                paramList.Add(outParam);

                result.AffectedRow = SqlHelper.ExecuteNonQuery(connStr, CommandType.StoredProcedure, "usp_AddUploadedFileInfo", paramList.ToArray());
                result.IsSuccessful = true;
                result.ScalarValue = (int)outParam.Value;
                scope.Complete();

            }

            return result;
        }
예제 #3
0
        public SigmaResultType UpdateUploadedFileInfo(TypeUploadedFileInfo objUploadedFileInfo)
        {
            SigmaResultType result = new SigmaResultType();

            try
            {
                result.IsSuccessful = true;
                return result;
            }
            catch (Exception ex)
            {
                // Log Exception
                ExceptionHelper.logException(ex);
                result.IsSuccessful = false;
                result.ErrorMessage = ex.Message;
                return result;
            }
        }
예제 #4
0
        public SigmaResultType UpdateUploadedFileInfo(TypeUploadedFileInfo objUploadedFileInfo)
        {
            TransactionScope scope = null;
            SigmaResultType result = new SigmaResultType();

            TypeUserInfo userinfo = AuthMgr.GetUserInfo();
            //objFileStore.CompanyId = userinfo.CompanyId.ToString();
            objUploadedFileInfo.CreatedBy = userinfo.SigmaUserId;
            objUploadedFileInfo.UpdatedBy = userinfo.SigmaUserId;
            objUploadedFileInfo.UploadedBy = userinfo.SigmaUserId;

            // Get connection string
            string connStr = ConnStrHelper.getDbConnString();

            // Compose parameters
            SqlParameter[] parameters = new SqlParameter[] {
                    new SqlParameter("@UploadedFileInfoId", objUploadedFileInfo.UploadedFileInfoId),
                    new SqlParameter("@FileStoreId", objUploadedFileInfo.FileStoreId),
                    new SqlParameter("@Name", objUploadedFileInfo.Name),
                    new SqlParameter("@Size", objUploadedFileInfo.Size),
                    new SqlParameter("@Path", objUploadedFileInfo.Path),
                    new SqlParameter("@UploadedBy", objUploadedFileInfo.UploadedBy),
                    new SqlParameter("@UploadedDate", objUploadedFileInfo.UploadedDate),
                    new SqlParameter("@FileExtension", objUploadedFileInfo.FileExtension),
                    new SqlParameter("@Revision", objUploadedFileInfo.Revision),
                    new SqlParameter("@CreatedBy", objUploadedFileInfo.CreatedBy),
                    new SqlParameter("@UpdatedBy", objUploadedFileInfo.UpdatedBy),
                };

            using (scope = new TransactionScope(TransactionScopeOption.Required))
            {
                result.AffectedRow = SqlHelper.ExecuteNonQuery(connStr, "usp_UpdateUploadedFileInfo", parameters);
                result.IsSuccessful = true;
                scope.Complete();

            }

            return result;
        }
예제 #5
0
        public SigmaResultType RemoveUploadedFileInfo(TypeUploadedFileInfo objUploadedFileInfo)
        {
            SigmaResultType result = new SigmaResultType();
            TransactionScope scope = null;

            // Get connection string
            string connStr = ConnStrHelper.getDbConnString();

            // Compose parameters
            SqlParameter[] parameters = new SqlParameter[] {
                    new SqlParameter("@UploadedFileInfoId", objUploadedFileInfo.UploadedFileInfoId)
                };

            using (scope = new TransactionScope(TransactionScopeOption.Required))
            {
                result.AffectedRow = SqlHelper.ExecuteNonQuery(connStr, "usp_RemoveUploadedFileInfo", parameters);
                result.IsSuccessful = true;
                scope.Complete();
            }

            return result;
        }